diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample
index 90c2a9ab9..68f144c08 100644
--- a/custom/conf/app.ini.sample
+++ b/custom/conf/app.ini.sample
@@ -288,6 +288,8 @@ RESET_PASSWD_CODE_LIVE_MINUTES = 180
REGISTER_EMAIL_CONFIRM = false
; Disallow registration, only allow admins to create accounts.
DISABLE_REGISTRATION = false
+; Allow registration only using third part services, it works only when DISABLE_REGISTRATION is false
+ALLOW_ONLY_EXTERNAL_REGISTRATION = false
; User must sign in to view anything.
REQUIRE_SIGNIN_VIEW = false
; Mail notification
diff --git a/modules/auth/user_form.go b/modules/auth/user_form.go
index 956ebd944..5906abcd1 100644
--- a/modules/auth/user_form.go
+++ b/modules/auth/user_form.go
@@ -44,6 +44,7 @@ type InstallForm struct {
EnableOpenIDSignIn bool
EnableOpenIDSignUp bool
DisableRegistration bool
+ AllowOnlyExternalRegistration bool
EnableCaptcha bool
RequireSignInView bool
DefaultKeepEmailPrivate bool
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index af1a28242..9f20d955c 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -1143,6 +1143,7 @@ var Service struct {
ResetPwdCodeLives int
RegisterEmailConfirm bool
DisableRegistration bool
+ AllowOnlyExternalRegistration bool
ShowRegistrationButton bool
RequireSignInView bool
EnableNotifyMail bool
@@ -1168,7 +1169,8 @@ func newService() {
Service.ActiveCodeLives = sec.Key("ACTIVE_CODE_LIVE_MINUTES").MustInt(180)
Service.ResetPwdCodeLives = sec.Key("RESET_PASSWD_CODE_LIVE_MINUTES").MustInt(180)
Service.DisableRegistration = sec.Key("DISABLE_REGISTRATION").MustBool()
- Service.ShowRegistrationButton = sec.Key("SHOW_REGISTRATION_BUTTON").MustBool(!Service.DisableRegistration)
+ Service.AllowOnlyExternalRegistration = sec.Key("ALLOW_ONLY_EXTERNAL_REGISTRATION").MustBool()
+ Service.ShowRegistrationButton = sec.Key("SHOW_REGISTRATION_BUTTON").MustBool(!(Service.DisableRegistration || Service.AllowOnlyExternalRegistration))
Service.RequireSignInView = sec.Key("REQUIRE_SIGNIN_VIEW").MustBool()
Service.EnableReverseProxyAuth = sec.Key("ENABLE_REVERSE_PROXY_AUTHENTICATION").MustBool()
Service.EnableReverseProxyAutoRegister = sec.Key("ENABLE_REVERSE_PROXY_AUTO_REGISTRATION").MustBool()
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 2c8e9cd0b..3082569bf 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -117,6 +117,7 @@ federated_avatar_lookup = Enable Federated Avatars
federated_avatar_lookup_popup = Enable federated avatar lookup using Libravatar.
disable_registration = Disable Self-Registration
disable_registration_popup = Disable user self-registration. Only administrators will be able to create new user accounts.
+allow_only_external_registration_popup=Enable the registration only through external services.
openid_signin = Enable OpenID Sign-In
openid_signin_popup = Enable user sign-in via OpenID.
openid_signup = Enable OpenID Self-Registration
@@ -1442,6 +1443,7 @@ config.db_path_helper = (for "sqlite3" and "tidb")
config.service_config = Service Configuration
config.register_email_confirm = Require Email Confirmation to Register
config.disable_register = Disable Self-Registration
+config.allow_only_external_registration = Enable the registration only through external services
config.enable_openid_signup = Enable OpenID Self-Registration
config.enable_openid_signin = Enable OpenID Sign-In
config.show_registration_button = Show Register Button
diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini
index ba7fe3271..a4281beda 100644
--- a/options/locale/locale_uk-UA.ini
+++ b/options/locale/locale_uk-UA.ini
@@ -127,6 +127,7 @@ default_keep_email_private=Приховати адресу електронно
default_keep_email_private_popup=Приховати адресу електронної пошти нових облікових записів за замовчуванням.
default_allow_create_organization=Дозволити створення організацій за замовчуванням
default_enable_timetracking=Увімкнути відстеження часу за замовчуванням
+no_reply_address=Прихований поштовий домен
[home]
uname_holder=Ім'я користувача або Ел. пошта
@@ -302,8 +303,12 @@ emails=Адреса електронної пошти
manage_emails=Керування адресами ел. пошти
email_desc=Ваша основна адреса електронної пошти використовуватиметься для сповіщення та інших операцій.
primary=Основний
+primary_email=Зробити основним
delete_email=Видалити
+add_new_email=Додати нову адресу електронної пошти
+add_email=Додати адресу електронної пошти
keep_email_private=Приховати адресу електронної пошти
+keep_email_private_popup=Вашу адресу електронної пошти буде приховано від інших користувачів.
manage_ssh_keys=Керувати SSH ключами
manage_gpg_keys=Керувати GPG ключами
@@ -575,6 +580,7 @@ pulls.create=Створити запит на злиття
pulls.title_desc=хоче злити %[1]d комітів з %[2]s
до %[3]s
pulls.tab_conversation=Обговорення
pulls.tab_commits=Коміти
+pulls.tab_files=Змінені файли
pulls.reopen_to_merge=Будь ласка перевідкрийте цей запит щоб здіснити операцію злиття.
pulls.merged=Злито
pulls.can_auto_merge_desc=Цей запит можна об'єднати автоматично.
@@ -657,7 +663,7 @@ search.search_repo=Пошук репозиторію
settings=Налаштування
settings.options=Репозиторій
settings.collaboration.admin=Адміністратор
-settings.collaboration.write=Написати
+settings.collaboration.write=Запис
settings.collaboration.read=Читати
settings.collaboration.undefined=Не визначено
settings.hooks=Веб-хуки
@@ -687,6 +693,7 @@ settings.delete=Видалити цей репозиторій
settings.delete_notices_1=- Цю операцію НЕ МОЖНА відмінити.
settings.update_settings_success=Налаштування репозиторію було оновлено.
settings.transfer_owner=Новий власник
+settings.make_transfer=Здіснити перенесення
settings.confirm_delete=Видалити репозиторій
settings.delete_collaborator=Видалити
settings.search_user_placeholder=Пошук користувача…
@@ -707,6 +714,7 @@ settings.slack_icon_url=URL іконки
settings.discord_username=Ім'я кристувача
settings.discord_icon_url=URL іконки
settings.slack_color=Колір
+settings.event_send_everything=Всі події
settings.event_create=Створити
settings.event_create_desc=Гілку або тег створено.
settings.event_pull_request=Запити до злиття
@@ -804,6 +812,10 @@ settings.delete=Видалити організацію
settings.delete_account=Видалити цю організацію
settings.confirm_delete_account=Підтвердіть видалення
+members.membership_visibility=Видимість учасника:
+members.public_helper=зробити прихованим
+members.private=Прихований
+members.private_helper=зробити видимим
members.member_role=Роль учасника:
members.owner=Власник
members.member=Учасник
@@ -815,6 +827,8 @@ members.invite_now=Запросити зараз
teams.join=Приєднатися
teams.leave=Покинути
teams.read_access=Доступ для читання
+teams.write_access=Доступ на запис
+teams.admin_access=Доступ адміністратора
teams.settings=Налаштування
teams.members=Учасники команди
teams.update_settings=Оновити налаштування
@@ -855,17 +869,28 @@ dashboard.gc_metadata_obtained=Отримано метаданих GC
dashboard.other_system_allocation_obtained=Отримання інших виділень пам'яті
dashboard.next_gc_recycle=Наступний цикл GC
+users.user_manage_panel=Керування обліковими записами користувачів
+users.new_account=Створити обліковий запис
users.name=Ім'я кристувача
users.activated=Активовано
users.admin=Адміністратор
users.repos=Репозиторії
users.created=Створено
users.last_login=Останній вхід
+users.send_register_notify=Надіслати повідомлення про реєстрацію користувача
users.edit=Редагувати
users.auth_source=Джерело автентифікації
users.local=Локальні
users.max_repo_creation=Максимальна кількість репозиторіїв
users.max_repo_creation_desc=(Введіть -1, щоб використовувати глобальний ліміт за замовчуванням.)
+users.is_activated=Обліковий запис користувача увімкнено
+users.prohibit_login=Вимкнути вхід
+users.is_admin=Адміністратор
+users.allow_git_hook=Може створювати Git хуки
+users.allow_import_local=Може імпортувати локальні репозиторії
+users.allow_create_organization=Може створювати організацій
+users.update_profile=Оновити обліковий запис
+users.delete_account=Видалити цей обліковий запис
orgs.org_manage_panel=Керування організаціями
orgs.name=Назва
diff --git a/routers/install.go b/routers/install.go
index 2a7ec93d2..84e506c70 100644
--- a/routers/install.go
+++ b/routers/install.go
@@ -112,6 +112,7 @@ func Install(ctx *context.Context) {
form.EnableOpenIDSignIn = setting.Service.EnableOpenIDSignIn
form.EnableOpenIDSignUp = setting.Service.EnableOpenIDSignUp
form.DisableRegistration = setting.Service.DisableRegistration
+ form.AllowOnlyExternalRegistration = setting.Service.AllowOnlyExternalRegistration
form.EnableCaptcha = setting.Service.EnableCaptcha
form.RequireSignInView = setting.Service.RequireSignInView
form.DefaultKeepEmailPrivate = setting.Service.DefaultKeepEmailPrivate
@@ -304,6 +305,7 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
cfg.Section("openid").Key("ENABLE_OPENID_SIGNIN").SetValue(com.ToStr(form.EnableOpenIDSignIn))
cfg.Section("openid").Key("ENABLE_OPENID_SIGNUP").SetValue(com.ToStr(form.EnableOpenIDSignUp))
cfg.Section("service").Key("DISABLE_REGISTRATION").SetValue(com.ToStr(form.DisableRegistration))
+ cfg.Section("service").Key("ALLOW_ONLY_EXTERNAL_REGISTRATION").SetValue(com.ToStr(form.AllowOnlyExternalRegistration))
cfg.Section("service").Key("ENABLE_CAPTCHA").SetValue(com.ToStr(form.EnableCaptcha))
cfg.Section("service").Key("REQUIRE_SIGNIN_VIEW").SetValue(com.ToStr(form.RequireSignInView))
cfg.Section("service").Key("DEFAULT_KEEP_EMAIL_PRIVATE").SetValue(com.ToStr(form.DefaultKeepEmailPrivate))
diff --git a/routers/user/auth.go b/routers/user/auth.go
index 2a5cb8e4b..c8e1ada0d 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -741,7 +741,8 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha
- if setting.Service.DisableRegistration {
+ //Permission denied if DisableRegistration or AllowOnlyExternalRegistration options are true
+ if !setting.Service.ShowRegistrationButton {
ctx.Error(403)
return
}
diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl
index 370325692..d8292a9e6 100644
--- a/templates/admin/config.tmpl
+++ b/templates/admin/config.tmpl
@@ -114,6 +114,8 @@
{{.DescriptionHTML}}
{{end}} -{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}
{{else}} diff --git a/templates/install.tmpl b/templates/install.tmpl index bd79b3a06..46439b497 100644 --- a/templates/install.tmpl +++ b/templates/install.tmpl @@ -200,6 +200,12 @@ +