aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/user
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-03-14 20:51:58 +0100
committerGitHub <noreply@github.com>2022-03-14 20:51:58 +0100
commit1cb649525d9e81027fdaa00d93b81fc3f06ec311 (patch)
tree7ed886bae0b0404d05ddfd7c35ba375488bc47f4 /routers/api/v1/user
parent99861e3e067ae5bd80ce6b647cf9ace08556725b (diff)
downloadgitea-1cb649525d9e81027fdaa00d93b81fc3f06ec311.tar.gz
gitea-1cb649525d9e81027fdaa00d93b81fc3f06ec311.zip
Restrict email address validation (#17688) (#19085)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers/api/v1/user')
-rw-r--r--routers/api/v1/user/email.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/api/v1/user/email.go b/routers/api/v1/user/email.go
index 6887c306cc..ed79723c60 100644
--- a/routers/api/v1/user/email.go
+++ b/routers/api/v1/user/email.go
@@ -80,7 +80,8 @@ func AddEmail(ctx *context.APIContext) {
if err := user_model.AddEmailAddresses(emails); err != nil {
if user_model.IsErrEmailAlreadyUsed(err) {
ctx.Error(http.StatusUnprocessableEntity, "", "Email address has been used: "+err.(user_model.ErrEmailAlreadyUsed).Email)
- } else if user_model.IsErrEmailInvalid(err) {
+ } else if user_model.IsErrEmailCharIsNotSupported(err) ||
+ user_model.IsErrEmailInvalid(err) {
errMsg := fmt.Sprintf("Email address %s invalid", err.(user_model.ErrEmailInvalid).Email)
ctx.Error(http.StatusUnprocessableEntity, "", errMsg)
} else {