Browse Source

贡献者列表关联隐藏邮件地址的用户

tags/v1.21.12.1
avadesian 4 years ago
parent
commit
4993f06d63
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 {
return &users[0],nil
}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")
}
}


Loading…
Cancel
Save