diff options
author | zeripath | 2019-06-13 17:16:50 +0100 |
---|---|---|
committer | techknowlogick | 2019-06-13 12:16:50 -0400 |
commit | 76e8eec3d9b9289df33e1fa5c83dac22662029cf (patch) | |
tree | 8c2489a1f0d4964995836bea7ac7d9ba3a7cd173 | |
parent | 10effb396a94fabab9a1e4a7d8ef1d777d45ee1d (diff) |
Detect noreply email address as user (#7133) (#7195)
-rw-r--r-- | models/user.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/models/user.go b/models/user.go index bfbe9391b..7aaf08f62 100644 --- a/models/user.go +++ b/models/user.go @@ -1346,6 +1346,19 @@ func GetUserByEmail(email string) (*User, error) { return GetUserByID(emailAddress.UID) } + // 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 := x.Get(user) + if err != nil { + return nil, err + } + if has { + return user, nil + } + } + return nil, ErrUserNotExist{0, email, 0} } |