mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
UX of link account (Step 1) (#5006)
* Show either sign up OR sign in * disambiguate fresh start from adding recovery options * use tabs to switch between account link flows * add active to tab body as well * changes as per discussion * handle specific error; fix missing err typo
This commit is contained in:
@@ -664,8 +664,30 @@ func LinkAccount(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["user_name"] = gothUser.(goth.User).NickName
|
||||
ctx.Data["email"] = gothUser.(goth.User).Email
|
||||
uname := gothUser.(goth.User).NickName
|
||||
email := gothUser.(goth.User).Email
|
||||
ctx.Data["user_name"] = uname
|
||||
ctx.Data["email"] = email
|
||||
|
||||
if len(email) != 0 {
|
||||
u, err := models.GetUserByEmail(email)
|
||||
if err != nil && !models.IsErrUserNotExist(err) {
|
||||
ctx.ServerError("UserSignIn", err)
|
||||
return
|
||||
}
|
||||
if u != nil {
|
||||
ctx.Data["user_exists"] = true
|
||||
}
|
||||
} else if len(uname) != 0 {
|
||||
u, err := models.GetUserByName(uname)
|
||||
if err != nil && !models.IsErrUserNotExist(err) {
|
||||
ctx.ServerError("UserSignIn", err)
|
||||
return
|
||||
}
|
||||
if u != nil {
|
||||
ctx.Data["user_exists"] = true
|
||||
}
|
||||
}
|
||||
|
||||
ctx.HTML(200, tplLinkAccount)
|
||||
}
|
||||
|
Reference in New Issue
Block a user