forge
Explore
Log in

Don't you dare go Hollow

the users table's email edit learns the fold, and the address card moves behind the password: the edit's popover was a guest in a scroll box — absolute against a table the panel scrolls, so on the lower rows the form hung below the clip and the actions stopped matching the panel's rhythm — so the button leaves the row entirely and the form folds under the person, a quiet 'Edit address' summary beside the sessions count in the same in-flow strip, opening in normal flow where nothing can clip it, while the destructive confirmations keep their popovers (short, they always fit); and the self-served address change leaves the landing's profile, which is what a person reads, for the password section, where the account's other keys already live — form, pending line, and every redirect follow, profile back to identity and counts alone

Browse files at this commit

dec57cf0ef3ea34a18201b2ec57d06f8dc49ec3cAhmet Kaan GümüşParent: c5b40ed
crates/im-web/assets/main.cssmodified+19 -0
@@ -1153,6 +1153,13 @@ body:has(.log-list) .admin-card:has(.log-list) {
11531153 color: var(--ink);
11541154 }
11551155
1156+.admin-sessions {
1157+ display: inline-block;
1158+ vertical-align: top;
1159+}
1160+.admin-sessions + .admin-sessions {
1161+ margin-left: 16px;
1162+}
11561163 .admin-sessions summary {
11571164 cursor: pointer;
11581165 font-size: 12px;
@@ -1165,6 +1172,18 @@ body:has(.log-list) .admin-card:has(.log-list) {
11651172 overflow-wrap: anywhere;
11661173 max-width: 280px;
11671174 }
1175+.admin-sessions .admin-fold-form {
1176+ width: 260px;
1177+ padding: 12px;
1178+ background: var(--surface);
1179+ border: 1px solid var(--border-strong);
1180+ border-radius: var(--radius);
1181+ margin: 8px 24px 8px 0;
1182+ display: flex;
1183+ flex-direction: column;
1184+ gap: 8px;
1185+ font-size: 12px;
1186+}
11681187
11691188 input[type=checkbox] {
11701189 accent-color: var(--accent);
crates/im-web/src/admin.rsmodified+20 -24
@@ -195,9 +195,10 @@ async fn admin_page(cx: &Cx) -> Result<Response> {
195195 .into_response(cx)
196196 }
197197
198-/// One person's live sessions as the disclosure under their row: a small
199-/// table with a per-session revoke, or the muted line when nothing is live.
200-/// The admin's own row gets one too — "you" still signs in from somewhere.
198+/// One person's folded strip under their row: the live sessions — a small
199+/// table with a per-session revoke, or the muted line when nothing is live —
200+/// and, beside it, the address edit. The admin's own row gets both: "you"
201+/// still signs in from somewhere, and the rescue reaches their own address.
201202 fn sessions_row(
202203 user: &User,
203204 sessions: &[im_core::sessions::SessionInfo],
@@ -266,8 +267,20 @@ fn sessions_row(
266267 )
267268 };
268269 format!(
269- r#"<tr><td colspan="4"><details class="admin-sessions"><summary class="muted">{}</summary>{body}</details></td></tr>"#,
270- i18n::sessions_summary(lang, sessions.len())
270+ concat!(
271+ r#"<tr><td colspan="4">"#,
272+ r#"<details class="admin-sessions"><summary class="muted">{sessions_summary}</summary>{body}</details>"#,
273+ r#"<details class="admin-sessions"><summary class="muted">{email_summary}</summary>"#,
274+ r#"<div class="admin-fold-form"><form method="post" action="/admin/user_email" class="admin-form"><input type="hidden" name="user" value="{id}"><label class="auth-field"><span class="auth-label">{email_label}</span><input class="auth-input auth-input-mono" type="email" name="email" value="{email}" required></label><button class="admin-action" type="submit">{save}</button></form></div>"#,
275+ r#"</details></td></tr>"#
276+ ),
277+ body = body,
278+ sessions_summary = i18n::sessions_summary(lang, sessions.len()),
279+ email_summary = i18n::email_fold_summary(lang),
280+ id = id,
281+ email_label = t(lang, Key::EmailCol),
282+ email = escape(&user.email),
283+ save = t(lang, Key::SaveButton),
271284 )
272285 }
273286
@@ -292,25 +305,8 @@ async fn users_section(
292305 .join(" · ");
293306 let id = escape(&user.id.to_string());
294307 let email = escape(&user.email);
295- // The address edit sits on every row — the admin's own included:
296- // the rescue exists precisely for a mailbox the mail cannot reach.
297- // Same two-step disclosure as the row's other actions.
298- let email_edit = format!(
299- r#"<details class="admin-confirm"><summary class="admin-action">{edit_word}</summary><div class="admin-confirm-pop"><div class="admin-confirm-title">{edit_title}</div><form method="post" action="/admin/user_email" class="admin-form"><input type="hidden" name="user" value="{id}"><label class="auth-field"><span class="auth-label">{email_label}</span><input class="auth-input auth-input-mono" type="email" name="email" value="{email}" required></label><button class="admin-action" type="submit">{save}</button></form></div></details>"#,
300- edit_word = t(lang, Key::EditWord),
301- edit_title = i18n::email_edit_title(lang, &email),
302- id = id,
303- email_label = t(lang, Key::EmailCol),
304- email = email,
305- save = t(lang, Key::SaveButton),
306- );
307308 let actions = if user.id == me.id {
308- // Never let the only admin lock themselves out by reflex. The
309- // address edit stays: fixing one's own address is the point.
310- format!(
311- r#"<span class="muted">{}</span>{email_edit}"#,
312- t(lang, Key::YouWord)
313- )
309+ format!(r#"<span class="muted">{}</span>"#, t(lang, Key::YouWord))
314310 } else {
315311 // Every row action is a two-step disclosure — iz's
316312 // confirm-details idiom: the summary is the word, the panel holds
@@ -350,7 +346,7 @@ async fn users_section(
350346 t(lang, Key::ConfirmDelete),
351347 );
352348 format!(
353- r#"{email_edit}{toggle}<form method="post" action="/admin/revoke"><input type="hidden" name="user" value="{id}"><button class="admin-action" type="submit">{sign_out}</button></form>{remove}"#,
349+ r#"{toggle}<form method="post" action="/admin/revoke"><input type="hidden" name="user" value="{id}"><button class="admin-action" type="submit">{sign_out}</button></form>{remove}"#,
354350 sign_out = t(lang, Key::SignOutEverywhere),
355351 )
356352 };
crates/im-web/src/auth.rsmodified+5 -5
@@ -408,13 +408,13 @@ async fn email_change(cx: &Cx, Form(input): Form<EmailChangeForm>) -> Redirect {
408408 match accounts::request_email_change(store, &me.id, &input.email).await {
409409 Ok(pair) => pair,
410410 Err(AccountError::InvalidEmail) => {
411- return see("/?section=profile&error=bad_email".to_string());
411+ return see("/?section=password&error=bad_email".to_string());
412412 }
413413 Err(AccountError::SameEmail) => {
414- return see("/?section=profile&error=same_email".to_string());
414+ return see("/?section=password&error=same_email".to_string());
415415 }
416416 Err(AccountError::EmailTaken) => {
417- return see("/?section=profile&error=email_taken".to_string());
417+ return see("/?section=password&error=email_taken".to_string());
418418 }
419419 Err(e) => return Err(topcoat::Error::from(std::io::Error::other(e.to_string()))),
420420 };
@@ -449,7 +449,7 @@ async fn email_change(cx: &Cx, Form(input): Form<EmailChangeForm>) -> Redirect {
449449 )
450450 .await;
451451 if old_mailed && new_mailed {
452- see("/?section=profile&ok=email_change_asked".to_string())
452+ see("/?section=password&ok=email_change_asked".to_string())
453453 } else {
454454 let links = format!(
455455 "{issuer}/email/{} {issuer}/email/{}",
@@ -457,7 +457,7 @@ async fn email_change(cx: &Cx, Form(input): Form<EmailChangeForm>) -> Redirect {
457457 new_token.expose()
458458 );
459459 see(format!(
460- "/?section=profile&ok=email_change_asked&links={}",
460+ "/?section=password&ok=email_change_asked&links={}",
461461 crate::oidc::urlencode(&links)
462462 ))
463463 }
crates/im-web/src/directory.rsmodified+17 -1
@@ -1130,7 +1130,23 @@ mod tests {
11301130 .await;
11311131 assert_eq!(status, StatusCode::SEE_OTHER);
11321132 let location = location.expect("a redirect carrying the once-shown links");
1133- assert!(location.contains("ok=email_change_asked"), "{location}");
1133+ assert!(
1134+ location.contains("/?section=password&ok=email_change_asked"),
1135+ "{location}"
1136+ );
1137+
1138+ // The address card answers on the password section only; the profile
1139+ // carries no address-mutation form anymore.
1140+ let profile_page = get_page(&router, "/?section=profile", &cookie).await;
1141+ assert!(
1142+ !profile_page.contains(r#"action="/email_change""#),
1143+ "{profile_page}"
1144+ );
1145+ let password_page = get_page(&router, "/?section=password", &cookie).await;
1146+ assert!(
1147+ password_page.contains(r#"action="/email_change""#),
1148+ "{password_page}"
1149+ );
11341150 let encoded = location
11351151 .split("links=")
11361152 .nth(1)
crates/im-web/src/i18n.rsmodified+8 -7
@@ -839,6 +839,14 @@ pub fn sessions_summary(lang: Lang, n: usize) -> String {
839839 }
840840 }
841841
842+/// The admin row's "Edit address" disclosure summary, in the viewer's language.
843+pub fn email_fold_summary(lang: Lang) -> String {
844+ match lang {
845+ Lang::En => "Edit address".to_string(),
846+ Lang::Tr => "Adresi düzenle".to_string(),
847+ }
848+}
849+
842850 /// A log row's kind as a word, izlek's `activity_kind_word`: the stored
843851 /// string is the stable identifier, the words are presentation. A kind this
844852 /// build does not know shows as itself.
@@ -999,13 +1007,6 @@ pub fn email_pending_line(lang: Lang, new_email_html: &str) -> String {
9991007 }
10001008 }
10011009
1002-/// The admin row's edit-disclosure title.
1003-pub fn email_edit_title(lang: Lang, email_html: &str) -> String {
1004- match lang {
1005- Lang::En => format!("Change {email_html}'s address."),
1006- Lang::Tr => format!("{email_html} adresini değiştir."),
1007- }
1008-}
10091010 /// The address-change confirmation mail. Two travel per request — to the
10101011 /// address being left and the one being gained — and each says which kind
10111012 /// it is, so the holder knows which door they're opening.
crates/im-web/src/pages.rsmodified+28 -28
@@ -761,6 +761,34 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
761761 </form>
762762 <div class="auth-sub">(t(lang, Key::AccountPasswordNote))</div>
763763 </div>
764+ <div class="auth-card">
765+ <div class="auth-title">(t(lang, Key::EmailCardTitle))</div>
766+ if let Some(pending) = pending_email.as_deref() {
767+ <div class="auth-sub">
768+ (crate::i18n::email_pending_line(lang, &escape(pending)))
769+ </div>
770+ }
771+ if let Some(links) = query_value(&query, "links") {
772+ <div class="auth-note">(links)</div>
773+ }
774+ <form method="post" action="/email_change">
775+ <label class="auth-field">
776+ <span class="auth-label">(t(lang, Key::NewEmailLabel))</span>
777+ <input
778+ class="auth-input auth-input-mono"
779+ type="email"
780+ name="email"
781+ autocomplete="email"
782+ value=(user.email.clone())
783+ required=""
784+ >
785+ </label>
786+ <button class="auth-submit" type="submit">
787+ <span class="auth-submit-text">(t(lang, Key::EmailChangeButton))</span>
788+ </button>
789+ </form>
790+ <div class="auth-sub">(t(lang, Key::EmailChangeNote))</div>
791+ </div>
764792 }
765793 if section != "sessions" && section != "preferences" && section != "password" && section != "apps" {
766794 <div class="auth-card">
@@ -869,34 +897,6 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
869897 </div>
870898 </dl>
871899 </div>
872- <div class="auth-card">
873- <div class="auth-title">(t(lang, Key::EmailCardTitle))</div>
874- if let Some(pending) = pending_email.as_deref() {
875- <div class="auth-sub">
876- (crate::i18n::email_pending_line(lang, &escape(pending)))
877- </div>
878- }
879- if let Some(links) = query_value(&query, "links") {
880- <div class="auth-note">(links)</div>
881- }
882- <form method="post" action="/email_change">
883- <label class="auth-field">
884- <span class="auth-label">(t(lang, Key::NewEmailLabel))</span>
885- <input
886- class="auth-input auth-input-mono"
887- type="email"
888- name="email"
889- autocomplete="email"
890- value=(user.email.clone())
891- required=""
892- >
893- </label>
894- <button class="auth-submit" type="submit">
895- <span class="auth-submit-text">(t(lang, Key::EmailChangeButton))</span>
896- </button>
897- </form>
898- <div class="auth-sub">(t(lang, Key::EmailChangeNote))</div>
899- </div>
900900 }
901901 <div class="auth-footer">(t(lang, Key::BrandFooter))</div>
902902 </div>
style/main.scssmodified+24 -2
@@ -1201,9 +1201,16 @@ body:has(.log-list) {
12011201
12021202 .admin-confirm-title { font-weight: 600; color: var(--ink); }
12031203
1204-// One person's live sessions, folded under their row: the summary is the
1205-// count, the opened panel holds the small table — or the muted line.
1204+// Under each person's row two folds share one strip — the live sessions and
1205+// the address edit. Each details sits inline so the summaries read as a row
1206+// of links, and the opened panels stay in normal flow: a wide table with
1207+// overflow:auto clips absolutely-positioned children, so nothing pops here.
12061208 .admin-sessions {
1209+ display: inline-block;
1210+ vertical-align: top;
1211+
1212+ & + & { margin-left: 16px; }
1213+
12071214 summary {
12081215 cursor: pointer;
12091216 font-size: 12px;
@@ -1218,6 +1225,21 @@ body:has(.log-list) {
12181225 overflow-wrap: anywhere;
12191226 max-width: 280px;
12201227 }
1228+
1229+ // The address-edit panel: the popover's visual box, but static — normal
1230+ // flow inside the fold, so nothing is ever clipped.
1231+ .admin-fold-form {
1232+ width: 260px;
1233+ padding: 12px;
1234+ background: var(--surface);
1235+ border: 1px solid var(--border-strong);
1236+ border-radius: var(--radius);
1237+ margin: 8px 24px 8px 0;
1238+ display: flex;
1239+ flex-direction: column;
1240+ gap: 8px;
1241+ font-size: 12px;
1242+ }
12211243 }
12221244
12231245 input[type="checkbox"] { accent-color: var(--accent); }