aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-06-06 06:54:25 +0100
committerGitHub <noreply@github.com>2019-06-06 06:54:25 +0100
commitbd55f6ff36d40503bfa3407225780d0ab7d37930 (patch)
treeca85b4b91e71600cbebf48080cdbb30fa8c7e8c7 /models
parentdadc03f5ff07b0aa857ceccaa655bb4fb6e41494 (diff)
downloadgitea-bd55f6ff36d40503bfa3407225780d0ab7d37930.tar.gz
gitea-bd55f6ff36d40503bfa3407225780d0ab7d37930.zip
Detect noreply email address as user (#7133)
Diffstat (limited to 'models')
-rw-r--r--models/user.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/models/user.go b/models/user.go
index 9ee27ddfbd..e29cf5b32a 100644
--- a/models/user.go
+++ b/models/user.go
@@ -1334,6 +1334,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}
}