From 9d485e5a7757616087b62667aa55fa211fd6de1d Mon Sep 17 00:00:00 2001 From: kilo Date: Tue, 31 Oct 2017 02:41:03 +0100 Subject: [PATCH] Update profile.go --- controllers/user/profile.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/controllers/user/profile.go b/controllers/user/profile.go index be58d1d3..ad1f6aae 100644 --- a/controllers/user/profile.go +++ b/controllers/user/profile.go @@ -189,9 +189,13 @@ func UserProfileFormHandler(c *gin.Context) { validator.ValidateForm(&userForm, messages) if !messages.HasErrors() { if userForm.Email != userProfile.Email { - email.SendVerificationToUser(currentUser, userForm.Email) - messages.AddInfoTf("infos", "email_changed", userForm.Email) - userForm.Email = userProfile.Email // reset, it will be set when user clicks verification + if currentUser.HasAdmin() { + userProfile.Email = userForm.Email + } else { + email.SendVerificationToUser(currentUser, userForm.Email) + messages.AddInfoTf("infos", "email_changed", userForm.Email) + userForm.Email = userProfile.Email // reset, it will be set when user clicks verification + } } user, _, err := users.UpdateFromRequest(c, &userForm, &userSettingsForm, currentUser, uint(id)) if err != nil {