From a96902a7377d2ebbddfa0720350a1a5ebd4b729b Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 11 May 2017 23:31:34 +0200 Subject: [PATCH] Fix minor display bug on profile edit page --- router/userHandler.go | 10 +++++----- templates/_profile_edit.html | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/router/userHandler.go b/router/userHandler.go index e534edb4..5370896c 100755 --- a/router/userHandler.go +++ b/router/userHandler.go @@ -156,19 +156,19 @@ func UserProfileFormHandler(w http.ResponseWriter, r *http.Request) { if len(err) == 0 { modelHelper.BindValueForm(&b, r) if !userPermission.HasAdmin(currentUser) { - b.Username = currentUser.Username - b.Status = currentUser.Status + b.Username = userProfile.Username + b.Status = userProfile.Status } else { - if b.Status == 2 { + if userProfile.Status != b.Status && b.Status == 2 { err["errors"] = append(err["errors"], "Elevating status to moderator is prohibited") } } err = modelHelper.ValidateForm(&b, err) if len(err) == 0 { - if b.Email != currentUser.Email { + if b.Email != userProfile.Email { userService.SendVerificationToUser(*currentUser, b.Email) infos["infos"] = append(infos["infos"], fmt.Sprintf(T("email_changed"), b.Email)) - b.Email = currentUser.Email // reset, it will be set when user clicks verification + b.Email = userProfile.Email // reset, it will be set when user clicks verification } userProfile, _, errorUser = userService.UpdateUser(w, &b, currentUser, id) if errorUser != nil { diff --git a/templates/_profile_edit.html b/templates/_profile_edit.html index d549fd80..fa560084 100644 --- a/templates/_profile_edit.html +++ b/templates/_profile_edit.html @@ -81,8 +81,10 @@ {{ range (index $.FormErrors "status")}}