Skip to content

Commit 7fbe606

Browse files
committed
finish
1 parent a7720b4 commit 7fbe606

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

routers/user/auth.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,7 @@ func LinkAccount(ctx *context.Context) {
828828
ctx.Data["RecaptchaSitekey"] = setting.Service.RecaptchaSitekey
829829
ctx.Data["HcaptchaSitekey"] = setting.Service.HcaptchaSitekey
830830
ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration
831+
ctx.Data["AllowOnlyInternalRegistration"] = setting.Service.AllowOnlyInternalRegistration
831832
ctx.Data["ShowRegistrationButton"] = false
832833

833834
// use this to set the right link into the signIn and signUp templates in the link_account template
@@ -993,7 +994,7 @@ func LinkAccountPostRegister(ctx *context.Context) {
993994
return
994995
}
995996

996-
if setting.Service.DisableRegistration {
997+
if setting.Service.DisableRegistration || setting.Service.AllowOnlyInternalRegistration {
997998
ctx.Error(http.StatusForbidden)
998999
return
9991000
}

templates/user/auth/link_account.tmpl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
<div class="ui secondary pointing tabular top attached borderless menu new-menu navbar">
44
<div class="new-menu-inner">
55
<!-- TODO handle .ShowRegistrationButton once other login bugs are fixed -->
6-
<a class="item {{if not .user_exists}}active{{end}}"
7-
data-tab="auth-link-signup-tab">
8-
{{.i18n.Tr "auth.oauth_signup_tab"}}
9-
</a>
6+
{{if not .AllowOnlyInternalRegistration}}
7+
<a class="item {{if not .user_exists}}active{{end}}"
8+
data-tab="auth-link-signup-tab">
9+
{{.i18n.Tr "auth.oauth_signup_tab"}}
10+
</a>
11+
{{end}}
1012
<a class="item {{if .user_exists}}active{{end}}"
1113
data-tab="auth-link-signin-tab">
1214
{{.i18n.Tr "auth.oauth_signin_tab"}}

0 commit comments

Comments
 (0)