mirror of https://github.com/go-gitea/gitea.git
parent
039eb66c8c
commit
86c3481eff
|
@ -1104,19 +1104,9 @@ func GetUserByEmailContext(ctx context.Context, email string) (*User, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
email = strings.ToLower(email)
|
email = strings.ToLower(email)
|
||||||
// First try to find the user by primary email
|
|
||||||
user := &User{Email: email}
|
|
||||||
has, err := db.GetEngine(ctx).Get(user)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if has {
|
|
||||||
return user, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise, check in alternative list for activated email addresses
|
// Otherwise, check in alternative list for activated email addresses
|
||||||
emailAddress := &EmailAddress{Email: email, IsActivated: true}
|
emailAddress := &EmailAddress{LowerEmail: email, IsActivated: true}
|
||||||
has, err = db.GetEngine(ctx).Get(emailAddress)
|
has, err := db.GetEngine(ctx).Get(emailAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue