handle specific error; fix missing err typo
This commit is contained in:
parent
5a42829dbd
commit
ee0fa3e58f
|
@ -661,15 +661,20 @@ func LinkAccount(ctx *context.Context) {
|
||||||
ctx.Data["email"] = email
|
ctx.Data["email"] = email
|
||||||
|
|
||||||
if len(email) != 0 {
|
if len(email) != 0 {
|
||||||
// ignoring the "user not found" error
|
u, err := models.GetUserByEmail(email)
|
||||||
u, _ := models.GetUserByEmail(email)
|
if err != nil && !models.IsErrUserNotExist(err) {
|
||||||
|
ctx.ServerError("UserSignIn", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
if u != nil {
|
if u != nil {
|
||||||
ctx.Data["user_exists"] = true
|
ctx.Data["user_exists"] = true
|
||||||
}
|
}
|
||||||
} else if len(uname) != 0 {
|
} else if len(uname) != 0 {
|
||||||
// ignoring the "user not found" error
|
u, err := models.GetUserByName(uname)
|
||||||
u, _ := models.GetUserByName(uname)
|
if err != nil && !models.IsErrUserNotExist(err) {
|
||||||
fmt.Println("Error retrieving username:", err)
|
ctx.ServerError("UserSignIn", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
if u != nil {
|
if u != nil {
|
||||||
ctx.Data["user_exists"] = true
|
ctx.Data["user_exists"] = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue