Browse Source

fix-429

pull/525/head
ychao_1983 3 years ago
parent
commit
8b2aec4ad4
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      routers/secure/user.go

+ 9
- 0
routers/secure/user.go View File

@@ -7,6 +7,7 @@ package secure


import ( import (
"net/http" "net/http"
"net/mail"
"strings" "strings"


"code.gitea.io/gitea/models" "code.gitea.io/gitea/models"
@@ -63,6 +64,14 @@ func CreateUser(ctx *context.Context, form api.CreateUserOption) {
// "422": // "422":
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"


_, err1 := mail.ParseAddress(form.Email)
if err1 != nil {
ctx.JSON(http.StatusBadRequest, map[string]string{
"error_msg": "Email format is wrong.",
})
return
}

u := &models.User{ u := &models.User{
Name: form.Username, Name: form.Username,
FullName: form.FullName, FullName: form.FullName,


Loading…
Cancel
Save