Update profile.go
Cette révision appartient à :
Parent
0800924982
révision
9d485e5a77
1 fichiers modifiés avec 7 ajouts et 3 suppressions
|
@ -189,10 +189,14 @@ func UserProfileFormHandler(c *gin.Context) {
|
||||||
validator.ValidateForm(&userForm, messages)
|
validator.ValidateForm(&userForm, messages)
|
||||||
if !messages.HasErrors() {
|
if !messages.HasErrors() {
|
||||||
if userForm.Email != userProfile.Email {
|
if userForm.Email != userProfile.Email {
|
||||||
|
if currentUser.HasAdmin() {
|
||||||
|
userProfile.Email = userForm.Email
|
||||||
|
} else {
|
||||||
email.SendVerificationToUser(currentUser, userForm.Email)
|
email.SendVerificationToUser(currentUser, userForm.Email)
|
||||||
messages.AddInfoTf("infos", "email_changed", userForm.Email)
|
messages.AddInfoTf("infos", "email_changed", userForm.Email)
|
||||||
userForm.Email = userProfile.Email // reset, it will be set when user clicks verification
|
userForm.Email = userProfile.Email // reset, it will be set when user clicks verification
|
||||||
}
|
}
|
||||||
|
}
|
||||||
user, _, err := users.UpdateFromRequest(c, &userForm, &userSettingsForm, currentUser, uint(id))
|
user, _, err := users.UpdateFromRequest(c, &userForm, &userSettingsForm, currentUser, uint(id))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
messages.Error(err)
|
messages.Error(err)
|
||||||
|
|
Référencer dans un nouveau ticket