simplegit

ui: move sign out to the top of settings, centered

Reorder /settings to session (sign out) → git tokens → password, with
sign out at the top and password reset last, since tokens and sign out
are used far more often. Center the sign-out button (.signout) against
the otherwise left-aligned forms, and assert the section order in the
test.

89564f87fa22031be39508626e2132510cae5d68
cjosie <administrator@josie-c.com> · 2026-10-16T18:46 · browse files at this commit

parents: d5403d0

diff --git a/internal/web/settings_test.go b/internal/web/settings_test.go
index b1eb602..2ceda0f 100644
--- a/internal/web/settings_test.go
+++ b/internal/web/settings_test.go
@@ -45,8 +45,16 @@ func TestSettingsHasSignOut(t *testing.T) {
 	if err != nil {
 		t.Fatalf("GET /settings: %v", err)
 	}
-	if body := readAll(t, resp); !strings.Contains(body, `action="/logout"`) {
-		t.Error("settings page has no sign-out form")
+	body := readAll(t, resp)
+	if !strings.Contains(body, `action="/logout"`) {
+		t.Fatal("settings page has no sign-out form")
+	}
+	// Order: sign out, then token creation, then password reset.
+	logout := strings.Index(body, `action="/logout"`)
+	tokens := strings.Index(body, `action="/settings/tokens"`)
+	password := strings.Index(body, `action="/settings/password"`)
+	if !(logout < tokens && tokens < password) {
+		t.Errorf("settings order = logout@%d tokens@%d password@%d, want that order", logout, tokens, password)
 	}
 }
 
diff --git a/internal/web/static/style.css b/internal/web/static/style.css
index f7b76b7..b1b811f 100644
--- a/internal/web/static/style.css
+++ b/internal/web/static/style.css
@@ -112,6 +112,8 @@ textarea { width: 100%; resize: vertical; }
 .panel { max-width: 560px; }
 .panel input:not([type=radio]):not([type=checkbox]), .panel select, .panel textarea { width: 100%; }
 
+.signout { text-align: center; }
+
 .badge { font-size: .8em; color: var(--muted); }
 .badge.open { color: var(--success); }
 .badge.closed { color: var(--danger); }
diff --git a/internal/web/templates/settings.html b/internal/web/templates/settings.html
index 8084e59..f12e976 100644
--- a/internal/web/templates/settings.html
+++ b/internal/web/templates/settings.html
@@ -2,17 +2,9 @@
 {{define "content"}}
 <h1>settings</h1>
 
-<h2>password</h2>
-{{if .PasswordError}}<p class="error">{{.PasswordError}}</p>{{end}}
-{{if .PasswordOK}}<p class="ok">password changed.</p>{{end}}
-<form method="post" action="/settings/password" class="panel">
-  <p><label for="current_password">current password</label><br>
-     <input id="current_password" name="current_password" type="password" required></p>
-  <p><label for="new_password">new password</label><br>
-     <input id="new_password" name="new_password" type="password" required></p>
-  <p><label for="confirm_password">confirm new password</label><br>
-     <input id="confirm_password" name="confirm_password" type="password" required></p>
-  <p><button type="submit">change password</button></p>
+<h2>session</h2>
+<form method="post" action="/logout" class="signout">
+  <p><button type="submit">sign out</button></p>
 </form>
 
 {{if .NewToken}}
@@ -44,8 +36,16 @@
   <p><button type="submit">create token</button></p>
 </form>
 
-<h2>session</h2>
-<form method="post" action="/logout">
-  <p><button type="submit">sign out</button></p>
+<h2>password</h2>
+{{if .PasswordError}}<p class="error">{{.PasswordError}}</p>{{end}}
+{{if .PasswordOK}}<p class="ok">password changed.</p>{{end}}
+<form method="post" action="/settings/password" class="panel">
+  <p><label for="current_password">current password</label><br>
+     <input id="current_password" name="current_password" type="password" required></p>
+  <p><label for="new_password">new password</label><br>
+     <input id="new_password" name="new_password" type="password" required></p>
+  <p><label for="confirm_password">confirm new password</label><br>
+     <input id="confirm_password" name="confirm_password" type="password" required></p>
+  <p><button type="submit">change password</button></p>
 </form>
 {{end}}