0570608738
- .flash.error now renders on the danger surface instead of the success
one; RateLimitErr previously showed as green with red text.
- User delete goes through a confirmation page (GET/POST
/users/{uid}/delete), matching the domain-delete pattern, instead of a
plain submit button next to Save with no confirmation.
- Extracted the repeated DNS Host/Type/Value markup on a domain's page and
the duplicated Settings credentials form into shared partials. No
behaviour change.
docs/plans/code-review.md P3 checked off; CHANGELOG updated.
Co-authored-by: Cursor <cursoragent@cursor.com>
46 lines
1.9 KiB
HTML
46 lines
1.9 KiB
HTML
{{define "content"}}
|
|
<h1>{{if .IsEdit}}Edit user{{else}}Create user{{end}}</h1>
|
|
|
|
{{template "back_link" (back "/users" "Back to users")}}
|
|
|
|
<div class="card narrow">
|
|
{{if .Error}}<p class="error">{{.Error}}</p>{{end}}
|
|
<form method="post" action="{{if .IsEdit}}/users/{{.UserID}}{{else}}/users/new{{end}}">
|
|
<label for="username">Username</label>
|
|
<input id="username" name="username" autocomplete="username"
|
|
autocapitalize="none" spellcheck="false" value="{{.FormUsername}}" required>
|
|
|
|
<label for="password">Password{{if .IsEdit}} (leave empty to keep){{end}}</label>
|
|
<input id="password" name="password" type="password" autocomplete="new-password" {{if not .IsEdit}}required{{end}}>
|
|
|
|
<label for="role">Role</label>
|
|
{{if .LastGlobalLocked}}<input type="hidden" name="role" value="{{.FormRole}}">{{end}}
|
|
<select id="role" name="role" data-global-role="{{.GlobalRole}}"{{if .LastGlobalLocked}} disabled{{end}}>
|
|
<option value="domain_admin" {{if eq .FormRole "domain_admin"}}selected{{end}}>Domain administrator</option>
|
|
<option value="global" {{if eq .FormRole "global"}}selected{{end}}>Global administrator</option>
|
|
</select>
|
|
{{if .LastGlobalLocked}}<p class="muted">The only global administrator cannot be demoted.</p>{{end}}
|
|
|
|
<fieldset id="domain-pick" data-domain-pick>
|
|
<legend>Assigned domains</legend>
|
|
<p class="muted">Required for domain administrators.</p>
|
|
{{range .Domains}}
|
|
<label class="check">
|
|
<input type="checkbox" name="domain_ids" value="{{.ID}}" {{if index $.FormDomains .ID}}checked{{end}}>
|
|
{{.Name}}
|
|
</label>
|
|
{{end}}
|
|
</fieldset>
|
|
|
|
<button type="submit">{{if .IsEdit}}Save{{else}}Create{{end}}</button>
|
|
</form>
|
|
{{if .IsEdit}}
|
|
{{if .LastGlobalLocked}}
|
|
<p class="muted">The only global administrator cannot be deleted.</p>
|
|
{{else}}
|
|
<a class="danger" href="/users/{{.UserID}}/delete">Delete user</a>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|