From dec57cf0ef3ea34a18201b2ec57d06f8dc49ec3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Tue, 8 Sep 2026 22:56:50 +0300 Subject: [PATCH] =?UTF-8?q?the=20users=20table's=20email=20edit=20learns?= =?UTF-8?q?=20the=20fold,=20and=20the=20address=20card=20moves=20behind=20?= =?UTF-8?q?the=20password:=20the=20edit's=20popover=20was=20a=20guest=20in?= =?UTF-8?q?=20a=20scroll=20box=20=E2=80=94=20absolute=20against=20a=20tabl?= =?UTF-8?q?e=20the=20panel=20scrolls,=20so=20on=20the=20lower=20rows=20the?= =?UTF-8?q?=20form=20hung=20below=20the=20clip=20and=20the=20actions=20sto?= =?UTF-8?q?pped=20matching=20the=20panel's=20rhythm=20=E2=80=94=20so=20the?= =?UTF-8?q?=20button=20leaves=20the=20row=20entirely=20and=20the=20form=20?= =?UTF-8?q?folds=20under=20the=20person,=20a=20quiet=20'Edit=20address'=20?= =?UTF-8?q?summary=20beside=20the=20sessions=20count=20in=20the=20same=20i?= =?UTF-8?q?n-flow=20strip,=20opening=20in=20normal=20flow=20where=20nothin?= =?UTF-8?q?g=20can=20clip=20it,=20while=20the=20destructive=20confirmation?= =?UTF-8?q?s=20keep=20their=20popovers=20(short,=20they=20always=20fit);?= =?UTF-8?q?=20and=20the=20self-served=20address=20change=20leaves=20the=20?= =?UTF-8?q?landing's=20profile,=20which=20is=20what=20a=20person=20reads,?= =?UTF-8?q?=20for=20the=20password=20section,=20where=20the=20account's=20?= =?UTF-8?q?other=20keys=20already=20live=20=E2=80=94=20form,=20pending=20l?= =?UTF-8?q?ine,=20and=20every=20redirect=20follow,=20profile=20back=20to?= =?UTF-8?q?=20identity=20and=20counts=20alone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/im-web/assets/main.css | 19 ++++++++++++ crates/im-web/src/admin.rs | 44 ++++++++++++-------------- crates/im-web/src/auth.rs | 10 +++--- crates/im-web/src/directory.rs | 18 ++++++++++- crates/im-web/src/i18n.rs | 15 ++++----- crates/im-web/src/pages.rs | 56 +++++++++++++++++----------------- style/main.scss | 26 ++++++++++++++-- 7 files changed, 121 insertions(+), 67 deletions(-) diff --git a/crates/im-web/assets/main.css b/crates/im-web/assets/main.css index 57a9e24..43676c0 100644 --- a/crates/im-web/assets/main.css +++ b/crates/im-web/assets/main.css @@ -1153,6 +1153,13 @@ body:has(.log-list) .admin-card:has(.log-list) { color: var(--ink); } +.admin-sessions { + display: inline-block; + vertical-align: top; +} +.admin-sessions + .admin-sessions { + margin-left: 16px; +} .admin-sessions summary { cursor: pointer; font-size: 12px; @@ -1165,6 +1172,18 @@ body:has(.log-list) .admin-card:has(.log-list) { overflow-wrap: anywhere; max-width: 280px; } +.admin-sessions .admin-fold-form { + width: 260px; + padding: 12px; + background: var(--surface); + border: 1px solid var(--border-strong); + border-radius: var(--radius); + margin: 8px 24px 8px 0; + display: flex; + flex-direction: column; + gap: 8px; + font-size: 12px; +} input[type=checkbox] { accent-color: var(--accent); diff --git a/crates/im-web/src/admin.rs b/crates/im-web/src/admin.rs index 1723f33..e4613ee 100644 --- a/crates/im-web/src/admin.rs +++ b/crates/im-web/src/admin.rs @@ -195,9 +195,10 @@ async fn admin_page(cx: &Cx) -> Result { .into_response(cx) } -/// One person's live sessions as the disclosure under their row: a small -/// table with a per-session revoke, or the muted line when nothing is live. -/// The admin's own row gets one too — "you" still signs in from somewhere. +/// One person's folded strip under their row: the live sessions — a small +/// table with a per-session revoke, or the muted line when nothing is live — +/// and, beside it, the address edit. The admin's own row gets both: "you" +/// still signs in from somewhere, and the rescue reaches their own address. fn sessions_row( user: &User, sessions: &[im_core::sessions::SessionInfo], @@ -266,8 +267,20 @@ fn sessions_row( ) }; format!( - r#"
{}{body}
"#, - i18n::sessions_summary(lang, sessions.len()) + concat!( + r#""#, + r#"
{sessions_summary}{body}
"#, + r#"
{email_summary}"#, + r#"
"#, + r#"
"# + ), + body = body, + sessions_summary = i18n::sessions_summary(lang, sessions.len()), + email_summary = i18n::email_fold_summary(lang), + id = id, + email_label = t(lang, Key::EmailCol), + email = escape(&user.email), + save = t(lang, Key::SaveButton), ) } @@ -292,25 +305,8 @@ async fn users_section( .join(" · "); let id = escape(&user.id.to_string()); let email = escape(&user.email); - // The address edit sits on every row — the admin's own included: - // the rescue exists precisely for a mailbox the mail cannot reach. - // Same two-step disclosure as the row's other actions. - let email_edit = format!( - r#"
{edit_word}
{edit_title}
"#, - edit_word = t(lang, Key::EditWord), - edit_title = i18n::email_edit_title(lang, &email), - id = id, - email_label = t(lang, Key::EmailCol), - email = email, - save = t(lang, Key::SaveButton), - ); let actions = if user.id == me.id { - // Never let the only admin lock themselves out by reflex. The - // address edit stays: fixing one's own address is the point. - format!( - r#"{}{email_edit}"#, - t(lang, Key::YouWord) - ) + format!(r#"{}"#, t(lang, Key::YouWord)) } else { // Every row action is a two-step disclosure — iz's // confirm-details idiom: the summary is the word, the panel holds @@ -350,7 +346,7 @@ async fn users_section( t(lang, Key::ConfirmDelete), ); format!( - r#"{email_edit}{toggle}
{remove}"#, + r#"{toggle}
{remove}"#, sign_out = t(lang, Key::SignOutEverywhere), ) }; diff --git a/crates/im-web/src/auth.rs b/crates/im-web/src/auth.rs index 101eb60..e80e7d5 100644 --- a/crates/im-web/src/auth.rs +++ b/crates/im-web/src/auth.rs @@ -408,13 +408,13 @@ async fn email_change(cx: &Cx, Form(input): Form) -> Redirect { match accounts::request_email_change(store, &me.id, &input.email).await { Ok(pair) => pair, Err(AccountError::InvalidEmail) => { - return see("/?section=profile&error=bad_email".to_string()); + return see("/?section=password&error=bad_email".to_string()); } Err(AccountError::SameEmail) => { - return see("/?section=profile&error=same_email".to_string()); + return see("/?section=password&error=same_email".to_string()); } Err(AccountError::EmailTaken) => { - return see("/?section=profile&error=email_taken".to_string()); + return see("/?section=password&error=email_taken".to_string()); } Err(e) => return Err(topcoat::Error::from(std::io::Error::other(e.to_string()))), }; @@ -449,7 +449,7 @@ async fn email_change(cx: &Cx, Form(input): Form) -> Redirect { ) .await; if old_mailed && new_mailed { - see("/?section=profile&ok=email_change_asked".to_string()) + see("/?section=password&ok=email_change_asked".to_string()) } else { let links = format!( "{issuer}/email/{} {issuer}/email/{}", @@ -457,7 +457,7 @@ async fn email_change(cx: &Cx, Form(input): Form) -> Redirect { new_token.expose() ); see(format!( - "/?section=profile&ok=email_change_asked&links={}", + "/?section=password&ok=email_change_asked&links={}", crate::oidc::urlencode(&links) )) } diff --git a/crates/im-web/src/directory.rs b/crates/im-web/src/directory.rs index 68e68a8..c1a6030 100644 --- a/crates/im-web/src/directory.rs +++ b/crates/im-web/src/directory.rs @@ -1130,7 +1130,23 @@ mod tests { .await; assert_eq!(status, StatusCode::SEE_OTHER); let location = location.expect("a redirect carrying the once-shown links"); - assert!(location.contains("ok=email_change_asked"), "{location}"); + assert!( + location.contains("/?section=password&ok=email_change_asked"), + "{location}" + ); + + // The address card answers on the password section only; the profile + // carries no address-mutation form anymore. + let profile_page = get_page(&router, "/?section=profile", &cookie).await; + assert!( + !profile_page.contains(r#"action="/email_change""#), + "{profile_page}" + ); + let password_page = get_page(&router, "/?section=password", &cookie).await; + assert!( + password_page.contains(r#"action="/email_change""#), + "{password_page}" + ); let encoded = location .split("links=") .nth(1) diff --git a/crates/im-web/src/i18n.rs b/crates/im-web/src/i18n.rs index 22acae0..697b59a 100644 --- a/crates/im-web/src/i18n.rs +++ b/crates/im-web/src/i18n.rs @@ -839,6 +839,14 @@ pub fn sessions_summary(lang: Lang, n: usize) -> String { } } +/// The admin row's "Edit address" disclosure summary, in the viewer's language. +pub fn email_fold_summary(lang: Lang) -> String { + match lang { + Lang::En => "Edit address".to_string(), + Lang::Tr => "Adresi düzenle".to_string(), + } +} + /// A log row's kind as a word, izlek's `activity_kind_word`: the stored /// string is the stable identifier, the words are presentation. A kind this /// build does not know shows as itself. @@ -999,13 +1007,6 @@ pub fn email_pending_line(lang: Lang, new_email_html: &str) -> String { } } -/// The admin row's edit-disclosure title. -pub fn email_edit_title(lang: Lang, email_html: &str) -> String { - match lang { - Lang::En => format!("Change {email_html}'s address."), - Lang::Tr => format!("{email_html} adresini değiştir."), - } -} /// The address-change confirmation mail. Two travel per request — to the /// address being left and the one being gained — and each says which kind /// it is, so the holder knows which door they're opening. diff --git a/crates/im-web/src/pages.rs b/crates/im-web/src/pages.rs index aef2586..061f626 100644 --- a/crates/im-web/src/pages.rs +++ b/crates/im-web/src/pages.rs @@ -761,6 +761,34 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
(t(lang, Key::AccountPasswordNote))
+
+
(t(lang, Key::EmailCardTitle))
+ if let Some(pending) = pending_email.as_deref() { +
+ (crate::i18n::email_pending_line(lang, &escape(pending))) +
+ } + if let Some(links) = query_value(&query, "links") { +
(links)
+ } +
+ + +
+
(t(lang, Key::EmailChangeNote))
+
} if section != "sessions" && section != "preferences" && section != "password" && section != "apps" {
@@ -869,34 +897,6 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
-
-
(t(lang, Key::EmailCardTitle))
- if let Some(pending) = pending_email.as_deref() { -
- (crate::i18n::email_pending_line(lang, &escape(pending))) -
- } - if let Some(links) = query_value(&query, "links") { -
(links)
- } -
- - -
-
(t(lang, Key::EmailChangeNote))
-
} diff --git a/style/main.scss b/style/main.scss index ea6e974..f76c53e 100644 --- a/style/main.scss +++ b/style/main.scss @@ -1201,9 +1201,16 @@ body:has(.log-list) { .admin-confirm-title { font-weight: 600; color: var(--ink); } -// One person's live sessions, folded under their row: the summary is the -// count, the opened panel holds the small table — or the muted line. +// Under each person's row two folds share one strip — the live sessions and +// the address edit. Each details sits inline so the summaries read as a row +// of links, and the opened panels stay in normal flow: a wide table with +// overflow:auto clips absolutely-positioned children, so nothing pops here. .admin-sessions { + display: inline-block; + vertical-align: top; + + & + & { margin-left: 16px; } + summary { cursor: pointer; font-size: 12px; @@ -1218,6 +1225,21 @@ body:has(.log-list) { overflow-wrap: anywhere; max-width: 280px; } + + // The address-edit panel: the popover's visual box, but static — normal + // flow inside the fold, so nothing is ever clipped. + .admin-fold-form { + width: 260px; + padding: 12px; + background: var(--surface); + border: 1px solid var(--border-strong); + border-radius: var(--radius); + margin: 8px 24px 8px 0; + display: flex; + flex-direction: column; + gap: 8px; + font-size: 12px; + } } input[type="checkbox"] { accent-color: var(--accent); }