File tree 5 files changed +79
-14
lines changed
5 files changed +79
-14
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ sign_in_with = Sign In With
9
9
sign_out = Sign Out
10
10
sign_up = Register
11
11
link_account = Link Account
12
- link_account_signin_or_signup = Sign in with existing credentials to link your existing account to this account. Or register a new one.
13
12
register = Register
14
13
website = Website
15
14
version = Version
@@ -230,6 +229,12 @@ twofa_passcode_incorrect = Your passcode is incorrect. If you misplaced your dev
230
229
twofa_scratch_token_incorrect = Your scratch code is incorrect.
231
230
login_userpass = Sign In
232
231
login_openid = OpenID
232
+ oauth_signup_tab = Register New Account
233
+ oauth_signup_title = Add Email and Password (for Account Recovery)
234
+ oauth_signup_submit = Complete Account
235
+ oauth_signin_tab = Link to Existing Account
236
+ oauth_signin_title = Sign In to Authorize Linked Account
237
+ oauth_signin_submit = Link Account
233
238
openid_connect_submit = Connect
234
239
openid_connect_title = Connect to an existing account
235
240
openid_connect_desc = The chosen OpenID URI is unknown. Associate it with a new account here.
Original file line number Diff line number Diff line change @@ -664,8 +664,30 @@ func LinkAccount(ctx *context.Context) {
664
664
return
665
665
}
666
666
667
- ctx .Data ["user_name" ] = gothUser .(goth.User ).NickName
668
- ctx .Data ["email" ] = gothUser .(goth.User ).Email
667
+ uname := gothUser .(goth.User ).NickName
668
+ email := gothUser .(goth.User ).Email
669
+ ctx .Data ["user_name" ] = uname
670
+ ctx .Data ["email" ] = email
671
+
672
+ if len (email ) != 0 {
673
+ u , err := models .GetUserByEmail (email )
674
+ if err != nil && ! models .IsErrUserNotExist (err ) {
675
+ ctx .ServerError ("UserSignIn" , err )
676
+ return
677
+ }
678
+ if u != nil {
679
+ ctx .Data ["user_exists" ] = true
680
+ }
681
+ } else if len (uname ) != 0 {
682
+ u , err := models .GetUserByName (uname )
683
+ if err != nil && ! models .IsErrUserNotExist (err ) {
684
+ ctx .ServerError ("UserSignIn" , err )
685
+ return
686
+ }
687
+ if u != nil {
688
+ ctx .Data ["user_exists" ] = true
689
+ }
690
+ }
669
691
670
692
ctx .HTML (200 , tplLinkAccount )
671
693
}
Original file line number Diff line number Diff line change 1
1
{{template "base/head" .}}
2
+
2
3
<div class="user link-account">
3
4
<div class="ui middle very relaxed page grid">
4
5
<div class="column">
5
- <p class="large center">
6
- {{.i18n.Tr "link_account_signin_or_signup"}}
7
- </p>
6
+
7
+ <div class="ui tabular menu">
8
+ <!-- TODO handle .ShowRegistrationButton once other login bugs are fixed -->
9
+ <div class="item {{if not .user_exists}}active{{end}}"
10
+ data-tab="auth-link-signup-tab">
11
+ {{.i18n.Tr "auth.oauth_signup_tab"}}
12
+ </div>
13
+ <div class="item {{if .user_exists}}active{{end}}"
14
+ data-tab="auth-link-signin-tab">
15
+ {{.i18n.Tr "auth.oauth_signin_tab"}}
16
+ </div>
17
+ </div>
18
+
19
+ <div class="ui tab {{if not .user_exists}}active{{end}}"
20
+ data-tab="auth-link-signup-tab">
21
+ {{template "user/auth/signup_inner" .}}
22
+ </div>
23
+ <div class="ui tab {{if .user_exists}}active{{end}}"
24
+ data-tab="auth-link-signin-tab">
25
+ <div class="ui user signin container icon">
26
+ {{template "user/auth/signin_inner" .}}
27
+ </div>
28
+ </div>
8
29
</div>
9
30
</div>
10
31
</div>
11
- <div class="ui user signin container icon">
12
- {{template "user/auth/signin_inner" .}}
13
- </div>
14
- {{template "user/auth/signup_inner" .}}
32
+
15
33
{{template "base/footer" .}}
Original file line number Diff line number Diff line change 2
2
{{template "base/alert" .}}
3
3
{{end}}
4
4
<h4 class="ui top attached header center">
5
- {{.i18n.Tr "auth.login_userpass"}}
5
+ {{if .LinkAccountMode}}
6
+ {{.i18n.Tr "auth.oauth_signin_title"}}
7
+ {{else}}
8
+ {{.i18n.Tr "auth.login_userpass"}}
9
+ {{end}}
6
10
</h4>
7
11
<div class="ui attached segment">
8
12
<form class="ui form" action="{{.SignInLink}}" method="post">
27
31
28
32
<div class="inline field">
29
33
<label></label>
30
- <button class="ui green button">{{.i18n.Tr "sign_in"}}</button>
34
+ <button class="ui green button">
35
+ {{if .LinkAccountMode}}
36
+ {{.i18n.Tr "auth.oauth_signin_submit"}}
37
+ {{else}}
38
+ {{.i18n.Tr "sign_in"}}
39
+ {{end}}
40
+ </button>
31
41
<a href="{{AppSubUrl}}/user/forgot_password">{{.i18n.Tr "auth.forgot_password"}}</a>
32
42
</div>
33
43
Original file line number Diff line number Diff line change 4
4
<form class="ui form" action="{{.SignUpLink}}" method="post">
5
5
{{.CsrfTokenHtml}}
6
6
<h3 class="ui top attached header">
7
- {{.i18n.Tr "sign_up"}}
7
+ {{if .LinkAccountMode}}
8
+ {{.i18n.Tr "auth.oauth_signup_title"}}
9
+ {{else}}
10
+ {{.i18n.Tr "sign_up"}}
11
+ {{end}}
8
12
</h3>
9
13
<div class="ui attached segment">
10
14
{{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister)}}
47
51
48
52
<div class="inline field">
49
53
<label></label>
50
- <button class="ui green button">{{.i18n.Tr "auth.create_new_account"}}</button>
54
+ <button class="ui green button">
55
+ {{if .LinkAccountMode}}
56
+ {{.i18n.Tr "auth.oauth_signup_submit"}}
57
+ {{else}}
58
+ {{.i18n.Tr "auth.create_new_account"}}
59
+ {{end}}
60
+ </button>
51
61
</div>
52
62
53
63
{{if not .LinkAccountMode}}
You can’t perform that action at this time.
0 commit comments