Fix minor display bug on profile edit page
Cette révision appartient à :
Parent
8d3d169316
révision
a96902a737
2 fichiers modifiés avec 9 ajouts et 7 suppressions
|
@ -156,19 +156,19 @@ func UserProfileFormHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if len(err) == 0 {
|
if len(err) == 0 {
|
||||||
modelHelper.BindValueForm(&b, r)
|
modelHelper.BindValueForm(&b, r)
|
||||||
if !userPermission.HasAdmin(currentUser) {
|
if !userPermission.HasAdmin(currentUser) {
|
||||||
b.Username = currentUser.Username
|
b.Username = userProfile.Username
|
||||||
b.Status = currentUser.Status
|
b.Status = userProfile.Status
|
||||||
} else {
|
} 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["errors"] = append(err["errors"], "Elevating status to moderator is prohibited")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = modelHelper.ValidateForm(&b, err)
|
err = modelHelper.ValidateForm(&b, err)
|
||||||
if len(err) == 0 {
|
if len(err) == 0 {
|
||||||
if b.Email != currentUser.Email {
|
if b.Email != userProfile.Email {
|
||||||
userService.SendVerificationToUser(*currentUser, b.Email)
|
userService.SendVerificationToUser(*currentUser, b.Email)
|
||||||
infos["infos"] = append(infos["infos"], fmt.Sprintf(T("email_changed"), 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)
|
userProfile, _, errorUser = userService.UpdateUser(w, &b, currentUser, id)
|
||||||
if errorUser != nil {
|
if errorUser != nil {
|
||||||
|
|
|
@ -81,8 +81,10 @@
|
||||||
<select id="status" name="status" class="form-control">
|
<select id="status" name="status" class="form-control">
|
||||||
<option value="-1" {{ if eq .Status -1 }}selected{{end}}>{{ T "banned"}}</option>
|
<option value="-1" {{ if eq .Status -1 }}selected{{end}}>{{ T "banned"}}</option>
|
||||||
<option value="0" {{ if eq .Status 0 }}selected{{end}}>{{ T "member"}} ({{ T "default" }})</option>
|
<option value="0" {{ if eq .Status 0 }}selected{{end}}>{{ T "member"}} ({{ T "default" }})</option>
|
||||||
<option value="1" {{ if eq .Status 1 }}selected{{end}}>{{ T "trusted_member"}} </option>
|
<option value="1" {{ if eq .Status 1 }}selected{{end}}>{{ T "trusted_member"}}</option>
|
||||||
<!-- <option value="2" {{ if eq .Status 2 }}selected{{end}}>{{ T "moderator"}} </option> -->
|
{{ if eq .Status 2 }} <!-- just so that it shows correctly -->
|
||||||
|
<option value="2" selected>{{ T "moderator"}}</option>
|
||||||
|
{{end}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
{{ range (index $.FormErrors "status")}}
|
{{ range (index $.FormErrors "status")}}
|
||||||
|
|
Référencer dans un nouveau ticket