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 commitdec57cf0ef3ea34a18201b2ec57d06f8dc49ec3cParent: c5b40ed7 changed files +121 -67
- crates/im-web/assets/main.css +19 -0
- crates/im-web/src/admin.rs +20 -24
- crates/im-web/src/auth.rs +5 -5
- crates/im-web/src/directory.rs +17 -1
- crates/im-web/src/i18n.rs +8 -7
- crates/im-web/src/pages.rs +28 -28
- style/main.scss +24 -2
crates/im-web/assets/main.cssmodified+19 -0
| @@ -1153,6 +1153,13 @@ body:has(.log-list) .admin-card:has(.log-list) { | ||
| 1153 | 1153 | color: var(--ink); |
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | +.admin-sessions { | |
| 1157 | + display: inline-block; | |
| 1158 | + vertical-align: top; | |
| 1159 | +} | |
| 1160 | +.admin-sessions + .admin-sessions { | |
| 1161 | + margin-left: 16px; | |
| 1162 | +} | |
| 1156 | 1163 | .admin-sessions summary { |
| 1157 | 1164 | cursor: pointer; |
| 1158 | 1165 | font-size: 12px; |
| @@ -1165,6 +1172,18 @@ body:has(.log-list) .admin-card:has(.log-list) { | ||
| 1165 | 1172 | overflow-wrap: anywhere; |
| 1166 | 1173 | max-width: 280px; |
| 1167 | 1174 | } |
| 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 | +} | |
| 1168 | 1187 | |
| 1169 | 1188 | input[type=checkbox] { |
| 1170 | 1189 | accent-color: var(--accent); |
crates/im-web/src/admin.rsmodified+20 -24
| @@ -195,9 +195,10 @@ async fn admin_page(cx: &Cx) -> Result<Response> { | ||
| 195 | 195 | .into_response(cx) |
| 196 | 196 | } |
| 197 | 197 | |
| 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. | |
| 201 | 202 | fn sessions_row( |
| 202 | 203 | user: &User, |
| 203 | 204 | sessions: &[im_core::sessions::SessionInfo], |
| @@ -266,8 +267,20 @@ fn sessions_row( | ||
| 266 | 267 | ) |
| 267 | 268 | }; |
| 268 | 269 | 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), | |
| 271 | 284 | ) |
| 272 | 285 | } |
| 273 | 286 | |
| @@ -292,25 +305,8 @@ async fn users_section( | ||
| 292 | 305 | .join(" · "); |
| 293 | 306 | let id = escape(&user.id.to_string()); |
| 294 | 307 | 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 | - ); | |
| 307 | 308 | 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)) | |
| 314 | 310 | } else { |
| 315 | 311 | // Every row action is a two-step disclosure — iz's |
| 316 | 312 | // confirm-details idiom: the summary is the word, the panel holds |
| @@ -350,7 +346,7 @@ async fn users_section( | ||
| 350 | 346 | t(lang, Key::ConfirmDelete), |
| 351 | 347 | ); |
| 352 | 348 | 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}"#, | |
| 354 | 350 | sign_out = t(lang, Key::SignOutEverywhere), |
| 355 | 351 | ) |
| 356 | 352 | }; |
crates/im-web/src/auth.rsmodified+5 -5
| @@ -408,13 +408,13 @@ async fn email_change(cx: &Cx, Form(input): Form<EmailChangeForm>) -> Redirect { | ||
| 408 | 408 | match accounts::request_email_change(store, &me.id, &input.email).await { |
| 409 | 409 | Ok(pair) => pair, |
| 410 | 410 | Err(AccountError::InvalidEmail) => { |
| 411 | - return see("/?section=profile&error=bad_email".to_string()); | |
| 411 | + return see("/?section=password&error=bad_email".to_string()); | |
| 412 | 412 | } |
| 413 | 413 | Err(AccountError::SameEmail) => { |
| 414 | - return see("/?section=profile&error=same_email".to_string()); | |
| 414 | + return see("/?section=password&error=same_email".to_string()); | |
| 415 | 415 | } |
| 416 | 416 | Err(AccountError::EmailTaken) => { |
| 417 | - return see("/?section=profile&error=email_taken".to_string()); | |
| 417 | + return see("/?section=password&error=email_taken".to_string()); | |
| 418 | 418 | } |
| 419 | 419 | Err(e) => return Err(topcoat::Error::from(std::io::Error::other(e.to_string()))), |
| 420 | 420 | }; |
| @@ -449,7 +449,7 @@ async fn email_change(cx: &Cx, Form(input): Form<EmailChangeForm>) -> Redirect { | ||
| 449 | 449 | ) |
| 450 | 450 | .await; |
| 451 | 451 | 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()) | |
| 453 | 453 | } else { |
| 454 | 454 | let links = format!( |
| 455 | 455 | "{issuer}/email/{} {issuer}/email/{}", |
| @@ -457,7 +457,7 @@ async fn email_change(cx: &Cx, Form(input): Form<EmailChangeForm>) -> Redirect { | ||
| 457 | 457 | new_token.expose() |
| 458 | 458 | ); |
| 459 | 459 | see(format!( |
| 460 | - "/?section=profile&ok=email_change_asked&links={}", | |
| 460 | + "/?section=password&ok=email_change_asked&links={}", | |
| 461 | 461 | crate::oidc::urlencode(&links) |
| 462 | 462 | )) |
| 463 | 463 | } |
crates/im-web/src/directory.rsmodified+17 -1
| @@ -1130,7 +1130,23 @@ mod tests { | ||
| 1130 | 1130 | .await; |
| 1131 | 1131 | assert_eq!(status, StatusCode::SEE_OTHER); |
| 1132 | 1132 | 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 | + ); | |
| 1134 | 1150 | let encoded = location |
| 1135 | 1151 | .split("links=") |
| 1136 | 1152 | .nth(1) |
crates/im-web/src/i18n.rsmodified+8 -7
| @@ -839,6 +839,14 @@ pub fn sessions_summary(lang: Lang, n: usize) -> String { | ||
| 839 | 839 | } |
| 840 | 840 | } |
| 841 | 841 | |
| 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 | + | |
| 842 | 850 | /// A log row's kind as a word, izlek's `activity_kind_word`: the stored |
| 843 | 851 | /// string is the stable identifier, the words are presentation. A kind this |
| 844 | 852 | /// build does not know shows as itself. |
| @@ -999,13 +1007,6 @@ pub fn email_pending_line(lang: Lang, new_email_html: &str) -> String { | ||
| 999 | 1007 | } |
| 1000 | 1008 | } |
| 1001 | 1009 | |
| 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 | -} | |
| 1009 | 1010 | /// The address-change confirmation mail. Two travel per request — to the |
| 1010 | 1011 | /// address being left and the one being gained — and each says which kind |
| 1011 | 1012 | /// 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 { | ||
| 761 | 761 | </form> |
| 762 | 762 | <div class="auth-sub">(t(lang, Key::AccountPasswordNote))</div> |
| 763 | 763 | </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> | |
| 764 | 792 | } |
| 765 | 793 | if section != "sessions" && section != "preferences" && section != "password" && section != "apps" { |
| 766 | 794 | <div class="auth-card"> |
| @@ -869,34 +897,6 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result { | ||
| 869 | 897 | </div> |
| 870 | 898 | </dl> |
| 871 | 899 | </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> | |
| 900 | 900 | } |
| 901 | 901 | <div class="auth-footer">(t(lang, Key::BrandFooter))</div> |
| 902 | 902 | </div> |
style/main.scssmodified+24 -2
| @@ -1201,9 +1201,16 @@ body:has(.log-list) { | ||
| 1201 | 1201 | |
| 1202 | 1202 | .admin-confirm-title { font-weight: 600; color: var(--ink); } |
| 1203 | 1203 | |
| 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. | |
| 1206 | 1208 | .admin-sessions { |
| 1209 | + display: inline-block; | |
| 1210 | + vertical-align: top; | |
| 1211 | + | |
| 1212 | + & + & { margin-left: 16px; } | |
| 1213 | + | |
| 1207 | 1214 | summary { |
| 1208 | 1215 | cursor: pointer; |
| 1209 | 1216 | font-size: 12px; |
| @@ -1218,6 +1225,21 @@ body:has(.log-list) { | ||
| 1218 | 1225 | overflow-wrap: anywhere; |
| 1219 | 1226 | max-width: 280px; |
| 1220 | 1227 | } |
| 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 | + } | |
| 1221 | 1243 | } |
| 1222 | 1244 | |
| 1223 | 1245 | input[type="checkbox"] { accent-color: var(--accent); } |