This commit is contained in:
Vadim 2018-05-13 20:01:11 +03:00
commit a145139746
12 changed files with 57 additions and 10 deletions

View File

@ -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

View File

@ -44,6 +44,7 @@ type InstallForm struct {
EnableOpenIDSignIn bool
EnableOpenIDSignUp bool
DisableRegistration bool
AllowOnlyExternalRegistration bool
EnableCaptcha bool
RequireSignInView bool
DefaultKeepEmailPrivate bool

View File

@ -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()

View File

@ -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

View File

@ -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 комітів з <code>%[2]s</code> до <code>%[3]s</code>
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=- Цю операцію <strong>НЕ МОЖНА</strong> відмінити.
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=Назва

View File

@ -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))

View File

@ -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
}

View File

@ -114,6 +114,8 @@
<dd><i class="fa fa{{if .Service.RegisterEmailConfirm}}-check{{end}}-square-o"></i></dd>
<dt>{{.i18n.Tr "admin.config.disable_register"}}</dt>
<dd><i class="fa fa{{if .Service.DisableRegistration}}-check{{end}}-square-o"></i></dd>
<dt>{{.i18n.Tr "admin.config.allow_only_external_registration"}}</dt>
<dd><i class="fa fa{{if .Service.AllowOnlyExternalRegistration}}-check{{end}}-square-o"></i></dd>
<dt>{{.i18n.Tr "admin.config.show_registration_button"}}</dt>
<dd><i class="fa fa{{if .Service.ShowRegistrationButton}}-check{{end}}-square-o"></i></dd>
<dt>{{.i18n.Tr "admin.config.enable_openid_signup"}}</dt>

View File

@ -17,9 +17,13 @@
</div>
</div>
{{if .DescriptionHTML}}<p class="has-emoji">{{.DescriptionHTML}}</p>{{end}}
<div>
{{range .Topics}}<div class="ui green basic label topic">{{.}}</div>{{end}}
</div>
{{if .Topics }}
<div>
{{range .Topics}}
{{if ne . "" }}<div class="ui green basic label topic">{{.}}</div>{{end}}
{{end}}
</div>
{{end}}
<p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSinceUnix .UpdatedUnix $.i18n.Lang}}</p>
</div>
{{else}}

View File

@ -200,6 +200,12 @@
<input name="disable_registration" type="checkbox" {{if .disable_registration}}checked{{end}}>
</div>
</div>
<div class="inline field">
<div class="ui checkbox" id="allow-only-external-registration">
<label class="poping up" data-content="{{.i18n.Tr "install.allow_only_external_registration_popup"}}"><strong>{{.i18n.Tr "install.allow_only_external_registration_popup"}}</strong></label>
<input name="allow_only_external_registration" type="checkbox" {{if .allow_only_external_registration}}checked{{end}}>
</div>
</div>
<div class="inline field">
<div class="ui checkbox" id="enable-openid-signup">
<label class="poping up" data-content="{{.i18n.Tr "install.openid_signup_popup"}}"><strong>{{.i18n.Tr "install.openid_signup"}}</strong></label>

View File

@ -70,7 +70,7 @@ type Store struct {
}
type xormSession struct {
ID string `xorm:"VARCHAR(400) PK NAME 'id'"`
ID string `xorm:"VARCHAR(100) PK NAME 'id'"`
Data string `xorm:"TEXT"`
CreatedUnix util.TimeStamp `xorm:"created"`
UpdatedUnix util.TimeStamp `xorm:"updated"`

6
vendor/vendor.json vendored
View File

@ -648,10 +648,10 @@
"revisionTime": "2016-10-16T15:41:25Z"
},
{
"checksumSHA1": "/X7eCdN7MX8zgCjA9s0ktzgTPlA=",
"checksumSHA1": "1zVWfGXRsQi0EuZydyBHgkhl7tU=",
"path": "github.com/lafriks/xormstore",
"revision": "3a80a383a04b29ec2e1bf61279dd948aa809335b",
"revisionTime": "2018-04-09T10:45:24Z"
"revision": "9cab149ea91875cf056211bd6ef82379fce9cb67",
"revisionTime": "2018-05-10T21:06:47Z"
},
{
"checksumSHA1": "Vxvfs8mukr9GOLSuGIPU4ODyOZc=",