Show OpenID Connect and OAuth on signup page (#20242)
Fix #19809 --------- Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com> Co-authored-by: jackHay22 <jack@allspice.io>
This commit is contained in:
parent
cda97a7253
commit
63b53af933
|
@ -392,7 +392,16 @@ func SignUp(ctx *context.Context) {
|
||||||
|
|
||||||
ctx.Data["SignUpLink"] = setting.AppSubURL + "/user/sign_up"
|
ctx.Data["SignUpLink"] = setting.AppSubURL + "/user/sign_up"
|
||||||
|
|
||||||
|
orderedOAuth2Names, oauth2Providers, err := oauth2.GetActiveOAuth2Providers()
|
||||||
|
if err != nil {
|
||||||
|
ctx.ServerError("UserSignUp", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.Data["OrderedOAuth2Names"] = orderedOAuth2Names
|
||||||
|
ctx.Data["OAuth2Providers"] = oauth2Providers
|
||||||
context.SetCaptchaData(ctx)
|
context.SetCaptchaData(ctx)
|
||||||
|
|
||||||
ctx.Data["PageIsSignUp"] = true
|
ctx.Data["PageIsSignUp"] = true
|
||||||
|
|
||||||
// Show Disabled Registration message if DisableRegistration or AllowOnlyExternalRegistration options are true
|
// Show Disabled Registration message if DisableRegistration or AllowOnlyExternalRegistration options are true
|
||||||
|
@ -413,7 +422,16 @@ func SignUpPost(ctx *context.Context) {
|
||||||
|
|
||||||
ctx.Data["SignUpLink"] = setting.AppSubURL + "/user/sign_up"
|
ctx.Data["SignUpLink"] = setting.AppSubURL + "/user/sign_up"
|
||||||
|
|
||||||
|
orderedOAuth2Names, oauth2Providers, err := oauth2.GetActiveOAuth2Providers()
|
||||||
|
if err != nil {
|
||||||
|
ctx.ServerError("UserSignUp", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.Data["OrderedOAuth2Names"] = orderedOAuth2Names
|
||||||
|
ctx.Data["OAuth2Providers"] = oauth2Providers
|
||||||
context.SetCaptchaData(ctx)
|
context.SetCaptchaData(ctx)
|
||||||
|
|
||||||
ctx.Data["PageIsSignUp"] = true
|
ctx.Data["PageIsSignUp"] = true
|
||||||
|
|
||||||
// Permission denied if DisableRegistration or AllowOnlyExternalRegistration options are true
|
// Permission denied if DisableRegistration or AllowOnlyExternalRegistration options are true
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
<a class="{{if .PageIsLogin}}active {{end}}item" rel="nofollow" href="{{AppSubUrl}}/user/login">
|
<a class="{{if .PageIsLogin}}active {{end}}item" rel="nofollow" href="{{AppSubUrl}}/user/login">
|
||||||
{{.locale.Tr "auth.login_userpass"}}
|
{{.locale.Tr "auth.login_userpass"}}
|
||||||
</a>
|
</a>
|
||||||
|
<a class="{{if .PageIsSignUp}}active{{end}} item" rel="nofollow" href="{{AppSubUrl}}/user/sign_up">
|
||||||
|
{{.locale.Tr "auth.create_new_account"}}
|
||||||
|
</a>
|
||||||
{{if .EnableOpenIDSignIn}}
|
{{if .EnableOpenIDSignIn}}
|
||||||
<a class="{{if .PageIsLoginOpenID}}active {{end}}item" rel="nofollow" href="{{AppSubUrl}}/user/login/openid">
|
<a class="{{if .PageIsLoginOpenID}}active {{end}}item" rel="nofollow" href="{{AppSubUrl}}/user/login/openid">
|
||||||
{{svg "fontawesome-openid"}}
|
{{svg "fontawesome-openid"}}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{{template "base/head" .}}
|
{{template "base/head" .}}
|
||||||
<div role="main" aria-label="{{.Title}}" class="page-content user signin{{if .LinkAccountMode}} icon{{end}}">
|
<div role="main" aria-label="{{.Title}}" class="page-content user signin{{if .LinkAccountMode}} icon{{end}}">
|
||||||
|
{{template "user/auth/signin_navbar" .}}
|
||||||
<div class="ui middle very relaxed page grid">
|
<div class="ui middle very relaxed page grid">
|
||||||
{{template "user/auth/signup_inner" .}}
|
{{template "user/auth/signup_inner" .}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -55,6 +55,25 @@
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
{{if and .OrderedOAuth2Names .OAuth2Providers}}
|
||||||
|
<div class="divider divider-text">
|
||||||
|
{{.locale.Tr "sign_in_or"}}
|
||||||
|
</div>
|
||||||
|
<div id="oauth2-login-navigator" class="gt-py-2">
|
||||||
|
<div class="gt-df gt-fc gt-jc">
|
||||||
|
<div id="oauth2-login-navigator-inner" class="gt-df gt-fc gt-fw gt-ac gt-gap-3">
|
||||||
|
{{range $key := .OrderedOAuth2Names}}
|
||||||
|
{{$provider := index $.OAuth2Providers $key}}
|
||||||
|
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$key}}">
|
||||||
|
{{$provider.IconHTML}}
|
||||||
|
{{$.locale.Tr "sign_in_with_provider" $provider.DisplayName}}
|
||||||
|
</a>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue