Skip to content

Commit

Permalink
Validate Email before change user's email
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Nov 25, 2021
1 parent fc5875b commit 47c63ff
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions routers/web/admin/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@ func EditUserPost(ctx *context.Context) {
ctx.RenderWithErr(errMsg, tplUserNew, &form)
return
}

if err := user_model.ValidateEmail(form.Email); err != nil {
ctx.Data["Err_Email"] = true
ctx.RenderWithErr(ctx.Tr("form.email_error"), tplUserNew, &form)
return
}

if u.Salt, err = user_model.GetUserSalt(); err != nil {
ctx.ServerError("UpdateUser", err)
return
Expand Down

0 comments on commit 47c63ff

Please sign in to comment.