ui(users): banner explaining the disabled-username re-enable flow
CI / Test (rest) (pull_request) Successful in 29s
CI / Lint (pull_request) Successful in 32s
CI / Test (server-http) (pull_request) Successful in 1m9s
CI / Test (store) (pull_request) Successful in 1m13s
CI / Build (windows/amd64) (pull_request) Successful in 23s
CI / Build (linux/amd64) (pull_request) Successful in 21s
CI / Build (linux/arm64) (pull_request) Successful in 37s
CI / Test (rest) (pull_request) Successful in 29s
CI / Lint (pull_request) Successful in 32s
CI / Test (server-http) (pull_request) Successful in 1m9s
CI / Test (store) (pull_request) Successful in 1m13s
CI / Build (windows/amd64) (pull_request) Successful in 23s
CI / Build (linux/amd64) (pull_request) Successful in 21s
CI / Build (linux/arm64) (pull_request) Successful in 37s
This commit is contained in:
@@ -153,6 +153,11 @@ type userFormPage struct {
|
||||
SetupURL string
|
||||
SetupExpAt time.Time
|
||||
Error string
|
||||
// Reenable is set when the admin landed here because they tried
|
||||
// to add a username that already exists (disabled). Triggers a
|
||||
// banner on the edit page explaining why and steering them at
|
||||
// the Re-enable button. See handleUIUserNewPost's collision branch.
|
||||
Reenable bool
|
||||
}
|
||||
|
||||
func (s *Server) handleUIUserNewGet(w stdhttp.ResponseWriter, r *stdhttp.Request) {
|
||||
@@ -290,6 +295,7 @@ func (s *Server) handleUIUserEditGet(w stdhttp.ResponseWriter, r *stdhttp.Reques
|
||||
Mode: "edit", ID: target.ID, Username: target.Username,
|
||||
Email: em, Role: string(target.Role),
|
||||
Disabled: target.DisabledAt != nil,
|
||||
Reenable: r.URL.Query().Get("reenable") == "1",
|
||||
}
|
||||
_ = s.deps.UI.Render(w, "user_edit", view)
|
||||
}
|
||||
|
||||
@@ -16,6 +16,28 @@
|
||||
{{else}}Edit <span class="mono">{{$page.Username}}</span>{{end}}
|
||||
</h1>
|
||||
|
||||
{{/* Re-enable banner — fires when the admin tried to add a user
|
||||
whose name already exists in a disabled state. We were
|
||||
redirected here from /settings/users/new with ?reenable=1. */}}
|
||||
{{if and $page.Reenable $page.Disabled}}
|
||||
<div class="panel mt-5 rounded-[7px] p-5"
|
||||
style="border-color: color-mix(in oklch, var(--warn), transparent 50%);
|
||||
background: color-mix(in oklch, var(--warn), transparent 95%);">
|
||||
<div class="text-[13px] font-medium text-warn mb-2">Username already exists (disabled)</div>
|
||||
<p class="text-pretty text-[12.5px] text-ink-mute leading-[1.6] mb-4">
|
||||
A user with this name was created previously and then disabled.
|
||||
Re-enable them to restore access (their existing role + email
|
||||
are kept), or pick a different name.
|
||||
</p>
|
||||
<div class="flex gap-2">
|
||||
<form method="post" action="/settings/users/{{$page.ID}}/enable">
|
||||
<button type="submit" class="btn btn-primary">Re-enable {{$page.Username}}</button>
|
||||
</form>
|
||||
<a href="/settings/users/new" class="btn">Pick a different username</a>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if eq $page.Mode "setup-link"}}
|
||||
{{if eq $page.Error "expired"}}
|
||||
<div class="panel mt-7 rounded-[7px] p-6"
|
||||
|
||||
Reference in New Issue
Block a user