From 0b445283abe81828f1689e10f9c95bdad2bb20d7 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 6 Oct 2018 16:37:22 +0000 Subject: [PATCH] changes as per discussion --- options/locale/locale_en-US.ini | 12 ++++++------ routers/user/auth.go | 18 ++++++++++-------- templates/user/auth/link_account.tmpl | 12 ++++++------ templates/user/auth/signin_inner.tmpl | 4 ++-- templates/user/auth/signup_inner.tmpl | 4 ++-- 5 files changed, 26 insertions(+), 24 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index b6ca4b7d6..499f4bd6a 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -4,12 +4,6 @@ home = Home dashboard = Dashboard explore = Explore help = Help -auth_link_signup_tab = Register New Account -auth_link_signup_title = Add Email and Password (for Account Recovery) -auth_link_signup_submit = Complete Account -auth_link_signin_tab = Link to Existing Account -auth_link_signin_title = Sign In to Authorize Linked Account -auth_link_signin_submit = Link Account sign_in = Sign In sign_in_with = Sign In With sign_out = Sign Out @@ -235,6 +229,12 @@ twofa_passcode_incorrect = Your passcode is incorrect. If you misplaced your dev twofa_scratch_token_incorrect = Your scratch code is incorrect. login_userpass = Sign In login_openid = OpenID +oauth_signup_tab = Register New Account +oauth_signup_title = Add Email and Password (for Account Recovery) +oauth_signup_submit = Complete Account +oauth_signin_tab = Link to Existing Account +oauth_signin_title = Sign In to Authorize Linked Account +oauth_signin_submit = Link Account openid_connect_submit = Connect openid_connect_title = Connect to an existing account openid_connect_desc = The chosen OpenID URI is unknown. Associate it with a new account here. diff --git a/routers/user/auth.go b/routers/user/auth.go index 8ac30f678..239d9b8e7 100644 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -669,16 +669,18 @@ func LinkAccount(ctx *context.Context) { ctx.Data["user_name"] = uname ctx.Data["email"] = email - if "" != uname { - u, _ := models.GetUserByName(uname) - if u != nil { - ctx.Data["user_name_exists"] = "true" - } - } - if "" != email { + if len(email) != 0 { + // ignoring the "user not found" error u, _ := models.GetUserByEmail(email) if u != nil { - ctx.Data["email_exists"] = "true" + ctx.Data["user_exists"] = true + } + } else if len(uname) != 0 { + // ignoring the "user not found" error + u, _ := models.GetUserByName(uname) + fmt.Println("Error retrieving username:", err) + if u != nil { + ctx.Data["user_exists"] = true } } diff --git a/templates/user/auth/link_account.tmpl b/templates/user/auth/link_account.tmpl index 9edec4435..339ca855d 100644 --- a/templates/user/auth/link_account.tmpl +++ b/templates/user/auth/link_account.tmpl @@ -6,21 +6,21 @@ -
{{template "user/auth/signup_inner" .}}
-