Fix editing other profiles as a mod
Cette révision appartient à :
Parent
9c9db7af0d
révision
500f5bda02
2 fichiers modifiés avec 8 ajouts et 3 suppressions
|
@ -157,6 +157,11 @@ func UserProfileFormHandler(w http.ResponseWriter, r *http.Request) {
|
|||
modelHelper.BindValueForm(&b, r)
|
||||
if !userPermission.HasAdmin(currentUser) {
|
||||
b.Username = currentUser.Username
|
||||
b.Status = currentUser.Status
|
||||
} else {
|
||||
if b.Status == 2 {
|
||||
err["errors"] = append(err["errors"], "Elevating status to moderator is prohibited")
|
||||
}
|
||||
}
|
||||
err = modelHelper.ValidateForm(&b, err)
|
||||
if len(err) == 0 {
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{ if not (HasAdmin .)}}
|
||||
{{ if not (HasAdmin $.User)}}
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label">{{ T "current_password"}}:</label>
|
||||
<div class="col-md-8">
|
||||
|
@ -63,7 +63,7 @@
|
|||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{ if HasAdmin .}}
|
||||
{{ if HasAdmin $.User}}
|
||||
<h3>{{ T "moderation"}}</h3>
|
||||
<div class="form-group">
|
||||
<label class="col-md-3 control-label">{{ T "username"}}:</label>
|
||||
|
@ -82,7 +82,7 @@
|
|||
<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="1" {{ if eq .Status 1 }}selected{{end}}>{{ T "trusted_member"}} </option>
|
||||
<option value="2" {{ if eq .Status 2 }}selected{{end}}>{{ T "moderator"}} </option>
|
||||
<!-- <option value="2" {{ if eq .Status 2 }}selected{{end}}>{{ T "moderator"}} </option> -->
|
||||
</select>
|
||||
</div>
|
||||
{{ range (index $.FormErrors "status")}}
|
||||
|
|
Référencer dans un nouveau ticket