forge
Explore
Log in

Don't you dare go Hollow

Landing reads as sections behind a tab row — profile, sessions, preferences, password — so a window holds the whole page; the admin panel's account tab folds into it, and admins can post a notice to one person or everyone from the mail section

Browse files at this commit

8929bd17cb4c331de1207ba375475df64e56e384Ahmet Kaan GümüşParent: 569b89d
crates/im-web/assets/main.cssmodified+11 -0
@@ -313,6 +313,11 @@ body:has(.auth-stage) > .auth-stage::-webkit-scrollbar {
313 letter-spacing: 0.02em;313 letter-spacing: 0.02em;
314 }314 }
315 315
316+.landing-nav {
317+ justify-content: center;
318+ padding: 4px 0 10px;
319+}
320+
316 .auth-card {321 .auth-card {
317 background: var(--surface);322 background: var(--surface);
318 border: 1px solid var(--border);323 border: 1px solid var(--border);
@@ -402,6 +407,12 @@ body:has(.auth-stage) > .auth-stage::-webkit-scrollbar {
402 border-color: var(--danger);407 border-color: var(--danger);
403 }408 }
404 409
410+textarea.auth-input {
411+ height: auto;
412+ padding: 10px 12px;
413+ resize: vertical;
414+}
415+
405 .auth-input-mono {416 .auth-input-mono {
406 font-family: var(--font-mono);417 font-family: var(--font-mono);
407 }418 }
crates/im-web/src/admin.rsmodified+108 -80
@@ -126,7 +126,7 @@ async fn admin_page(cx: &Cx) -> Result<Response> {
126 .query()126 .query()
127 .unwrap_or("")127 .unwrap_or("")
128 .to_string();128 .to_string();
129- let section = query_value(&query, "section").unwrap_or_else(|| "account".to_string());129+ let section = query_value(&query, "section").unwrap_or_else(|| "users".to_string());
130 let error = query_value(&query, "error");130 let error = query_value(&query, "error");
131 let ok = query_value(&query, "ok");131 let ok = query_value(&query, "ok");
132 let why = query_value(&query, "why");132 let why = query_value(&query, "why");
@@ -134,7 +134,6 @@ async fn admin_page(cx: &Cx) -> Result<Response> {
134 134
135 let nav = |current: &str| {135 let nav = |current: &str| {
136 [136 [
137- ("account", t(lang, Key::NavAccount)),
138 ("users", t(lang, Key::NavUsers)),137 ("users", t(lang, Key::NavUsers)),
139 ("mail", t(lang, Key::NavMail)),138 ("mail", t(lang, Key::NavMail)),
140 ("settings", t(lang, Key::NavSettings)),139 ("settings", t(lang, Key::NavSettings)),
@@ -155,7 +154,7 @@ async fn admin_page(cx: &Cx) -> Result<Response> {
155 "settings" => settings_section(cx, lang).await?,154 "settings" => settings_section(cx, lang).await?,
156 "logs" => logs_section(cx, lang).await?,155 "logs" => logs_section(cx, lang).await?,
157 "users" => users_section(cx, &me, invited.as_deref(), lang).await?,156 "users" => users_section(cx, &me, invited.as_deref(), lang).await?,
158- _ => account_section(&me, lang),157+ _ => users_section(cx, &me, invited.as_deref(), lang).await?,
159 };158 };
160 159
161 let banner = match (ok.as_deref(), error.as_deref()) {160 let banner = match (ok.as_deref(), error.as_deref()) {
@@ -169,7 +168,7 @@ async fn admin_page(cx: &Cx) -> Result<Response> {
169 "enabled" => t(lang, Key::OkEnabled),168 "enabled" => t(lang, Key::OkEnabled),
170 "smtp" => t(lang, Key::OkSmtpSaved),169 "smtp" => t(lang, Key::OkSmtpSaved),
171 "smtp_test" => t(lang, Key::OkSmtpTest),170 "smtp_test" => t(lang, Key::OkSmtpTest),
172- "password" => t(lang, Key::OkPasswordChanged),171+ "message" => t(lang, Key::OkMessageSent),
173 "uninvited" => t(lang, Key::OkUninvited),172 "uninvited" => t(lang, Key::OkUninvited),
174 "deleted" => t(lang, Key::OkDeleted),173 "deleted" => t(lang, Key::OkDeleted),
175 "settings" => t(lang, Key::OkSettingsSaved),174 "settings" => t(lang, Key::OkSettingsSaved),
@@ -207,38 +206,6 @@ async fn admin_page(cx: &Cx) -> Result<Response> {
207 .await?206 .await?
208 .into_response(cx)207 .into_response(cx)
209 }208 }
210-/// The self-service half of the panel: the account the panel is signed in
211-/// as. Izlek keeps this on the settings rail's first tab; so do we.
212-fn account_section(me: &User, lang: i18n::Lang) -> String {
213- let two_factor = if me.totp_confirmed {
214- t(lang, Key::TwoFactorOnNote)
215- } else {
216- t(lang, Key::TwoFactorOffNote)
217- };
218- format!(
219- r#"<div class="admin-card">
220- <div class="auth-title">{title}</div>
221- <div class="auth-sub">{sub}</div>
222- <form method="post" action="/admin/password" class="admin-form">
223- <label class="auth-field"><span class="auth-label">{current}</span>
224- <input class="auth-input auth-input-mono" type="password" name="current" autocomplete="current-password" required></label>
225- <label class="auth-field"><span class="auth-label">{new}</span>
226- <input class="auth-input auth-input-mono" type="password" name="password" autocomplete="new-password" minlength="10" required></label>
227- <label class="auth-field"><span class="auth-label">{again}</span>
228- <input class="auth-input auth-input-mono" type="password" name="password_confirm" autocomplete="new-password" minlength="10" required></label>
229- <button class="auth-submit admin-action-wide" type="submit"><span class="auth-submit-text">{change}</span></button>
230- </form>
231- <div class="auth-sub">{note}</div>
232-</div>"#,
233- title = t(lang, Key::AccountTitle),
234- sub = i18n::account_sub(lang, &escape(&me.email), two_factor),
235- current = t(lang, Key::CurrentPasswordLabel),
236- new = t(lang, Key::NewPasswordLabel),
237- again = t(lang, Key::NewPasswordAgainLabel),
238- change = t(lang, Key::ChangePassword),
239- note = t(lang, Key::AccountPasswordNote),
240- )
241-}
242 209
243 /// One person's live sessions as the disclosure under their row: a small210 /// One person's live sessions as the disclosure under their row: a small
244 /// table with a per-session revoke, or the muted line when nothing is live.211 /// table with a per-session revoke, or the muted line when nothing is live.
@@ -337,10 +304,7 @@ async fn users_section(
337 .join(" · ");304 .join(" · ");
338 let actions = if user.id == me.id {305 let actions = if user.id == me.id {
339 // Never let the only admin lock themselves out by reflex.306 // Never let the only admin lock themselves out by reflex.
340- format!(307+ format!(r#"<span class="muted">{}</span>"#, t(lang, Key::YouWord))
341- r#"<span class="muted">{}</span>"#,
342- t(lang, Key::YouWord)
343- )
344 } else {308 } else {
345 let id = escape(&user.id.to_string());309 let id = escape(&user.id.to_string());
346 let email = escape(&user.email);310 let email = escape(&user.email);
@@ -567,6 +531,38 @@ async fn mail_section(cx: &Cx, lang: i18n::Lang) -> Result<String, topcoat::Erro
567 } else {531 } else {
568 format!(r#"<div class="admin-standing">{lede}</div>"#)532 format!(r#"<div class="admin-standing">{lede}</div>"#)
569 };533 };
534+ let users = accounts::list_users(store).await?;
535+ let mut options = format!(
536+ r#"<option value="everyone">{}</option>"#,
537+ t(lang, Key::EveryoneOption)
538+ );
539+ for person in &users {
540+ options.push_str(&format!(
541+ r#"<option value="{}">{} · {}</option>"#,
542+ escape(person.id.as_str()),
543+ escape(&person.name),
544+ escape(&person.email),
545+ ));
546+ }
547+ let message_card = format!(
548+ r#"<div class="admin-card">
549+ <div class="admin-card-head"><div class="auth-title">{msg_title}</div></div>
550+ <form method="post" action="/admin/message" class="admin-form">
551+ <label class="auth-field"><span class="auth-label">{to_label}</span>
552+ <select class="auth-input" name="to">{options}</select></label>
553+ <label class="auth-field"><span class="auth-label">{subject_label}</span>
554+ <input class="auth-input" type="text" name="subject" required></label>
555+ <label class="auth-field"><span class="auth-label">{body_label}</span>
556+ <textarea class="auth-input" name="body" rows="5" required></textarea></label>
557+ <button class="auth-submit admin-action-wide" type="submit"><span class="auth-submit-text">{send}</span></button>
558+ </form>
559+</div>"#,
560+ msg_title = t(lang, Key::MessageTitle),
561+ to_label = t(lang, Key::MessageToLabel),
562+ subject_label = t(lang, Key::MessageSubjectLabel),
563+ body_label = t(lang, Key::MessageBodyLabel),
564+ send = t(lang, Key::SendMessageButton),
565+ );
570 Ok(format!(566 Ok(format!(
571 r#"<div class="admin-card">567 r#"<div class="admin-card">
572 <div class="admin-card-head"><div class="auth-title">{title}</div><span class="{chip_class}">{chip_text}</span></div>568 <div class="admin-card-head"><div class="auth-title">{title}</div><span class="{chip_class}">{chip_text}</span></div>
@@ -609,6 +605,7 @@ async fn mail_section(cx: &Cx, lang: i18n::Lang) -> Result<String, topcoat::Erro
609 check = t(lang, Key::CheckConnectionButton),605 check = t(lang, Key::CheckConnectionButton),
610 test = t(lang, Key::SendTestMailButton),606 test = t(lang, Key::SendTestMailButton),
611 ))607 ))
608+ .map(|smtp_card| smtp_card + &message_card)
612 }609 }
613 610
614 async fn logs_section(cx: &Cx, lang: i18n::Lang) -> Result<String, topcoat::Error> {611 async fn logs_section(cx: &Cx, lang: i18n::Lang) -> Result<String, topcoat::Error> {
@@ -730,50 +727,10 @@ async fn delete(cx: &Cx, Form(input): Form<UserAction>) -> Result<Response> {
730 back(cx, "users", "&ok=deleted")727 back(cx, "users", "&ok=deleted")
731 }728 }
732 729
733-#[derive(Deserialize)]
734-struct PasswordForm {
735- current: String,
736- password: String,
737- password_confirm: String,
738-}
739-
740-#[route(POST "/admin/password")]
741-async fn password(cx: &Cx, Form(input): Form<PasswordForm>) -> Result<Response> {
742- let me = match require_admin(cx).await {
743- Ok(me) => me,
744- Err(redirect) => return Ok(redirect),
745- };
746- if input.password != input.password_confirm {
747- return back(cx, "account", "&error=passwords_differ");
748- }
749- let store = &app(cx).store;
750- match accounts::change_password(store, &me, &input.current, &input.password).await {
751- Ok(()) => {}
752- Err(accounts::AccountError::Password(problem)) => {
753- use im_core::accounts::PasswordProblem::*;
754- let code = match problem {
755- TooShort => "password_too_short",
756- LooksLikeYou => "password_personal",
757- WrongCurrent => "password_wrong",
758- IsCurrent => "password_same",
759- };
760- return back(cx, "account", &format!("&error={code}"));
761- }
762- Err(e) => return Err(topcoat::Error::from(std::io::Error::other(e.to_string()))),
763- }
764- // Every other device is out; the browser holding this form proved the
765- // old password and keeps its session.
766- if let Some(token) = server::presented_session(cx) {
767- im_core::sessions::revoke_user_sessions_except(store, &me.id, &token).await?;
768- }
769- server::log_event(cx, "password_changed", Some(&me.email), None).await;
770- back(cx, "account", "&ok=password")
771-}
772 #[derive(Deserialize)]730 #[derive(Deserialize)]
773 struct UserAction {731 struct UserAction {
774 user: String,732 user: String,
775 }733 }
776-
777 #[route(POST "/admin/revoke")]734 #[route(POST "/admin/revoke")]
778 async fn revoke(cx: &Cx, Form(input): Form<UserAction>) -> Result<Response> {735 async fn revoke(cx: &Cx, Form(input): Form<UserAction>) -> Result<Response> {
779 let me = match require_admin(cx).await {736 let me = match require_admin(cx).await {
@@ -908,6 +865,9 @@ async fn smtp_test(cx: &Cx) -> Result<Response> {
908 Ok(me) => me,865 Ok(me) => me,
909 Err(redirect) => return Ok(redirect),866 Err(redirect) => return Ok(redirect),
910 };867 };
868+ if !settings::smtp(&app(cx).store).await?.configured() {
869+ return back(cx, "mail", "&error=sender_unset");
870+ }
911 match mailer::send_test(&app(cx).store, &me.email, lang_of(Some(&me))).await {871 match mailer::send_test(&app(cx).store, &me.email, lang_of(Some(&me))).await {
912 Ok(()) => {872 Ok(()) => {
913 server::log_event(cx, "smtp_test_sent", Some(&me.email), None).await;873 server::log_event(cx, "smtp_test_sent", Some(&me.email), None).await;
@@ -932,6 +892,71 @@ async fn smtp_test(cx: &Cx) -> Result<Response> {
932 }892 }
933 }893 }
934 }894 }
895+
896+#[derive(Deserialize)]
897+struct MessageForm {
898+ to: String,
899+ subject: String,
900+ body: String,
901+}
902+
903+/// The composed notice, izlek's `send_message`: one person or everyone (the
904+/// admin excluded — they wrote it), the words verbatim through the
905+/// configured sender. A failure answers with the server's own words, like
906+/// the test mail does.
907+#[route(POST "/admin/message")]
908+async fn message(cx: &Cx, Form(input): Form<MessageForm>) -> Result<Response> {
909+ let me = match require_admin(cx).await {
910+ Ok(me) => me,
911+ Err(redirect) => return Ok(redirect),
912+ };
913+ let store = &app(cx).store;
914+ if !settings::smtp(store).await?.configured() {
915+ return back(cx, "mail", "&error=sender_unset");
916+ }
917+ let subject = input.subject.trim();
918+ if subject.is_empty() {
919+ return back(cx, "mail", "&error=empty_subject");
920+ }
921+ let body = input.body.trim();
922+ if body.is_empty() {
923+ return back(cx, "mail", "&error=empty_body");
924+ }
925+ let users = accounts::list_users(store).await?;
926+ let recipients: Vec<String> = if input.to == "everyone" {
927+ users
928+ .into_iter()
929+ .filter(|person| person.id != me.id)
930+ .map(|person| person.email)
931+ .collect()
932+ } else {
933+ match users
934+ .into_iter()
935+ .find(|person| person.id.as_str() == input.to)
936+ {
937+ Some(person) => vec![person.email],
938+ None => return back(cx, "mail", "&error=no_such_user"),
939+ }
940+ };
941+ if recipients.is_empty() {
942+ return back(cx, "mail", "&error=no_such_user");
943+ }
944+ for recipient in &recipients {
945+ if let Err(e) = mailer::send_message(store, recipient, subject, body.to_string()).await {
946+ server::log_event(cx, "message_failed", Some(&me.email), Some(&e.to_string())).await;
947+ return back(
948+ cx,
949+ "mail",
950+ &format!(
951+ "&error=message&why={}",
952+ crate::oidc::urlencode(&e.to_string())
953+ ),
954+ );
955+ }
956+ }
957+ server::log_event(cx, "message_sent", Some(&me.email), Some(subject)).await;
958+ back(cx, "mail", "&ok=message")
959+}
935 /// Dials the mail server without sending, on an admin's say-so, and writes960 /// Dials the mail server without sending, on an admin's say-so, and writes
936 /// down what it said. The result shows on the Mail section as the standing961 /// down what it said. The result shows on the Mail section as the standing
937 /// line; the panel redirects straight back.962 /// line; the panel redirects straight back.
@@ -941,6 +966,9 @@ async fn smtp_check(cx: &Cx) -> Result<Response> {
941 Ok(me) => me,966 Ok(me) => me,
942 Err(redirect) => return Ok(redirect),967 Err(redirect) => return Ok(redirect),
943 };968 };
969+ if !settings::smtp(&app(cx).store).await?.configured() {
970+ return back(cx, "mail", "&error=sender_unset");
971+ }
944 probe(store_of(cx), app(cx).live.clone()).await;972 probe(store_of(cx), app(cx).live.clone()).await;
945 server::log_event(cx, "smtp_checked", Some(&me.email), None).await;973 server::log_event(cx, "smtp_checked", Some(&me.email), None).await;
946 back(cx, "mail", "")974 back(cx, "mail", "")
crates/im-web/src/auth.rsmodified+12 -12
@@ -371,10 +371,10 @@ async fn revoke_session(cx: &Cx, Form(input): Form<SessionRevokeForm>) -> Redire
371 .find(|s| s.token_hash == input.session)371 .find(|s| s.token_hash == input.session)
372 .and_then(|s| s.ip);372 .and_then(|s| s.ip);
373 if !im_core::sessions::revoke_owned_session(store, &user.id, &input.session).await? {373 if !im_core::sessions::revoke_owned_session(store, &user.id, &input.session).await? {
374- return see("/?error=session_unknown".to_string());374+ return see("/?section=sessions&error=session_unknown".to_string());
375 }375 }
376 server::log_event(cx, "session_revoked", Some(&user.email), ip.as_deref()).await;376 server::log_event(cx, "session_revoked", Some(&user.email), ip.as_deref()).await;
377- see("/?ok=session_revoked".to_string())377+ see("/?section=sessions&ok=session_revoked".to_string())
378 }378 }
379 379
380 #[derive(Deserialize)]380 #[derive(Deserialize)]
@@ -393,27 +393,27 @@ async fn preferences(cx: &Cx, Form(input): Form<PreferencesForm>) -> Redirect {
393 return see("/".to_string());393 return see("/".to_string());
394 };394 };
395 let Some(theme) = input.theme.as_deref() else {395 let Some(theme) = input.theme.as_deref() else {
396- return see("/?error=bad_theme".to_string());396+ return see("/?section=preferences&error=bad_theme".to_string());
397 };397 };
398 if theme != "light" && theme != "dark" {398 if theme != "light" && theme != "dark" {
399- return see("/?error=bad_theme".to_string());399+ return see("/?section=preferences&error=bad_theme".to_string());
400 }400 }
401 let Some(ui) = input.ui.as_deref() else {401 let Some(ui) = input.ui.as_deref() else {
402- return see("/?error=bad_ui".to_string());402+ return see("/?section=preferences&error=bad_ui".to_string());
403 };403 };
404 if ui != "instrument" && ui != "ledger" {404 if ui != "instrument" && ui != "ledger" {
405- return see("/?error=bad_ui".to_string());405+ return see("/?section=preferences&error=bad_ui".to_string());
406 }406 }
407 let Some(language) = input.language.as_deref() else {407 let Some(language) = input.language.as_deref() else {
408- return see("/?error=bad_language".to_string());408+ return see("/?section=preferences&error=bad_language".to_string());
409 };409 };
410 if language != "en" && language != "tr" {410 if language != "en" && language != "tr" {
411- return see("/?error=bad_language".to_string());411+ return see("/?section=preferences&error=bad_language".to_string());
412 }412 }
413 let store = &server::app(cx).store;413 let store = &server::app(cx).store;
414 im_core::accounts::set_preferences(store, &user.id, theme, language, ui).await?;414 im_core::accounts::set_preferences(store, &user.id, theme, language, ui).await?;
415 server::log_event(cx, "preferences_saved", Some(&user.email), None).await;415 server::log_event(cx, "preferences_saved", Some(&user.email), None).await;
416- see("/?ok=preferences".to_string())416+ see("/?section=preferences&ok=preferences".to_string())
417 }417 }
418 418
419 #[derive(Deserialize)]419 #[derive(Deserialize)]
@@ -433,7 +433,7 @@ async fn password(cx: &Cx, Form(input): Form<PasswordForm>) -> Redirect {
433 return see("/".to_string());433 return see("/".to_string());
434 };434 };
435 if input.password != input.password_confirm {435 if input.password != input.password_confirm {
436- return see("/?error=passwords_differ".to_string());436+ return see("/?section=password&error=passwords_differ".to_string());
437 }437 }
438 let store = &server::app(cx).store;438 let store = &server::app(cx).store;
439 match im_core::accounts::change_password(store, &me, &input.current, &input.password).await {439 match im_core::accounts::change_password(store, &me, &input.current, &input.password).await {
@@ -446,7 +446,7 @@ async fn password(cx: &Cx, Form(input): Form<PasswordForm>) -> Redirect {
446 WrongCurrent => "password_wrong",446 WrongCurrent => "password_wrong",
447 IsCurrent => "password_same",447 IsCurrent => "password_same",
448 };448 };
449- return see(format!("/?error={code}"));449+ return see(format!("/?section=password&error={code}"));
450 }450 }
451 Err(e) => return Err(topcoat::Error::from(std::io::Error::other(e.to_string()))),451 Err(e) => return Err(topcoat::Error::from(std::io::Error::other(e.to_string()))),
452 }452 }
@@ -454,5 +454,5 @@ async fn password(cx: &Cx, Form(input): Form<PasswordForm>) -> Redirect {
454 im_core::sessions::revoke_user_sessions_except(store, &me.id, &token).await?;454 im_core::sessions::revoke_user_sessions_except(store, &me.id, &token).await?;
455 }455 }
456 server::log_event(cx, "password_changed", Some(&me.email), None).await;456 server::log_event(cx, "password_changed", Some(&me.email), None).await;
457- see("/?ok=password".to_string())457+ see("/?section=password&ok=password".to_string())
458 }458 }
crates/im-web/src/i18n.rsmodified+50 -36
@@ -81,6 +81,7 @@ pub enum Key {
81 SignInSub,81 SignInSub,
82 EmailLabel,82 EmailLabel,
83 PasswordLabel,83 PasswordLabel,
84+ ProfileLabel,
84 SignInButton,85 SignInButton,
85 ForgotIt,86 ForgotIt,
86 BrandFooter,87 BrandFooter,
@@ -139,7 +140,6 @@ pub enum Key {
139 RevokeButton,140 RevokeButton,
140 141
141 // Admin panel nav and banners.142 // Admin panel nav and banners.
142- NavAccount,
143 NavUsers,143 NavUsers,
144 NavMail,144 NavMail,
145 NavSettings,145 NavSettings,
@@ -150,16 +150,25 @@ pub enum Key {
150 OkEnabled,150 OkEnabled,
151 OkSmtpSaved,151 OkSmtpSaved,
152 OkSmtpTest,152 OkSmtpTest,
153- OkPasswordChanged,
154 OkUninvited,153 OkUninvited,
155 OkDeleted,154 OkDeleted,
156 OkSettingsSaved,155 OkSettingsSaved,
157-156+ OkMessageSent,
158- // Admin account section.157+
159- AccountTitle,158+ // Admin mail section: the composed notice.
160- SignedInAs,159+ MessageTitle,
161- TwoFactorOnNote,160+ MessageToLabel,
162- TwoFactorOffNote,161+ EveryoneOption,
162+ MessageSubjectLabel,
163+ MessageBodyLabel,
164+ SendMessageButton,
165+ ErrEmptySubject,
166+ ErrEmptyBody,
167+ ErrNoSuchUser,
168+ ErrMessageFailed,
169+ ErrSenderUnset,
170+
171+ // Landing password pane.
163 AccountPasswordNote,172 AccountPasswordNote,
164 173
165 // Admin users section.174 // Admin users section.
@@ -330,6 +339,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
330 (EmailLabel, Tr) => "E-posta",339 (EmailLabel, Tr) => "E-posta",
331 (PasswordLabel, En) => "Password",340 (PasswordLabel, En) => "Password",
332 (PasswordLabel, Tr) => "Parola",341 (PasswordLabel, Tr) => "Parola",
342+ (ProfileLabel, En) => "Profile",
343+ (ProfileLabel, Tr) => "Profil",
333 (SignInButton, En) => "Sign in",344 (SignInButton, En) => "Sign in",
334 (SignInButton, Tr) => "Giriş yap",345 (SignInButton, Tr) => "Giriş yap",
335 (ForgotIt, En) => "Forgot it?",346 (ForgotIt, En) => "Forgot it?",
@@ -347,7 +358,9 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
347 (InviteTitle, En) => "You're invited",358 (InviteTitle, En) => "You're invited",
348 (InviteTitle, Tr) => "Davetlisin",359 (InviteTitle, Tr) => "Davetlisin",
349 (InviteSub, En) => "Pick a name and a password. Next step sets up two-factor sign-in.",360 (InviteSub, En) => "Pick a name and a password. Next step sets up two-factor sign-in.",
350- (InviteSub, Tr) => "Bir ad ve bir parola seç. Sonraki adımda iki faktörlü girişi kuracaksın.",361+ (InviteSub, Tr) => {
362+ "Bir ad ve bir parola seç. Sonraki adımda iki faktörlü girişi kuracaksın."
363+ }
351 (YourNameLabel, En) => "Your name",364 (YourNameLabel, En) => "Your name",
352 (YourNameLabel, Tr) => "Adın",365 (YourNameLabel, Tr) => "Adın",
353 (PasswordAgainLabel, En) => "Password again",366 (PasswordAgainLabel, En) => "Password again",
@@ -444,8 +457,6 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
444 (RevokeButton, En) => "Revoke",457 (RevokeButton, En) => "Revoke",
445 (RevokeButton, Tr) => "İptal et",458 (RevokeButton, Tr) => "İptal et",
446 459
447- (NavAccount, En) => "Account",
448- (NavAccount, Tr) => "Hesap",
449 (NavUsers, En) => "Users",460 (NavUsers, En) => "Users",
450 (NavUsers, Tr) => "Kullanıcılar",461 (NavUsers, Tr) => "Kullanıcılar",
451 (NavMail, En) => "Mail",462 (NavMail, En) => "Mail",
@@ -466,25 +477,42 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
466 (OkSmtpSaved, Tr) => "Posta ayarları kaydedildi.",477 (OkSmtpSaved, Tr) => "Posta ayarları kaydedildi.",
467 (OkSmtpTest, En) => "Test mail sent.",478 (OkSmtpTest, En) => "Test mail sent.",
468 (OkSmtpTest, Tr) => "Test postası gönderildi.",479 (OkSmtpTest, Tr) => "Test postası gönderildi.",
469- (OkPasswordChanged, En) => "Password changed — every other device is signed out.",
470- (OkPasswordChanged, Tr) => "Parola değişti — diğer tüm cihazların oturumu kapatıldı.",
471 (OkUninvited, En) => "Invite invalidated — the link is dead.",480 (OkUninvited, En) => "Invite invalidated — the link is dead.",
472 (OkUninvited, Tr) => "Davet geçersiz kılındı — bağlantı artık ölü.",481 (OkUninvited, Tr) => "Davet geçersiz kılındı — bağlantı artık ölü.",
473 (OkDeleted, En) => "Account deleted.",482 (OkDeleted, En) => "Account deleted.",
474 (OkDeleted, Tr) => "Hesap silindi.",483 (OkDeleted, Tr) => "Hesap silindi.",
475 (OkSettingsSaved, En) => "Settings saved.",484 (OkSettingsSaved, En) => "Settings saved.",
476 (OkSettingsSaved, Tr) => "Ayarlar kaydedildi.",485 (OkSettingsSaved, Tr) => "Ayarlar kaydedildi.",
486+ (OkMessageSent, En) => "Message sent.",
487+ (OkMessageSent, Tr) => "Mesaj gönderildi.",
488+
489+ (MessageTitle, En) => "Send a message",
490+ (MessageTitle, Tr) => "Mesaj gönder",
491+ (MessageToLabel, En) => "To",
492+ (MessageToLabel, Tr) => "Kime",
493+ (EveryoneOption, En) => "Everyone",
494+ (EveryoneOption, Tr) => "Herkes",
495+ (MessageSubjectLabel, En) => "Subject",
496+ (MessageSubjectLabel, Tr) => "Konu",
497+ (MessageBodyLabel, En) => "Message",
498+ (MessageBodyLabel, Tr) => "Mesaj",
499+ (SendMessageButton, En) => "Send",
500+ (SendMessageButton, Tr) => "Gönder",
501+ (ErrEmptySubject, En) => "A subject is needed.",
502+ (ErrEmptySubject, Tr) => "Bir konu gerekli.",
503+ (ErrEmptyBody, En) => "The message is empty.",
504+ (ErrEmptyBody, Tr) => "Mesaj boş.",
505+ (ErrNoSuchUser, En) => "No such person.",
506+ (ErrNoSuchUser, Tr) => "Böyle biri yok.",
507+ (ErrMessageFailed, En) => "That mail did not send — the server's words are below.",
508+ (ErrMessageFailed, Tr) => "Posta gönderilemedi — sunucunun söyledikleri aşağıda.",
509+ (ErrSenderUnset, En) => "Set up the sender above first.",
510+ (ErrSenderUnset, Tr) => "Önce yukarıdan göndereni kur.",
477 511
478- (AccountTitle, En) => "Account",
479- (AccountTitle, Tr) => "Hesap",
480- (SignedInAs, En) => "Signed in as",
481- (SignedInAs, Tr) => "Giriş yapılan hesap",
482- (TwoFactorOnNote, En) => "two-factor is on",
483- (TwoFactorOnNote, Tr) => "iki faktörlü doğrulama açık",
484- (TwoFactorOffNote, En) => "two-factor is NOT on — sign out and back in to set it up",
485- (TwoFactorOffNote, Tr) => "iki faktörlü doğrulama KAPALI — kurmak için oturumu kapatıp tekrar aç",
486 (AccountPasswordNote, En) => "Changing it signs every other device out — this one stays.",512 (AccountPasswordNote, En) => "Changing it signs every other device out — this one stays.",
487- (AccountPasswordNote, Tr) => "Değiştirince diğer tüm cihazların oturumu kapanır — bu cihaz açık kalır.",513+ (AccountPasswordNote, Tr) => {
514+ "Değiştirince diğer tüm cihazların oturumu kapanır — bu cihaz açık kalır."
515+ }
488 (AdminSessionsEmpty, En) => "No active sessions",516 (AdminSessionsEmpty, En) => "No active sessions",
489 (AdminSessionsEmpty, Tr) => "Aktif oturum yok",517 (AdminSessionsEmpty, Tr) => "Aktif oturum yok",
490 518
@@ -666,20 +694,6 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
666 }694 }
667 }695 }
668 696
669-/// The account section's "Signed in as … · …" line, in the admin's language.
670-/// `email_html` is already escaped; the mono span is markup, not prose.
671-pub fn account_sub(lang: Lang, email_html: &str, two_factor: &str) -> String {
672- match lang {
673- Lang::En => format!(
674- "{} <span class=\"mono\">{email_html}</span> · {two_factor}.",
675- t(lang, Key::SignedInAs)
676- ),
677- Lang::Tr => format!(
678- "<span class=\"mono\">{email_html}</span> olarak giriş yapıldı · {two_factor}."
679- ),
680- }
681-}
682-
683 /// A user row's "Sessions (N)" disclosure summary, in the viewer's language.697 /// A user row's "Sessions (N)" disclosure summary, in the viewer's language.
684 pub fn sessions_summary(lang: Lang, n: usize) -> String {698 pub fn sessions_summary(lang: Lang, n: usize) -> String {
685 match lang {699 match lang {
crates/im-web/src/mailer.rsmodified+7 -1
@@ -2,9 +2,9 @@
2 //! built per send: settings can change at any moment, and invites are rare —2 //! built per send: settings can change at any moment, and invites are rare —
3 //! the pool a long-lived transport would buy serves nothing here.3 //! the pool a long-lived transport would buy serves nothing here.
4 4
5+use crate::i18n::{self, Lang};
5 use im_core::settings::{self, Smtp};6 use im_core::settings::{self, Smtp};
6 use im_core::store::Store;7 use im_core::store::Store;
7-use crate::i18n::{self, Lang};
8 8
9 #[derive(Debug, thiserror::Error)]9 #[derive(Debug, thiserror::Error)]
10 pub enum MailError {10 pub enum MailError {
@@ -137,3 +137,9 @@ pub async fn send_test(store: &Store, to: &str, lang: Lang) -> Result<()> {
137 )137 )
138 .await138 .await
139 }139 }
140+
141+/// The panel's composed notice, izlek's `send_message`: the admin's words
142+/// verbatim, to one address at a time, through the configured sender.
143+pub async fn send_message(store: &Store, to: &str, subject: &str, body: String) -> Result<()> {
144+ send(store, to, subject, body).await
145+}
crates/im-web/src/pages.rsmodified+210 -176
@@ -42,6 +42,11 @@ pub fn error_text(code: &str, lang: Lang) -> &'static str {
42 "bad_theme" => t(lang, Key::ErrBadTheme),42 "bad_theme" => t(lang, Key::ErrBadTheme),
43 "bad_ui" => t(lang, Key::ErrBadUi),43 "bad_ui" => t(lang, Key::ErrBadUi),
44 "bad_language" => t(lang, Key::ErrBadLanguage),44 "bad_language" => t(lang, Key::ErrBadLanguage),
45+ "empty_subject" => t(lang, Key::ErrEmptySubject),
46+ "empty_body" => t(lang, Key::ErrEmptyBody),
47+ "no_such_user" => t(lang, Key::ErrNoSuchUser),
48+ "message" => t(lang, Key::ErrMessageFailed),
49+ "sender_unset" => t(lang, Key::ErrSenderUnset),
45 _ => t(lang, Key::ErrFallback),50 _ => t(lang, Key::ErrFallback),
46 }51 }
47 }52 }
@@ -569,10 +574,13 @@ fn sessions_html(
569 /// the proof of session, the person's profile — photo and the counts their574 /// the proof of session, the person's profile — photo and the counts their
570 /// identity has earned — and the way out. izlek gives a profile its own575 /// identity has earned — and the way out. izlek gives a profile its own
571 /// page under `/people`; im has exactly one signed-in screen, so the576 /// page under `/people`; im has exactly one signed-in screen, so the
572-/// profile is a section of it.577+/// profile is a section of it. Six cards in one column ran twice the height
578+/// of a window, so the landing is sectioned like the admin panel: a tab row
579+/// under the wordmark, one section's cards at a time.
573 async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {580 async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
574 let lang = lang_of(Some(user));581 let lang = lang_of(Some(user));
575 let query = current_query(cx);582 let query = current_query(cx);
583+ let section = query_value(&query, "section").unwrap_or_else(|| "profile".to_string());
576 let ok = query_value(&query, "ok");584 let ok = query_value(&query, "ok");
577 let error = query_value(&query, "error");585 let error = query_value(&query, "error");
578 let stats = im_core::stats::profile_stats(&server::app(cx).store, &user.id).await?;586 let stats = im_core::stats::profile_stats(&server::app(cx).store, &user.id).await?;
@@ -580,43 +588,141 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
580 let sessions = im_core::sessions::list_sessions(&server::app(cx).store, &user.id).await?;588 let sessions = im_core::sessions::list_sessions(&server::app(cx).store, &user.id).await?;
581 let current = server::presented_session(cx).map(|token| im_core::accounts::hash_token(&token));589 let current = server::presented_session(cx).map(|token| im_core::accounts::hash_token(&token));
582 let sessions_html = sessions_html(&sessions, current.as_deref(), lang);590 let sessions_html = sessions_html(&sessions, current.as_deref(), lang);
591+ // Same idiom as the admin panel's nav: one tab per section, the live one
592+ // underlined.
593+ let nav = [
594+ ("profile", t(lang, Key::ProfileLabel)),
595+ ("sessions", t(lang, Key::SessionsTitle)),
596+ ("preferences", t(lang, Key::PreferencesLabel)),
597+ ("password", t(lang, Key::PasswordLabel)),
598+ ]
599+ .into_iter()
600+ .map(|(id, label)| {
601+ format!(
602+ r#"<a class="admin-nav{}" href="/?section={id}">{label}</a>"#,
603+ if id == section { " admin-nav-on" } else { "" }
604+ )
605+ })
606+ .collect::<String>();
583 let stage = view! {607 let stage = view! {
584 cx =>608 cx =>
585 <main class="auth-stage">609 <main class="auth-stage">
586 <div class="auth-column">610 <div class="auth-column">
587 (wordmark(cx).await?)611 (wordmark(cx).await?)
588- <div class="auth-card">612+ <nav class="admin-tabs landing-nav">(topcoat::view::Unescaped::new_unchecked(nav))</nav>
589- <div class="profile-head">613+ if let Some(code) = ok {
590- if user.has_photo {614+ <div class="auth-ok">(ok_text(&code, lang))</div>
591- // The face is the whole control surface: it opens615+ }
592- // the viewer, and the viewer carries Change/Remove616+ if let Some(code) = error {
593- // (avatar_script builds them for `data-own`). The617+ <div class="auth-problem">(error_text(&code, lang))</div>
594- // picker input hides here, unreached until the618+ }
595- // viewer's Change label points at it by id.619+ if section == "sessions" {
596- <button620+ <div class="auth-card">
597- class="avatar-view"621+ <div class="auth-title">(t(lang, Key::SessionsTitle))</div>
598- type="button"622+ <div class="session-list">(topcoat::view::Unescaped::new_unchecked(sessions_html))</div>
599- aria-label=(t(lang, Key::ViewPhotoAria))623+ </div>
600- data-own=""624+ <div class="auth-card">
601- >625+ <form method="post" action="/logout">
602- (avatar(cx, user).await?)626+ <button class="auth-submit" type="submit">
627+ <span class="auth-submit-text">(t(lang, Key::SignOutEverywhere))</span>
603 </button>628 </button>
604- <input629+ </form>
605- id="profile-photo-input"630+ </div>
606- class="profile-file-hidden"631+ }
607- type="file"632+ if section == "preferences" {
608- name="photo"633+ <div class="auth-card">
609- accept="image/png,image/jpeg,image/gif,image/webp,image/avif"634+ <div class="auth-title">(t(lang, Key::PreferencesLabel))</div>
610- form="profile-photo-form"635+ <form method="post" action="/preferences">
611- data-autosubmit=""636+ <label class="auth-field">
612- >637+ <span class="auth-label">(t(lang, Key::ThemeLabel))</span>
613- } else {638+ <select class="auth-input" name="theme">
614- // Without one, the face itself is the picker: the639+ <option value="light" selected=(user.theme == "light")>(t(lang, Key::LightOption))</option>
615- // label wraps the hidden input, which autosubmits640+ <option value="dark" selected=(user.theme == "dark")>(t(lang, Key::DarkOption))</option>
616- // on change (avatar_script) — no buttons at all.641+ </select>
617- <label class="profile-avatar-upload">642+ </label>
618- (avatar(cx, user).await?)643+ <label class="auth-field">
644+ <span class="auth-label">(t(lang, Key::UiLabel))</span>
645+ <select class="auth-input" name="ui">
646+ <option value="instrument" selected=(user.ui == "instrument")>(t(lang, Key::InstrumentOption))</option>
647+ <option value="ledger" selected=(user.ui == "ledger")>(t(lang, Key::LedgerOption))</option>
648+ </select>
649+ </label>
650+ <label class="auth-field">
651+ <span class="auth-label">(t(lang, Key::LanguageLabel))</span>
652+ <select class="auth-input" name="language">
653+ <option value="en" selected=(user.language == "en")>"English"</option>
654+ <option value="tr" selected=(user.language == "tr")>"Türkçe"</option>
655+ </select>
656+ </label>
657+ <button class="auth-submit" type="submit">
658+ <span class="auth-submit-text">(t(lang, Key::SaveButton))</span>
659+ </button>
660+ </form>
661+ </div>
662+ }
663+ if section == "password" {
664+ <div class="auth-card">
665+ <div class="auth-title">(t(lang, Key::ChangePassword))</div>
666+ <form method="post" action="/password">
667+ <label class="auth-field">
668+ <span class="auth-label">(t(lang, Key::CurrentPasswordLabel))</span>
669+ <input
670+ class="auth-input auth-input-mono"
671+ type="password"
672+ name="current"
673+ autocomplete="current-password"
674+ required=""
675+ >
676+ </label>
677+ <label class="auth-field">
678+ <span class="auth-label">(t(lang, Key::NewPasswordLabel))</span>
679+ <input
680+ class="auth-input auth-input-mono"
681+ type="password"
682+ name="password"
683+ autocomplete="new-password"
684+ minlength=(MIN_PASSWORD_CHARS.to_string())
685+ required=""
686+ >
687+ </label>
688+ <label class="auth-field">
689+ <span class="auth-label">(t(lang, Key::NewPasswordAgainLabel))</span>
690+ <input
691+ class="auth-input auth-input-mono"
692+ type="password"
693+ name="password_confirm"
694+ autocomplete="new-password"
695+ minlength=(MIN_PASSWORD_CHARS.to_string())
696+ required=""
697+ >
698+ </label>
699+ <button class="auth-submit" type="submit">
700+ <span class="auth-submit-text">(t(lang, Key::ChangePassword))</span>
701+ </button>
702+ </form>
703+ <div class="auth-sub">(t(lang, Key::AccountPasswordNote))</div>
704+ </div>
705+ }
706+ if section != "sessions" && section != "preferences" && section != "password" {
707+ <div class="auth-card">
708+ <div class="profile-head">
709+ if user.has_photo {
710+ // The face is the whole control surface: it opens
711+ // the viewer, and the viewer carries Change/Remove
712+ // (avatar_script builds them for a `data-own`
713+ // face). The picker input hides here, unreached
714+ // until the viewer's Change label points at it by
715+ // id.
716+ <button
717+ class="avatar-view"
718+ type="button"
719+ aria-label=(t(lang, Key::ViewPhotoAria))
720+ data-own=""
721+ >
722+ (avatar(cx, user).await?)
723+ </button>
619 <input724 <input
725+ id="profile-photo-input"
620 class="profile-file-hidden"726 class="profile-file-hidden"
621 type="file"727 type="file"
622 name="photo"728 name="photo"
@@ -624,156 +730,84 @@ async fn signed_in(cx: &Cx, user: &im_core::model::User) -> Result {
624 form="profile-photo-form"730 form="profile-photo-form"
625 data-autosubmit=""731 data-autosubmit=""
626 >732 >
627- </label>733+ } else {
628- }734+ // Without one, the face itself is the picker: the
629- <div class="profile-heading">735+ // label wraps the hidden input, which autosubmits
630- <div class="auth-title">(user.name.clone())</div>736+ // on change (avatar_script) — no buttons at all.
631- <div class="profile-marks">737+ <label class="profile-avatar-upload">
632- if user.totp_confirmed {738+ (avatar(cx, user).await?)
633- <span class="chip chip-connected">(t(lang, Key::TwoFaOn))</span>739+ <input
634- } else {740+ class="profile-file-hidden"
635- <span class="chip chip-muted">(t(lang, Key::TwoFaOff))</span>741+ type="file"
636- }742+ name="photo"
637- if user.admin {743+ accept="image/png,image/jpeg,image/gif,image/webp,image/avif"
638- <span class="chip chip-accent">(t(lang, Key::AdminChip))</span>744+ form="profile-photo-form"
639- }745+ data-autosubmit=""
746+ >
747+ </label>
748+ }
749+ <div class="profile-heading">
750+ <div class="auth-title">(user.name.clone())</div>
751+ <div class="profile-marks">
752+ if user.totp_confirmed {
753+ <span class="chip chip-connected">(t(lang, Key::TwoFaOn))</span>
754+ } else {
755+ <span class="chip chip-muted">(t(lang, Key::TwoFaOff))</span>
756+ }
757+ if user.admin {
758+ <span class="chip chip-accent">(t(lang, Key::AdminChip))</span>
759+ }
760+ </div>
640 </div>761 </div>
641 </div>762 </div>
642- </div>763+ <dl class="profile-fields">
643- if let Some(code) = ok {764+ <div class="profile-field">
644- <div class="auth-ok">(ok_text(&code, lang))</div>765+ <dt class="auth-label">(t(lang, Key::EmailLabel))</dt>
645- }766+ <dd class="profile-value mono">(user.email.clone())</dd>
646- if let Some(code) = error {767+ </div>
647- <div class="auth-problem">(error_text(&code, lang))</div>768+ <div class="profile-field">
648- }769+ <dt class="auth-label">(t(lang, Key::MemberSinceLabel))</dt>
649- <dl class="profile-fields">770+ <dd class="profile-value">(joined)</dd>
650- <div class="profile-field">771+ </div>
651- <dt class="auth-label">(t(lang, Key::EmailLabel))</dt>772+ </dl>
652- <dd class="profile-value mono">(user.email.clone())</dd>773+ <a class="auth-alt" href=(format!("/people/{}", user.id))>(t(lang, Key::PublicProfileLink))</a>
653- </div>774+ if user.admin {
654- <div class="profile-field">775+ <a class="auth-alt" href="/admin">(t(lang, Key::AdminPanelLink))</a>
655- <dt class="auth-label">(t(lang, Key::MemberSinceLabel))</dt>776+ }
656- <dd class="profile-value">(joined)</dd>777+ // Both forms carry no visible chrome of their own: the
657- </div>778+ // picker input hides beside the face, the remove button
658- </dl>779+ // lives in the viewer — all reaching here by `form=`.
659- <a class="auth-alt" href=(format!("/people/{}", user.id))>(t(lang, Key::PublicProfileLink))</a>
660- // Both forms carry no visible chrome of their own: the
661- // picker input hides beside the face, the remove button
662- // lives in the viewer — all reaching here by `form=`.
663- <form
664- id="profile-photo-form"
665- method="post"
666- action="/api/profile_photo"
667- enctype="multipart/form-data"
668- ></form>
669- if user.has_photo {
670 <form780 <form
671- id="profile-photo-remove"781+ id="profile-photo-form"
672 method="post"782 method="post"
673- action="/api/delete_profile_photo"783+ action="/api/profile_photo"
784+ enctype="multipart/form-data"
674 ></form>785 ></form>
675- }786+ if user.has_photo {
676- </div>787+ <form
677- <div class="auth-card">788+ id="profile-photo-remove"
678- <dl class="profile-stats">789+ method="post"
679- <div class="profile-stat">790+ action="/api/delete_profile_photo"
680- <dd class="profile-stat-value">(stats.sign_ins)</dd>791+ ></form>
681- <dt class="auth-label">(t(lang, Key::StatSignIns))</dt>792+ }
682- </div>793+ </div>
683- <div class="profile-stat">794+ <div class="auth-card">
684- <dd class="profile-stat-value">(stats.active_sessions)</dd>795+ <dl class="profile-stats">
685- <dt class="auth-label">(t(lang, Key::StatActiveSessions))</dt>796+ <div class="profile-stat">
686- </div>797+ <dd class="profile-stat-value">(stats.sign_ins)</dd>
687- <div class="profile-stat">798+ <dt class="auth-label">(t(lang, Key::StatSignIns))</dt>
688- <dd class="profile-stat-value">(stats.connected_apps)</dd>799+ </div>
689- <dt class="auth-label">(t(lang, Key::StatConnectedApps))</dt>800+ <div class="profile-stat">
690- </div>801+ <dd class="profile-stat-value">(stats.active_sessions)</dd>
691- </dl>802+ <dt class="auth-label">(t(lang, Key::StatActiveSessions))</dt>
692- </div>803+ </div>
693- <div class="auth-card">804+ <div class="profile-stat">
694- <div class="auth-title">(t(lang, Key::SessionsTitle))</div>805+ <dd class="profile-stat-value">(stats.connected_apps)</dd>
695- <div class="session-list">(topcoat::view::Unescaped::new_unchecked(sessions_html))</div>806+ <dt class="auth-label">(t(lang, Key::StatConnectedApps))</dt>
696- </div>807+ </div>
697- <div class="auth-card" id="preferences">808+ </dl>
698- <div class="auth-title">(t(lang, Key::PreferencesLabel))</div>809+ </div>
699- <form method="post" action="/preferences">810+ }
700- <label class="auth-field">
701- <span class="auth-label">(t(lang, Key::ThemeLabel))</span>
702- <select class="auth-input" name="theme">
703- <option value="light" selected=(user.theme == "light")>(t(lang, Key::LightOption))</option>
704- <option value="dark" selected=(user.theme == "dark")>(t(lang, Key::DarkOption))</option>
705- </select>
706- </label>
707- <label class="auth-field">
708- <span class="auth-label">(t(lang, Key::UiLabel))</span>
709- <select class="auth-input" name="ui">
710- <option value="instrument" selected=(user.ui == "instrument")>(t(lang, Key::InstrumentOption))</option>
711- <option value="ledger" selected=(user.ui == "ledger")>(t(lang, Key::LedgerOption))</option>
712- </select>
713- </label>
714- <label class="auth-field">
715- <span class="auth-label">(t(lang, Key::LanguageLabel))</span>
716- <select class="auth-input" name="language">
717- <option value="en" selected=(user.language == "en")>"English"</option>
718- <option value="tr" selected=(user.language == "tr")>"Türkçe"</option>
719- </select>
720- </label>
721- <button class="auth-submit" type="submit">
722- <span class="auth-submit-text">(t(lang, Key::SaveButton))</span>
723- </button>
724- </form>
725- </div>
726- <div class="auth-card" id="password">
727- <div class="auth-title">(t(lang, Key::ChangePassword))</div>
728- <form method="post" action="/password">
729- <label class="auth-field">
730- <span class="auth-label">(t(lang, Key::CurrentPasswordLabel))</span>
731- <input
732- class="auth-input auth-input-mono"
733- type="password"
734- name="current"
735- autocomplete="current-password"
736- required=""
737- >
738- </label>
739- <label class="auth-field">
740- <span class="auth-label">(t(lang, Key::NewPasswordLabel))</span>
741- <input
742- class="auth-input auth-input-mono"
743- type="password"
744- name="password"
745- autocomplete="new-password"
746- minlength=(MIN_PASSWORD_CHARS.to_string())
747- required=""
748- >
749- </label>
750- <label class="auth-field">
751- <span class="auth-label">(t(lang, Key::NewPasswordAgainLabel))</span>
752- <input
753- class="auth-input auth-input-mono"
754- type="password"
755- name="password_confirm"
756- autocomplete="new-password"
757- minlength=(MIN_PASSWORD_CHARS.to_string())
758- required=""
759- >
760- </label>
761- <button class="auth-submit" type="submit">
762- <span class="auth-submit-text">(t(lang, Key::ChangePassword))</span>
763- </button>
764- </form>
765- <div class="auth-sub">(t(lang, Key::AccountPasswordNote))</div>
766- </div>
767- <div class="auth-card">
768- <form method="post" action="/logout">
769- <button class="auth-submit" type="submit">
770- <span class="auth-submit-text">(t(lang, Key::SignOutEverywhere))</span>
771- </button>
772- </form>
773- if user.admin {
774- <a class="auth-alt" href="/admin">(t(lang, Key::AdminPanelLink))</a>
775- }
776- </div>
777 <div class="auth-footer">(t(lang, Key::BrandFooter))</div>811 <div class="auth-footer">(t(lang, Key::BrandFooter))</div>
778 </div>812 </div>
779 </main>813 </main>
style/main.scssmodified+16 -0
@@ -250,6 +250,7 @@ body:has(.auth-stage) {
250 gap: 10px;250 gap: 10px;
251 text-decoration: none;251 text-decoration: none;
252 color: inherit;252 color: inherit;
253+
253 padding: 6px 0;254 padding: 6px 0;
254 255
255 &:hover { color: inherit; }256 &:hover { color: inherit; }
@@ -271,6 +272,13 @@ body:has(.auth-stage) {
271 }272 }
272 }273 }
273 274
275+// The landing's section tabs wear the admin nav's skin, centred under the
276+// wordmark instead of left-aligned in the admin bar.
277+.landing-nav {
278+ justify-content: center;
279+ padding: 4px 0 10px;
280+}
281+
274 .auth-card {282 .auth-card {
275 background: var(--surface);283 background: var(--surface);
276 border: 1px solid var(--border);284 border: 1px solid var(--border);
@@ -365,6 +373,14 @@ body:has(.auth-stage) {
365 }373 }
366 }374 }
367 375
376+// The message body is the one multi-line field: same skin, height from
377+// `rows`, vertical resize only.
378+textarea.auth-input {
379+ height: auto;
380+ padding: 10px 12px;
381+ resize: vertical;
382+}
383+
368 .auth-input-mono {384 .auth-input-mono {
369 font-family: var(--font-mono);385 font-family: var(--font-mono);
370 }386 }