mirror of
https://github.com/go-gitea/gitea
synced 2025-07-14 14:37:20 +00:00
Backport #11925 Use ID or Where to instead directly use Get when load object from database Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
@ -1558,8 +1558,8 @@ func GetUserByEmailContext(ctx DBContext, email string) (*User, error) {
|
||||
// Finally, if email address is the protected email address:
|
||||
if strings.HasSuffix(email, fmt.Sprintf("@%s", setting.Service.NoReplyAddress)) {
|
||||
username := strings.TrimSuffix(email, fmt.Sprintf("@%s", setting.Service.NoReplyAddress))
|
||||
user := &User{LowerName: username}
|
||||
has, err := ctx.e.Get(user)
|
||||
user := &User{}
|
||||
has, err := ctx.e.Where("lower_name=?", username).Get(user)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user