Browse Source

Merge pull request 'contributors' (#482) from contributors into V20210927-patch

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/482
pull/485/head
lewis 3 years ago
parent
commit
cea6a777af
1 changed files with 12 additions and 0 deletions
  1. +12
    -0
      models/user.go

+ 12
- 0
models/user.go View File

@@ -1556,6 +1556,18 @@ func GetUserByActivateEmail(email string) (*User, error) {
if len(users) >= 1 { if len(users) >= 1 {
return &users[0],nil return &users[0],nil
}else { }else {
// 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)
if err != nil {
return nil, err
}
if has {
return user, nil
}
}
return nil, errors.New("cannot find user by email") return nil, errors.New("cannot find user by email")
} }
} }


Loading…
Cancel
Save