File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -206,17 +206,19 @@ func EditUser(ctx *context.APIContext) {
206
206
}
207
207
var emailChanged bool
208
208
if form .Email != nil {
209
- if err := user_model .ValidateEmail (* form .Email ); err != nil {
210
- ctx .InternalServerError (err )
209
+ email := strings .TrimSpace (* form .Email )
210
+ if len (email ) == 0 {
211
+ ctx .Error (http .StatusUnprocessableEntity , "" , fmt .Errorf ("email is not allowed to be empty string" ))
211
212
return
212
213
}
213
214
214
- emailChanged = ! strings .EqualFold (u .Email , * form .Email )
215
- u .Email = * form .Email
216
- if len (u .Email ) == 0 {
217
- ctx .Error (http .StatusUnprocessableEntity , "" , fmt .Errorf ("email is not allowed to be empty string" ))
215
+ if err := user_model .ValidateEmail (email ); err != nil {
216
+ ctx .InternalServerError (err )
218
217
return
219
218
}
219
+
220
+ emailChanged = ! strings .EqualFold (u .Email , email )
221
+ u .Email = email
220
222
}
221
223
if form .Website != nil {
222
224
u .Website = * form .Website
You can’t perform that action at this time.
0 commit comments