forge
Explore
Log in

Don't you dare go Hollow

Sent reminders never re-queue; cache directives; password pane names each failure; clock pick saves itself

Browse files at this commit

3faf6a3213006b08edbb7c62afbe0914811657f5Ahmet Kaan GümüşParent: e95add1
sync_task_reminders re-minted a pending copy for recipients whose reminder
already went out, and abandoned rows kept their next_attempt_at, so the
sweep — which selects on due time alone — could still deliver corpses.
The mint loop now skips anyone already served and abandoning disarms the
row; a sent reminder is never queued again.

Pages send Cache-Control: no-cache; fingerprinted assets keep their
immutable year. A stale page once served a pre-fix build after a deploy.

The password pane names what happened: wrong current, rule-breaking new,
same as current (now refused before any write, signing nobody out), rate
limited, and a success note that the other devices were signed out.

The deadline popover's hour and minute boxes autosubmit when they agree
and a day is held; lone picks wait. The moment harness passes again.

Every mutating route records an activity event; the Logs page renders and
filters the new kinds in both languages.
crates/izlek-core/src/accounts.rsmodified+7 -0
@@ -405,6 +405,13 @@ impl Accounts {
405 if !ok {405 if !ok {
406 return Err(AccountError::Rejected);406 return Err(AccountError::Rejected);
407 }407 }
408+ // Setting the password back to itself is the walk-away mistake, not
409+ // a change: refused by name, and nothing here signs anybody out.
410+ if let Some(stored) = user.password_hash.as_deref() {
411+ if verify_password(new, stored) {
412+ return Err(AccountError::Password(auth::PasswordProblem::IsCurrent));
413+ }
414+ }
408 auth::check_password(new, &user.email, &user.display_name)?;415 auth::check_password(new, &user.email, &user.display_name)?;
409 let hash = hash_password(new)?;416 let hash = hash_password(new)?;
410 self.store.set_password_hash(&user.id, &hash).await?;417 self.store.set_password_hash(&user.id, &hash).await?;
crates/izlek-core/src/auth.rsmodified+6 -1
@@ -13,6 +13,7 @@ use argon2::password_hash::phc::PasswordHash;
13 use argon2::password_hash::{PasswordHasher, PasswordVerifier};13 use argon2::password_hash::{PasswordHasher, PasswordVerifier};
14 use argon2::{Algorithm, Argon2, Params, Version};14 use argon2::{Algorithm, Argon2, Params, Version};
15 use rand::Rng;15 use rand::Rng;
16+use serde::{Deserialize, Serialize};
16 use sha2::{Digest, Sha256};17 use sha2::{Digest, Sha256};
17 use subtle::ConstantTimeEq;18 use subtle::ConstantTimeEq;
18 19
@@ -34,12 +35,16 @@ pub const MIN_PASSWORD_CHARS: usize = 10;
34 35
35 /// A password rule the person's choice broke. The wording is the wording on the36 /// A password rule the person's choice broke. The wording is the wording on the
36 /// first-sign-in screen.37 /// first-sign-in screen.
37-#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]38+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, thiserror::Error)]
38 pub enum PasswordProblem {39 pub enum PasswordProblem {
39 #[error("at least 10 characters")]40 #[error("at least 10 characters")]
40 TooShort,41 TooShort,
41 #[error("not your address or your name")]42 #[error("not your address or your name")]
42 LooksLikeYou,43 LooksLikeYou,
44+ /// The "new" password is the one already in force — the walk-away
45+ /// mistake, refused by name rather than silently succeeding.
46+ #[error("that's your current password")]
47+ IsCurrent,
43 }48 }
44 49
45 #[derive(Debug, thiserror::Error)]50 #[derive(Debug, thiserror::Error)]
crates/izlek-core/src/detail.rsmodified+7 -2
@@ -340,8 +340,13 @@ impl ActivityEntry {
340 | ActivityKind::RuleEdited340 | ActivityKind::RuleEdited
341 | ActivityKind::RuleToggled341 | ActivityKind::RuleToggled
342 | ActivityKind::RuleDeleted342 | ActivityKind::RuleDeleted
343- | ActivityKind::MessageSent343+ | ActivityKind::MessageSent => detail.to_string(),
344- | ActivityKind::Other(_) => detail.to_string(),344+ ActivityKind::Other(raw) => match raw.as_str() {
345+ // A kind this version knows gets its words; anything a newer
346+ // version wrote falls through as the raw detail it stored.
347+ "tagged" => format!("tagged it {detail}"),
348+ _ => detail.to_string(),
349+ },
345 }350 }
346 }351 }
347 352
crates/izlek-core/src/mail.rsmodified+2 -1
@@ -1106,7 +1106,8 @@ mod backoff_tests {
1106 #[cfg(test)]1106 #[cfg(test)]
1107 mod trigger_fold_tests {1107 mod trigger_fold_tests {
1108 use super::fires_on;1108 use super::fires_on;
1109- use crate::detail::{ActivityKind, Trigger};1109+ use crate::detail::ActivityKind;
1110+ use crate::store::Trigger;
1110 1111
1111 #[test]1112 #[test]
1112 fn a_time_change_fires_the_deadline_triggers() {1113 fn a_time_change_fires_the_deadline_triggers() {
crates/izlek-core/src/store/turso_store.rsmodified+38 -3
@@ -332,7 +332,10 @@ impl TursoStore {
332 /// wrong more often — a reminder row is a promise the queue is holding,332 /// wrong more often — a reminder row is a promise the queue is holding,
333 /// and a promise whose grounds moved is re-made, not patched. Rows that333 /// and a promise whose grounds moved is re-made, not patched. Rows that
334 /// already went out (or failed on their own retry clock) are history and334 /// already went out (or failed on their own retry clock) are history and
335- /// stay untouched.335+ /// stay untouched — and stay served: a recipient this task's reminders
336+ /// have already been written for is never minted a second row, or every
337+ /// later write about the card would quietly re-queue a mail they have
338+ /// already had, one copy per write.
336 ///339 ///
337 /// Answers whether anything was written or abandoned, so the caller can340 /// Answers whether anything was written or abandoned, so the caller can
338 /// announce the queue only when this did something — the task-write341 /// announce the queue only when this did something — the task-write
@@ -343,11 +346,36 @@ impl TursoStore {
343 task_id: &str,346 task_id: &str,
344 now: OffsetDateTime,347 now: OffsetDateTime,
345 ) -> Result<bool> {348 ) -> Result<bool> {
349+ // Who this task's reminders have already served: a row that went
350+ // out (`sent`), is riding its own retries (`failed`), or was given
351+ // up on by that same retry ladder (`abandoned` with attempts on the
352+ // clock) settles that recipient's reminder. A draft the re-derive
353+ // itself abandoned has attempts 0 and serves nobody — the promise it
354+ // stood for is unkept, and the mint below owes it fresh. Read before
355+ // the abandon below, in the same transaction: a row still pending
356+ // here is an unkept promise, and the moment it counts as served it
357+ // would be silenced forever.
358+ let mut rows = tx
359+ .query(
360+ "SELECT DISTINCT recipient FROM mail_send \
361+ WHERE task_id = ?1 AND kind = 'reminder' \
362+ AND (state IN ('sent', 'failed') \
363+ OR (state = 'abandoned' AND attempts > 0))",
364+ params![task_id],
365+ )
366+ .await
367+ .map_err(backend)?;
368+ let mut served = std::collections::HashSet::new();
369+ while let Some(row) = rows.next().await.map_err(backend)? {
370+ served.insert(text(&row, 0)?);
371+ }
372+ drop(rows);
373+
346 // Nothing the re-derivation below can say changes a row that is no374 // Nothing the re-derivation below can say changes a row that is no
347 // longer pending.375 // longer pending.
348 let abandoned = tx376 let abandoned = tx
349 .execute(377 .execute(
350- "UPDATE mail_send SET state = 'abandoned' \378+ "UPDATE mail_send SET state = 'abandoned', next_attempt_at = NULL \
351 WHERE task_id = ?1 AND kind = 'reminder' AND state = 'pending'",379 WHERE task_id = ?1 AND kind = 'reminder' AND state = 'pending'",
352 params![task_id],380 params![task_id],
353 )381 )
@@ -417,7 +445,13 @@ impl TursoStore {
417 }445 }
418 drop(rows);446 drop(rows);
419 447
448+ let mut minted = 0usize;
420 for (email, timezone) in people {449 for (email, timezone) in people {
450+ // Already reminded of this meeting, or their reminder is on the
451+ // queue's own retry clock: a second row here is a second mail.
452+ if served.contains(&email) {
453+ continue;
454+ }
421 // Each recipient reads the moment in their own stored timezone:455 // Each recipient reads the moment in their own stored timezone:
422 // the meeting is one fact, and what it says on the clock where456 // the meeting is one fact, and what it says on the clock where
423 // they sit is not.457 // they sit is not.
@@ -452,9 +486,10 @@ impl TursoStore {
452 )486 )
453 .await487 .await
454 .map_err(backend)?;488 .map_err(backend)?;
489+ minted += 1;
455 }490 }
456 491
457- Ok(true)492+ Ok(abandoned > 0 || minted > 0)
458 }493 }
459 }494 }
460 495
crates/izlek-core/tests/store.rsmodified+195 -0
@@ -2309,6 +2309,30 @@ async fn changing_a_password_needs_the_current_one_and_obeys_the_rules() {
2309 .unwrap();2309 .unwrap();
2310 }2310 }
2311 2311
2312+#[tokio::test]
2313+async fn the_old_password_stops_working_after_a_change() {
2314+ let (_scratch, accounts, admin) = claimed().await;
2315+ accounts
2316+ .change_password(
2317+ &admin.id,
2318+ "tide-tables-1892",
2319+ "chronometer-1761",
2320+ "198.51.100.7",
2321+ )
2322+ .await
2323+ .unwrap();
2324+ assert!(matches!(
2325+ accounts
2326+ .sign_in("ada@izlek.sh", "tide-tables-1892", "198.51.100.7")
2327+ .await,
2328+ Err(AccountError::Rejected)
2329+ ));
2330+ accounts
2331+ .sign_in("ada@izlek.sh", "chronometer-1761", "198.51.100.7")
2332+ .await
2333+ .unwrap();
2334+}
2335+
2312 #[tokio::test]2336 #[tokio::test]
2313 async fn signing_out_ends_that_browser_only() {2337 async fn signing_out_ends_that_browser_only() {
2314 let (_scratch, accounts, _admin) = claimed().await;2338 let (_scratch, accounts, _admin) = claimed().await;
@@ -8348,3 +8372,174 @@ async fn reminder_rows_survive_a_reopen() {
8348 assert_eq!(after[0].next_attempt_at, before[0].next_attempt_at);8372 assert_eq!(after[0].next_attempt_at, before[0].next_attempt_at);
8349 let _ = std::fs::remove_dir_all(&dir);8373 let _ = std::fs::remove_dir_all(&dir);
8350 }8374 }
8375+#[tokio::test]
8376+async fn a_reminder_already_sent_is_never_queued_again() {
8377+ let (dir, store, workspace, admin) = shared().await;
8378+ let grace = member(&store, &workspace, "grace@izlek.sh", "Grace").await;
8379+ let emre = member(&store, &workspace, "emre@izlek.sh", "Emre").await;
8380+ let clock = OffsetDateTime::now_utc() + Duration::hours(2);
8381+ let task = clocked_task(&store, &workspace, &admin, Some(clock)).await;
8382+ store.assign_task(&task, &grace).await.unwrap();
8383+ store.assign_task(&task, &emre).await.unwrap();
8384+
8385+ let mailer = Remembering::taking_everything();
8386+ let engine = Engine::new(store.clone(), mailer.clone(), "https://izlek.sh");
8387+ // The meeting is 15 minutes out from due, so a pass anywhere after that
8388+ // delivers both reminders.
8389+ let later = clock - Duration::minutes(14);
8390+ assert_eq!(engine.deliver_owed(later, 10).await.unwrap().sent, 2);
8391+
8392+ // Any later write about the card re-derives the reminders. The two who
8393+ // were reminded keep the rows that went out; nobody is minted a second.
8394+ let yusuf = member(&store, &workspace, "yusuf@izlek.sh", "Yusuf").await;
8395+ store.assign_task(&task, &yusuf).await.unwrap();
8396+ let rows = reminders(&store, &task).await;
8397+ let yusuf_rows: Vec<_> = rows
8398+ .iter()
8399+ .filter(|r| r.recipient == "yusuf@izlek.sh")
8400+ .collect();
8401+ assert_eq!(yusuf_rows.len(), 1, "the newcomer has one row: {rows:?}");
8402+ let served: Vec<_> = rows
8403+ .iter()
8404+ .filter(|r| r.recipient != "yusuf@izlek.sh")
8405+ .collect();
8406+ assert!(
8407+ served.iter().all(|r| r.state != SendState::Pending),
8408+ "nobody served is owed again: {served:?}"
8409+ );
8410+ for person in ["grace@izlek.sh", "emre@izlek.sh"] {
8411+ assert_eq!(
8412+ served
8413+ .iter()
8414+ .filter(|r| r.recipient == person && r.state == SendState::Sent)
8415+ .count(),
8416+ 1,
8417+ "{person} was delivered exactly once: {served:?}"
8418+ );
8419+ }
8420+ let pending = pending_reminders(&store, &task).await;
8421+ assert_eq!(pending.len(), 1, "only the newcomer is owed: {pending:?}");
8422+ assert_eq!(pending[0].recipient, "yusuf@izlek.sh");
8423+
8424+ // And the queue itself repeats nothing: sweep after sweep re-delivers
8425+ // nobody, whatever the writes in between did. Taking Yusuf off the card
8426+ // and putting him back is a write pair every round — the sync his
8427+ // reminder rides abandons and re-derives each time.
8428+ for _ in 0..3 {
8429+ engine
8430+ .deliver_owed(later + Duration::minutes(1), 10)
8431+ .await
8432+ .unwrap();
8433+ store.unassign_task(&task, &yusuf).await.unwrap();
8434+ store.assign_task(&task, &yusuf).await.unwrap();
8435+ }
8436+ assert_eq!(mailer.sent().len(), 3, "{:?}", mailer.sent());
8437+ let _ = std::fs::remove_dir_all(&dir);
8438+}
8439+
8440+#[tokio::test]
8441+async fn a_reminder_failing_on_retries_is_not_minted_twice() {
8442+ let (dir, store, workspace, admin) = shared().await;
8443+ let grace = member(&store, &workspace, "grace@izlek.sh", "Grace").await;
8444+ let clock = OffsetDateTime::now_utc() + Duration::hours(2);
8445+ let task = clocked_task(&store, &workspace, &admin, Some(clock)).await;
8446+ store.assign_task(&task, &grace).await.unwrap();
8447+
8448+ let mailer = Remembering::refusing(vec![MailError::retryable("host is down")]);
8449+ let engine = Engine::new(store.clone(), mailer.clone(), "https://izlek.sh");
8450+ let later = clock - Duration::minutes(14);
8451+ assert_eq!(engine.deliver_owed(later, 10).await.unwrap().failed, 1);
8452+
8453+ // The write between the sweeps finds Grace's reminder riding its own
8454+ // retry clock, and leaves it exactly one row.
8455+ let emre = member(&store, &workspace, "emre@izlek.sh", "Emre").await;
8456+ store.assign_task(&task, &emre).await.unwrap();
8457+ let rows = reminders(&store, &task).await;
8458+ assert_eq!(rows.len(), 2, "one row per person: {rows:?}");
8459+ let grace_row = rows.iter().find(|r| r.recipient == "grace@izlek.sh").unwrap();
8460+ assert_eq!(grace_row.state, SendState::Failed);
8461+ assert_eq!(grace_row.attempts, 1);
8462+
8463+ // When the host comes back the retry lands once — not once per row.
8464+ engine
8465+ .deliver_owed(later + backoff(1) + Duration::minutes(1), 10)
8466+ .await
8467+ .unwrap();
8468+ let grace_mail = mailer
8469+ .sent()
8470+ .iter()
8471+ .filter(|m| m.to == "grace@izlek.sh")
8472+ .count();
8473+ assert_eq!(grace_mail, 1, "{:?}", mailer.sent());
8474+ let _ = std::fs::remove_dir_all(&dir);
8475+}
8476+
8477+#[tokio::test]
8478+async fn the_reminder_never_lands_at_or_after_the_deadline() {
8479+ let (dir, store, workspace, admin) = shared().await;
8480+ // A meeting comfortably ahead: the lead decides the moment.
8481+ let clock = OffsetDateTime::now_utc() + Duration::hours(2);
8482+ let task = clocked_task(&store, &workspace, &admin, Some(clock)).await;
8483+ store
8484+ .assign_task(&task, &member(&store, &workspace, "grace@izlek.sh", "Grace").await)
8485+ .await
8486+ .unwrap();
8487+ let rows = reminders(&store, &task).await;
8488+ assert_eq!(rows.len(), 1);
8489+ let due = rows[0].next_attempt_at.unwrap();
8490+ assert!(
8491+ due < clock,
8492+ "the reminder fires {:#?} before the clock",
8493+ clock - due
8494+ );
8495+ assert_eq!(due, clock - Duration::minutes(15));
8496+
8497+ // A meeting already inside the window: the warning commits now, which is
8498+ // still before the clock.
8499+ let soon = OffsetDateTime::now_utc() + Duration::minutes(10);
8500+ let task = clocked_task(&store, &workspace, &admin, Some(soon)).await;
8501+ store
8502+ .assign_task(&task, &member(&store, &workspace, "emre@izlek.sh", "Emre").await)
8503+ .await
8504+ .unwrap();
8505+ let rows = reminders(&store, &task).await;
8506+ assert_eq!(rows.len(), 1);
8507+ let due = rows[0].next_attempt_at.unwrap();
8508+ assert!(due < soon, "due {due} at or after the clock {soon}");
8509+ let _ = std::fs::remove_dir_all(&dir);
8510+}
8511+
8512+/// Setting the password back to what it already is is refused by name, and a
8513+/// refused change leaves every session — and the old password — standing.
8514+#[tokio::test]
8515+async fn a_change_back_to_the_same_password_is_refused_and_signs_nobody_out() {
8516+ let (_scratch, accounts, admin) = claimed().await;
8517+ // A second browser holds a session the refused change must not touch.
8518+ let other = accounts
8519+ .sign_in("ada@izlek.sh", "tide-tables-1892", "198.51.100.8")
8520+ .await
8521+ .unwrap();
8522+ assert!(matches!(
8523+ accounts
8524+ .change_password(
8525+ &admin.id,
8526+ "tide-tables-1892",
8527+ "tide-tables-1892",
8528+ "198.51.100.7"
8529+ )
8530+ .await,
8531+ Err(AccountError::Password(PasswordProblem::IsCurrent))
8532+ ));
8533+ // The other browser is still signed in, and the old password still works.
8534+ assert!(
8535+ accounts
8536+ .authenticate(other.session_token.expose())
8537+ .await
8538+ .unwrap()
8539+ .is_some()
8540+ );
8541+ accounts
8542+ .sign_in("ada@izlek.sh", "tide-tables-1892", "198.51.100.7")
8543+ .await
8544+ .unwrap();
8545+}
crates/izlek-web/src/auth.rsmodified+9 -1
@@ -250,7 +250,15 @@ async fn change_password(cx: &Cx, Form(input): Form<ChangePasswordForm>) -> Redi
250 time::OffsetDateTime::now_utc(),250 time::OffsetDateTime::now_utc(),
251 )251 )
252 .await;252 .await;
253- redirect(cx, None)253+ // The pane says so itself: `saved=change_password` asks for the
254+ // note, with the other-devices fact in it.
255+ let back = back_to(cx, "/");
256+ let sep = if back.contains('?') { "&" } else { "?" };
257+ Ok((
258+ StatusCode::SEE_OTHER,
259+ [(header::LOCATION, format!("{back}{sep}saved=change_password"))],
260+ Json(None),
261+ ))
254 }262 }
255 Err(error) => redirect(cx, Some(error.into())),263 Err(error) => redirect(cx, Some(error.into())),
256 }264 }
crates/izlek-web/src/detail.rsmodified+33 -6
@@ -620,9 +620,9 @@ struct SetTaskTagForm {
620 }620 }
621 621
622 /// Files a task under a tag. A Viewer can read tags but not set them; the622 /// Files a task under a tag. A Viewer can read tags but not set them; the
623-/// tag has to be this workspace board's own. No activity is recorded and no623+/// tag has to be this workspace board's own. The relabeling lands on the
624-/// mail follows — re-labeling a card is not a thing anybody needs told624+/// task's own trail and the workspace feed; no rule mails about it, since no
625-/// about.625+/// trigger matches a tag.
626 #[route(POST "/api/set_task_tag")]626 #[route(POST "/api/set_task_tag")]
627 async fn set_task_tag(cx: &Cx, Form(input): Form<SetTaskTagForm>) -> Redirect {627 async fn set_task_tag(cx: &Cx, Form(input): Form<SetTaskTagForm>) -> Redirect {
628 let (actor, _) = match writer_and_task(cx, &input.task_id).await {628 let (actor, _) = match writer_and_task(cx, &input.task_id).await {
@@ -634,10 +634,20 @@ async fn set_task_tag(cx: &Cx, Form(input): Form<SetTaskTagForm>) -> Redirect {
634 return redirect(cx, Some(Refusal::Unavailable));634 return redirect(cx, Some(Refusal::Unavailable));
635 };635 };
636 let tags = store.tags(&board.id).await?;636 let tags = store.tags(&board.id).await?;
637- if !tags.iter().any(|tag| tag.id == input.tag_id) {637+ let Some(tag) = tags.iter().find(|tag| tag.id == input.tag_id) else {
638 return redirect(cx, Some(Refusal::NotFound));638 return redirect(cx, Some(Refusal::NotFound));
639- }639+ };
640 store.set_task_tag(&input.task_id, &input.tag_id).await?;640 store.set_task_tag(&input.task_id, &input.tag_id).await?;
641+ let _ = store
642+ .record_activity(
643+ &input.task_id,
644+ Some(&actor.id),
645+ None,
646+ &izlek_core::detail::ActivityKind::Other("tagged".to_string()),
647+ &tag.name,
648+ time::OffsetDateTime::now_utc(),
649+ )
650+ .await;
641 redirect(cx, None)651 redirect(cx, None)
642 }652 }
643 653
@@ -1270,7 +1280,12 @@ async fn description_control(cx: &Cx, task: &TaskDetail, may_write: bool, lang:
1270 /// The grid now autosubmits, the way the log filters already did, and1280 /// The grid now autosubmits, the way the log filters already did, and
1271 /// closing is what Escape and a click outside are for. The time rides the1281 /// closing is what Escape and a click outside are for. The time rides the
1272 /// same commit: a posted form carries whatever is typed, so `16:20` plus a1282 /// same commit: a posted form carries whatever is typed, so `16:20` plus a
1273-/// pressed day is one exact moment, and Clear empties both.1283+/// pressed day is one exact moment, and Clear empties both. A time the day
1284+/// can already carry commits by itself — the two boxes submit when they
1285+/// agree (both set or both emptied) and the input holds a day, because a
1286+/// lone box is a half-written value, not a moment, and a time with no day
1287+/// anywhere is not one either. On a dayless task the picks wait for the
1288+/// pressed day and ride its commit.
1274 ///1289 ///
1275 /// The box speaks the moment when there is one, the day when there is only1290 /// The box speaks the moment when there is one, the day when there is only
1276 /// a day — the clock's day is always the deadline's, and the label reads in1291 /// a day — the clock's day is always the deadline's, and the label reads in
@@ -1466,6 +1481,18 @@ pub(crate) async fn datepicker_script(cx: &Cx, lang: Lang) -> Result {
1466 var panel = toggle.closest('.datepick-pop').querySelector('.datepick-panel');\1481 var panel = toggle.closest('.datepick-pop').querySelector('.datepick-panel');\
1467 if (panel) {{ render(panel); }}\1482 if (panel) {{ render(panel); }}\
1468 }});\1483 }});\
1484+ document.addEventListener('change', function(e) {{\
1485+ var box = e.target;\
1486+ if (!box.matches || !box.matches('.datepick-time select')) {{ return; }}\
1487+ var panel = box.closest('.datepick-panel');\
1488+ var input = panel && panel.querySelector('.datepick-input');\
1489+ if (!input || !input.hasAttribute('data-autosubmit') || !input.value) {{ return; }}\
1490+ var hour = panel.querySelector('[name=clock_hour]');\
1491+ var minute = panel.querySelector('[name=clock_minute]');\
1492+ if (!hour || !minute) {{ return; }}\
1493+ if (!!hour.value !== !!minute.value) {{ return; }}\
1494+ if (input.form) {{ input.form.requestSubmit(); }}\
1495+ }});\
1469 document.addEventListener('izlek:wire', function () {{\1496 document.addEventListener('izlek:wire', function () {{\
1470 document.querySelectorAll('.datepick-pop').forEach(function (pop) {{\1497 document.querySelectorAll('.datepick-pop').forEach(function (pop) {{\
1471 var panel = pop.querySelector('.datepick-panel');\1498 var panel = pop.querySelector('.datepick-panel');\
crates/izlek-web/src/i18n.rsmodified+80 -0
@@ -299,6 +299,15 @@ pub enum Key {
299 ActLimitsSaved,299 ActLimitsSaved,
300 ActTestMailSent,300 ActTestMailSent,
301 ActMessageSent,301 ActMessageSent,
302+ ActSendRetried,
303+ ActPhotoSaved,
304+ ActPhotoRemoved,
305+ ActSenderChecked,
306+ PWCurrentWrong,
307+ PWIsCurrent,
308+ PWTooShort,
309+ PWLooksLikeYou,
310+ PasswordSaved,
302 UnblockedWord,311 UnblockedWord,
303 AColumn,312 AColumn,
304 AudienceEmpty,313 AudienceEmpty,
@@ -900,6 +909,24 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
900 (ActTestMailSent, Tr) => "test postası gönderdi",909 (ActTestMailSent, Tr) => "test postası gönderdi",
901 (ActMessageSent, En) => "sent a message",910 (ActMessageSent, En) => "sent a message",
902 (ActMessageSent, Tr) => "mesaj gönderdi",911 (ActMessageSent, Tr) => "mesaj gönderdi",
912+ (ActSendRetried, En) => "retried a send",
913+ (ActSendRetried, Tr) => "bir gönderimi yeniden denedi",
914+ (ActPhotoSaved, En) => "saved the profile photo",
915+ (ActPhotoSaved, Tr) => "profil fotoğrafını kaydetti",
916+ (ActPhotoRemoved, En) => "removed the profile photo",
917+ (ActPhotoRemoved, Tr) => "profil fotoğrafını kaldırdı",
918+ (ActSenderChecked, En) => "checked the mail server",
919+ (ActSenderChecked, Tr) => "posta sunucusunu denetledi",
920+ (PWCurrentWrong, En) => "The current password is wrong.",
921+ (PWCurrentWrong, Tr) => "Mevcut parola yanlış.",
922+ (PWIsCurrent, En) => "That's your current password.",
923+ (PWIsCurrent, Tr) => "Bu zaten mevcut parolan.",
924+ (PWTooShort, En) => "At least 10 characters.",
925+ (PWTooShort, Tr) => "En az 10 karakter.",
926+ (PWLooksLikeYou, En) => "Not your address or your name.",
927+ (PWLooksLikeYou, Tr) => "Adresin ya da adın değil.",
928+ (PasswordSaved, En) => "Password changed. Your other devices were signed out.",
929+ (PasswordSaved, Tr) => "Parola değişti. Diğer cihazlarının oturumu kapatıldı.",
903 (UnblockedWord, En) => "unblocked",930 (UnblockedWord, En) => "unblocked",
904 (UnblockedWord, Tr) => "engeli kaldırıldı",931 (UnblockedWord, Tr) => "engeli kaldırıldı",
905 (AColumn, En) => "a column",932 (AColumn, En) => "a column",
@@ -1238,6 +1265,41 @@ pub fn rule_deleted_label(lang: Lang, detail: &str) -> String {
1238 }1265 }
1239 }1266 }
1240 1267
1268+pub fn tagged_label(lang: Lang, detail: &str) -> String {
1269+ match lang {
1270+ Lang::En => format!("tagged it {detail}"),
1271+ Lang::Tr => format!("{detail} ile etiketledi"),
1272+ }
1273+}
1274+
1275+pub fn tag_created_label(lang: Lang, detail: &str) -> String {
1276+ match lang {
1277+ Lang::En => format!("created the tag {detail}"),
1278+ Lang::Tr => format!("{detail} etiketini oluşturdu"),
1279+ }
1280+}
1281+
1282+pub fn tag_renamed_label(lang: Lang, detail: &str) -> String {
1283+ match lang {
1284+ Lang::En => format!("renamed the tag {detail}"),
1285+ Lang::Tr => format!("{detail} etiketini yeniden adlandırdı"),
1286+ }
1287+}
1288+
1289+pub fn tag_deleted_label(lang: Lang, detail: &str) -> String {
1290+ match lang {
1291+ Lang::En => format!("deleted the tag {detail}"),
1292+ Lang::Tr => format!("{detail} etiketini sildi"),
1293+ }
1294+}
1295+
1296+pub fn tag_moved_label(lang: Lang, detail: &str) -> String {
1297+ match lang {
1298+ Lang::En => format!("moved the tag {detail}"),
1299+ Lang::Tr => format!("{detail} etiketini taşıdı"),
1300+ }
1301+}
1302+
1241 pub fn file_added_label(lang: Lang, detail: &str) -> String {1303 pub fn file_added_label(lang: Lang, detail: &str) -> String {
1242 match lang {1304 match lang {
1243 Lang::En => format!("added {detail}"),1305 Lang::En => format!("added {detail}"),
@@ -1313,6 +1375,24 @@ pub fn activity_kind_word(lang: Lang, kind: &str) -> String {
1313 ("deleted", Lang::Tr) => "silindi".to_string(),1375 ("deleted", Lang::Tr) => "silindi".to_string(),
1314 ("commented", Lang::En) => "commented".to_string(),1376 ("commented", Lang::En) => "commented".to_string(),
1315 ("commented", Lang::Tr) => "yorum yapıldı".to_string(),1377 ("commented", Lang::Tr) => "yorum yapıldı".to_string(),
1378+ ("tagged", Lang::En) => "tagged".to_string(),
1379+ ("tagged", Lang::Tr) => "etiketlendi".to_string(),
1380+ ("tag_created", Lang::En) => "tag created".to_string(),
1381+ ("tag_created", Lang::Tr) => "etiket oluşturuldu".to_string(),
1382+ ("tag_renamed", Lang::En) => "tag renamed".to_string(),
1383+ ("tag_renamed", Lang::Tr) => "etiket yeniden adlandırıldı".to_string(),
1384+ ("tag_deleted", Lang::En) => "tag deleted".to_string(),
1385+ ("tag_deleted", Lang::Tr) => "etiket silindi".to_string(),
1386+ ("tag_moved", Lang::En) => "tag moved".to_string(),
1387+ ("tag_moved", Lang::Tr) => "etiket taşındı".to_string(),
1388+ ("send_retried", Lang::En) => "send retried".to_string(),
1389+ ("send_retried", Lang::Tr) => "gönderim yeniden denendi".to_string(),
1390+ ("photo_saved", Lang::En) => "photo saved".to_string(),
1391+ ("photo_saved", Lang::Tr) => "fotoğraf kaydedildi".to_string(),
1392+ ("photo_removed", Lang::En) => "photo removed".to_string(),
1393+ ("photo_removed", Lang::Tr) => "fotoğraf kaldırıldı".to_string(),
1394+ ("sender_checked", Lang::En) => "mail server checked".to_string(),
1395+ ("sender_checked", Lang::Tr) => "posta sunucusu denetlendi".to_string(),
1316 (other, _) => other.to_string(),1396 (other, _) => other.to_string(),
1317 }1397 }
1318 }1398 }
crates/izlek-web/src/logs.rsmodified+35 -7
@@ -124,6 +124,15 @@ const ACTIVITY_KINDS: &[&str] = &[
124 "rule_deleted",124 "rule_deleted",
125 "file_added",125 "file_added",
126 "file_removed",126 "file_removed",
127+ "tagged",
128+ "tag_created",
129+ "tag_renamed",
130+ "tag_deleted",
131+ "tag_moved",
132+ "send_retried",
133+ "photo_saved",
134+ "photo_removed",
135+ "sender_checked",
127 ];136 ];
128 137
129 /// The word the decisions panel prints for an outcome. Terse: the panel is138 /// The word the decisions panel prints for an outcome. Terse: the panel is
@@ -184,7 +193,18 @@ fn activity_sentence(kind: &izlek_core::detail::ActivityKind, detail: &str, lang
184 ActivityKind::RuleEdited => crate::i18n::rule_edited_label(lang, detail),193 ActivityKind::RuleEdited => crate::i18n::rule_edited_label(lang, detail),
185 ActivityKind::RuleToggled => crate::i18n::rule_toggled_label(lang, detail),194 ActivityKind::RuleToggled => crate::i18n::rule_toggled_label(lang, detail),
186 ActivityKind::RuleDeleted => crate::i18n::rule_deleted_label(lang, detail),195 ActivityKind::RuleDeleted => crate::i18n::rule_deleted_label(lang, detail),
187- ActivityKind::Other(_) => detail.to_string(),196+ ActivityKind::Other(raw) => match raw.as_str() {
197+ "tagged" => crate::i18n::tagged_label(lang, detail),
198+ "tag_created" => crate::i18n::tag_created_label(lang, detail),
199+ "tag_renamed" => crate::i18n::tag_renamed_label(lang, detail),
200+ "tag_deleted" => crate::i18n::tag_deleted_label(lang, detail),
201+ "tag_moved" => crate::i18n::tag_moved_label(lang, detail),
202+ "send_retried" => t(lang, Key::ActSendRetried).to_string(),
203+ "photo_saved" => t(lang, Key::ActPhotoSaved).to_string(),
204+ "photo_removed" => t(lang, Key::ActPhotoRemoved).to_string(),
205+ "sender_checked" => t(lang, Key::ActSenderChecked).to_string(),
206+ _ => detail.to_string(),
207+ },
188 }208 }
189 }209 }
190 210
@@ -764,18 +784,26 @@ struct RetrySendForm {
764 send_id: String,784 send_id: String,
765 }785 }
766 786
767-/// Puts a failed or abandoned send back in play, admin only. No trail event:787+/// Puts a failed or abandoned send back in play, admin only. The retry lands
768-/// no `ActivityKind` fits a retry, so none is written rather than one being788+/// on the workspace trail, so the queue's history reads whole.
769-/// invented.
770 #[route(POST "/api/retry_send")]789 #[route(POST "/api/retry_send")]
771 async fn retry_send(cx: &Cx, Form(input): Form<RetrySendForm>) -> Redirect {790 async fn retry_send(cx: &Cx, Form(input): Form<RetrySendForm>) -> Redirect {
772- if let Err(refusal) = require_admin(cx).await {791+ let admin = match require_admin(cx).await {
773- return redirect(cx, Some(refusal));792+ Ok(admin) => admin,
774- }793+ Err(refusal) => return redirect(cx, Some(refusal)),
794+ };
775 let store = accounts(cx).store().clone();795 let store = accounts(cx).store().clone();
776 let _ = store796 let _ = store
777 .requeue_send(&input.send_id, OffsetDateTime::now_utc())797 .requeue_send(&input.send_id, OffsetDateTime::now_utc())
778 .await;798 .await;
799+ let _ = store
800+ .record_event(
801+ Some(&admin.id),
802+ &izlek_core::detail::ActivityKind::Other("send_retried".to_string()),
803+ "",
804+ OffsetDateTime::now_utc(),
805+ )
806+ .await;
779 redirect(cx, None)807 redirect(cx, None)
780 }808 }
781 809
crates/izlek-web/src/photo.rsmodified+19 -1
@@ -77,6 +77,14 @@ async fn upload(
77 if let Some(stamps) = try_app_context::<PhotoStamps>(cx) {77 if let Some(stamps) = try_app_context::<PhotoStamps>(cx) {
78 stamps.bump(&user.id);78 stamps.bump(&user.id);
79 }79 }
80+ let _ = store
81+ .record_event(
82+ Some(&user.id),
83+ &izlek_core::detail::ActivityKind::Other("photo_saved".to_string()),
84+ "",
85+ OffsetDateTime::now_utc(),
86+ )
87+ .await;
80 saved_or_refused("profile_photo", None)88 saved_or_refused("profile_photo", None)
81 }89 }
82 Err(_) => saved_or_refused("profile_photo", Some(Refusal::Unavailable)),90 Err(_) => saved_or_refused("profile_photo", Some(Refusal::Unavailable)),
@@ -93,7 +101,17 @@ async fn delete(cx: &Cx) -> topcoat::Result<(StatusCode, HeaderMap, Vec<u8>)> {
93 };101 };
94 let store = accounts(cx).store().clone();102 let store = accounts(cx).store().clone();
95 Ok(match store.clear_photo(&user.id).await {103 Ok(match store.clear_photo(&user.id).await {
96- Ok(()) => saved_or_refused("delete_profile_photo", None),104+ Ok(()) => {
105+ let _ = store
106+ .record_event(
107+ Some(&user.id),
108+ &izlek_core::detail::ActivityKind::Other("photo_removed".to_string()),
109+ "",
110+ OffsetDateTime::now_utc(),
111+ )
112+ .await;
113+ saved_or_refused("delete_profile_photo", None)
114+ }
97 Err(_) => saved_or_refused("delete_profile_photo", Some(Refusal::Unavailable)),115 Err(_) => saved_or_refused("delete_profile_photo", Some(Refusal::Unavailable)),
98 })116 })
99 }117 }
crates/izlek-web/src/server.rsmodified+56 -21
@@ -8,6 +8,7 @@
8 //! `izlek-web/src/auth.rs`, onto topcoat's context/cookie/layer primitives.8 //! `izlek-web/src/auth.rs`, onto topcoat's context/cookie/layer primitives.
9 9
10 use izlek_core::accounts::{AccountError, Accounts};10 use izlek_core::accounts::{AccountError, Accounts};
11+use izlek_core::auth::PasswordProblem;
11 use izlek_core::board::Transition;12 use izlek_core::board::Transition;
12 use izlek_core::mail::Engine;13 use izlek_core::mail::Engine;
13 use izlek_core::store::{Freeing, User};14 use izlek_core::store::{Freeing, User};
@@ -282,7 +283,7 @@ fn refusal_for(error: &AccountError) -> Refusal {
282 match error {283 match error {
283 AccountError::Rejected => Refusal::Rejected,284 AccountError::Rejected => Refusal::Rejected,
284 AccountError::RateLimited => Refusal::RateLimited,285 AccountError::RateLimited => Refusal::RateLimited,
285- AccountError::Password(problem) => Refusal::Password(problem.to_string()),286+ AccountError::Password(problem) => Refusal::Password(*problem),
286 AccountError::Forbidden => Refusal::Forbidden,287 AccountError::Forbidden => Refusal::Forbidden,
287 AccountError::AlreadyClaimed => Refusal::AlreadyClaimed,288 AccountError::AlreadyClaimed => Refusal::AlreadyClaimed,
288 AccountError::AddressTaken => Refusal::AddressTaken,289 AccountError::AddressTaken => Refusal::AddressTaken,
@@ -315,8 +316,10 @@ pub enum Refusal {
315 Rejected,316 Rejected,
316 RateLimited,317 RateLimited,
317 /// A password broke a stated rule. Only reachable once we know who the318 /// A password broke a stated rule. Only reachable once we know who the
318- /// person is, so it gives nothing away.319+ /// person is, so it gives nothing away. The problem itself rides in the
319- Password(String),320+ /// variant — the wording is built at the edge, in the reader's language,
321+ /// never reflected out of the address bar.
322+ Password(PasswordProblem),
320 Forbidden,323 Forbidden,
321 SignInFirst,324 SignInFirst,
322 AlreadyClaimed,325 AlreadyClaimed,
@@ -400,7 +403,7 @@ impl Refusal {
400 Refusal::RateLimited => {403 Refusal::RateLimited => {
401 "Too many attempts — wait a few minutes and try again.".to_string()404 "Too many attempts — wait a few minutes and try again.".to_string()
402 }405 }
403- Refusal::Password(problem) => problem.clone(),406+ Refusal::Password(problem) => problem.to_string(),
404 Refusal::Forbidden => "Not permitted.".to_string(),407 Refusal::Forbidden => "Not permitted.".to_string(),
405 Refusal::SignInFirst => "Sign in first.".to_string(),408 Refusal::SignInFirst => "Sign in first.".to_string(),
406 Refusal::AlreadyClaimed => "This workspace already has an owner.".to_string(),409 Refusal::AlreadyClaimed => "This workspace already has an owner.".to_string(),
@@ -502,10 +505,12 @@ impl Refusal {
502 Refusal::AddressTaken => "Bu adresin zaten bir hesabı var.".to_string(),505 Refusal::AddressTaken => "Bu adresin zaten bir hesabı var.".to_string(),
503 Refusal::LinkNotUsable => "Bu bağlantı artık çalışmıyor.".to_string(),506 Refusal::LinkNotUsable => "Bu bağlantı artık çalışmıyor.".to_string(),
504 Refusal::EmptyName => "Kendine bir isim ver.".to_string(),507 Refusal::EmptyName => "Kendine bir isim ver.".to_string(),
505- // Built by `izlek-core`'s password validator, out of this508+ // The validator's own words, in the reader's language.
506- // slice's reach — stays English until that crate carries `Lang`509+ Refusal::Password(problem) => match problem {
507- // too.510+ PasswordProblem::TooShort => "En az 10 karakter.".to_string(),
508- Refusal::Password(_) => self.message(),511+ PasswordProblem::LooksLikeYou => "Adresin ya da adın değil.".to_string(),
512+ PasswordProblem::IsCurrent => "Bu zaten mevcut parolan.".to_string(),
513+ },
509 }514 }
510 }515 }
511 516
@@ -516,8 +521,9 @@ impl Refusal {
516 Some(match code {521 Some(match code {
517 "rejected" => Refusal::Rejected,522 "rejected" => Refusal::Rejected,
518 "rate-limited" => Refusal::RateLimited,523 "rate-limited" => Refusal::RateLimited,
519- "password-short" => Refusal::Password("at least 10 characters".to_string()),524+ "password-short" => Refusal::Password(PasswordProblem::TooShort),
520- "password-you" => Refusal::Password("not your address or your name".to_string()),525+ "password-you" => Refusal::Password(PasswordProblem::LooksLikeYou),
526+ "password-current" => Refusal::Password(PasswordProblem::IsCurrent),
521 "forbidden" => Refusal::Forbidden,527 "forbidden" => Refusal::Forbidden,
522 "sign-in-first" => Refusal::SignInFirst,528 "sign-in-first" => Refusal::SignInFirst,
523 "already-claimed" => Refusal::AlreadyClaimed,529 "already-claimed" => Refusal::AlreadyClaimed,
@@ -570,15 +576,11 @@ impl Refusal {
570 Refusal::RateLimited => "rate-limited",576 Refusal::RateLimited => "rate-limited",
571 // The problem itself, not the wording, so the sentence is built577 // The problem itself, not the wording, so the sentence is built
572 // here on the way back rather than reflected out of the address.578 // here on the way back rather than reflected out of the address.
573- Refusal::Password(problem) => {579+ Refusal::Password(problem) => match problem {
574- if problem == "at least 10 characters" {580+ PasswordProblem::TooShort => "password-short",
575- "password-short"581+ PasswordProblem::LooksLikeYou => "password-you",
576- } else if problem == "not your address or your name" {582+ PasswordProblem::IsCurrent => "password-current",
577- "password-you"583+ },
578- } else {
579- "rejected"
580- }
581- }
582 Refusal::Forbidden => "forbidden",584 Refusal::Forbidden => "forbidden",
583 Refusal::SignInFirst => "sign-in-first",585 Refusal::SignInFirst => "sign-in-first",
584 Refusal::AlreadyClaimed => "already-claimed",586 Refusal::AlreadyClaimed => "already-claimed",
@@ -813,6 +815,37 @@ fn same_origin(location: &str) -> &str {
813 }815 }
814 }816 }
815 817
818+/// The cache directives a response cannot choose for itself.
819+///
820+/// HTML is revalidated on every load: a page the browser kept from before a
821+/// deploy is the old app answering under the new one's address, which is how a
822+/// fixed bug once came back after shipping. So every response whose body is a
823+/// document gets `no-cache`. Responses that already carry a directive keep it —
824+/// topcoat stamps the fingerprinted assets under `/_topcoat/assets` with a year
825+/// of `immutable` and the live stream with `no-cache`, and the photo and
826+/// attachment handlers stamp their own — and everything else (redirects, JSON
827+/// answers) ships none, the idiom they already ride on: no directive, nothing
828+/// cached. One layer at `/`, because the decision is about what the bytes are,
829+/// not which route built them.
830+#[topcoat::router::layer("/")]
831+async fn cache_directives(cx: &Cx, body: Body, next: Next<'_>) -> topcoat::Result<Response> {
832+ let response = next.run(cx, body).await?;
833+ let (mut parts, body) = response.into_parts();
834+ let is_html = parts
835+ .headers
836+ .get(header::CONTENT_TYPE)
837+ .and_then(|value| value.to_str().ok())
838+ .is_some_and(|value| value.starts_with("text/html"));
839+ if !is_html || parts.headers.contains_key(header::CACHE_CONTROL) {
840+ return Ok(Response::from_parts(parts, body));
841+ }
842+ parts.headers.insert(
843+ header::CACHE_CONTROL,
844+ HeaderValue::from_static("no-cache"),
845+ );
846+ Ok(Response::from_parts(parts, body))
847+}
848+
816 #[cfg(test)]849 #[cfg(test)]
817 mod refusal_redirect_tests {850 mod refusal_redirect_tests {
818 use super::carrying;851 use super::carrying;
@@ -895,14 +928,16 @@ mod refusal_redirect_tests {
895 #[cfg(test)]928 #[cfg(test)]
896 mod refusal_message_tests {929 mod refusal_message_tests {
897 use super::Refusal;930 use super::Refusal;
931+ use izlek_core::auth::PasswordProblem;
898 932
899 #[test]933 #[test]
900 fn every_refusal_survives_the_address_bar() {934 fn every_refusal_survives_the_address_bar() {
901 let all = [935 let all = [
902 Refusal::Rejected,936 Refusal::Rejected,
903 Refusal::RateLimited,937 Refusal::RateLimited,
904- Refusal::Password("at least 10 characters".to_string()),938+ Refusal::Password(PasswordProblem::TooShort),
905- Refusal::Password("not your address or your name".to_string()),939+ Refusal::Password(PasswordProblem::LooksLikeYou),
940+ Refusal::Password(PasswordProblem::IsCurrent),
906 Refusal::Forbidden,941 Refusal::Forbidden,
907 Refusal::SignInFirst,942 Refusal::SignInFirst,
908 Refusal::AlreadyClaimed,943 Refusal::AlreadyClaimed,
crates/izlek-web/src/settings.rsmodified+31 -7
@@ -25,6 +25,7 @@ use topcoat::router::content::Form;
25 use topcoat::router::{HeaderMap, HeaderValue, StatusCode, header, page, route};25 use topcoat::router::{HeaderMap, HeaderValue, StatusCode, header, page, route};
26 use topcoat::view::view;26 use topcoat::view::view;
27 27
28+use izlek_core::auth::PasswordProblem;
28 use izlek_core::detail::ActivityKind;29 use izlek_core::detail::ActivityKind;
29 use izlek_core::store::{NewSender, SenderCheck, SenderTest, Store, User};30 use izlek_core::store::{NewSender, SenderCheck, SenderTest, Store, User};
30 31
@@ -564,11 +565,16 @@ async fn check_sender(cx: &Cx) -> Result<(StatusCode, HeaderMap, Vec<u8>)> {
564 Ok(admin) => admin,565 Ok(admin) => admin,
565 Err(refusal) => return Ok(saved_or_refused("check_sender", Some(refusal))),566 Err(refusal) => return Ok(saved_or_refused("check_sender", Some(refusal))),
566 };567 };
567- probe_sender(568+ let store = accounts(cx).store().clone();
568- mail(cx),569+ probe_sender(mail(cx), store.clone(), admin.workspace_id.clone());
569- accounts(cx).store().clone(),570+ let _ = store
570- admin.workspace_id.clone(),571+ .record_event(
571- );572+ Some(&admin.id),
573+ &ActivityKind::Other("sender_checked".to_string()),
574+ "",
575+ time::OffsetDateTime::now_utc(),
576+ )
577+ .await;
572 Ok(saved_or_refused("check_sender", None))578 Ok(saved_or_refused("check_sender", None))
573 }579 }
574 580
@@ -1132,6 +1138,21 @@ fn call_state<'q>(query: &'q str, call: &str) -> (Option<Refusal>, bool) {
1132 (refusal, saved)1138 (refusal, saved)
1133 }1139 }
1134 1140
1141+/// The password pane words a refusal itself: on this surface `Rejected` can
1142+/// only be the current password failing, so the pane says which half did
1143+/// rather than the generic "that did not work".
1144+fn password_pane_word(lang: Lang, refusal: &Refusal) -> String {
1145+ match refusal {
1146+ Refusal::Rejected => t(lang, Key::PWCurrentWrong).to_string(),
1147+ Refusal::Password(problem) => match problem {
1148+ PasswordProblem::TooShort => t(lang, Key::PWTooShort).to_string(),
1149+ PasswordProblem::LooksLikeYou => t(lang, Key::PWLooksLikeYou).to_string(),
1150+ PasswordProblem::IsCurrent => t(lang, Key::PWIsCurrent).to_string(),
1151+ },
1152+ other => other.message_in(lang),
1153+ }
1154+}
1155+
1135 fn query_value<'q>(query: &'q str, key: &str) -> Option<&'q str> {1156 fn query_value<'q>(query: &'q str, key: &str) -> Option<&'q str> {
1136 query.split('&').find_map(|pair| {1157 query.split('&').find_map(|pair| {
1137 pair.split_once('=')1158 pair.split_once('=')
@@ -1221,7 +1242,7 @@ async fn settings_page(cx: &Cx) -> Result {
1221 let (invite_refusal, _) = call_state(query, "invite_member");1242 let (invite_refusal, _) = call_state(query, "invite_member");
1222 let (role_refusal, _) = call_state(query, "set_role");1243 let (role_refusal, _) = call_state(query, "set_role");
1223 let member_refusal = resend_refusal.or(invite_refusal).or(role_refusal);1244 let member_refusal = resend_refusal.or(invite_refusal).or(role_refusal);
1224- let (password_refusal, _) = call_state(query, "change_password");1245+ let (password_refusal, password_saved) = call_state(query, "change_password");
1225 let (message_refusal, message_saved) = call_state(query, "send_message");1246 let (message_refusal, message_saved) = call_state(query, "send_message");
1226 let mailed = query_value(query, "mailed").map(decode_q);1247 let mailed = query_value(query, "mailed").map(decode_q);
1227 1248
@@ -1343,7 +1364,10 @@ async fn settings_page(cx: &Cx) -> Result {
1343 </label>1364 </label>
1344 <div class="panel-foot">1365 <div class="panel-foot">
1345 if let Some(refusal) = &password_refusal {1366 if let Some(refusal) = &password_refusal {
1346- <span class="field-error">(refusal.message_in(lang))</span>1367+ <span class="field-error">(password_pane_word(lang, refusal))</span>
1368+ }
1369+ if password_saved {
1370+ <span class="field-note">(t(lang, Key::PasswordSaved))</span>
1347 }1371 }
1348 <button class="primary" type="submit">(t(lang, Key::ChangePassword))</button>1372 <button class="primary" type="submit">(t(lang, Key::ChangePassword))</button>
1349 </div>1373 </div>
crates/izlek-web/src/tags.rsmodified+30 -4
@@ -122,6 +122,20 @@ struct CreateTagForm {
122 name: String,122 name: String,
123 }123 }
124 124
125+/// One line on the workspace trail: who did what to which tag. A trail
126+/// write that fails is swallowed, like every other trail write behind a
127+/// handler — a lost log line never fails the write that caused it.
128+async fn tag_event(store: &Arc<dyn Store>, actor: &User, kind: &str, detail: &str) {
129+ let _ = store
130+ .record_event(
131+ Some(&actor.id),
132+ &izlek_core::detail::ActivityKind::Other(kind.to_string()),
133+ detail,
134+ time::OffsetDateTime::now_utc(),
135+ )
136+ .await;
137+}
138+
125 /// Writes one tag. A duplicate name is the store's `Conflict`, which lands139 /// Writes one tag. A duplicate name is the store's `Conflict`, which lands
126 /// here like every other store error: the admin sees "something went wrong"140 /// here like every other store error: the admin sees "something went wrong"
127 /// and the list still shows the tag they collide with.141 /// and the list still shows the tag they collide with.
@@ -147,6 +161,7 @@ async fn create_tag(cx: &Cx, Form(input): Form<CreateTagForm>) -> Redirect {
147 {161 {
148 return redirect(cx, Some(Refusal::Unavailable));162 return redirect(cx, Some(Refusal::Unavailable));
149 }163 }
164+ tag_event(&store, &user, "tag_created", &name).await;
150 redirect(cx, None)165 redirect(cx, None)
151 }166 }
152 167
@@ -161,7 +176,7 @@ struct RenameTagForm {
161 /// renamed by an admin who never owned it.176 /// renamed by an admin who never owned it.
162 #[route(POST "/api/rename_tag")]177 #[route(POST "/api/rename_tag")]
163 async fn rename_tag(cx: &Cx, Form(input): Form<RenameTagForm>) -> Redirect {178 async fn rename_tag(cx: &Cx, Form(input): Form<RenameTagForm>) -> Redirect {
164- let (store, _, _) = match tag_of_this_workspace(cx, &input.tag_id).await {179+ let (store, user, tag) = match tag_of_this_workspace(cx, &input.tag_id).await {
165 Ok(triple) => triple,180 Ok(triple) => triple,
166 Err(refusal) => return redirect(cx, Some(refusal)),181 Err(refusal) => return redirect(cx, Some(refusal)),
167 };182 };
@@ -172,6 +187,13 @@ async fn rename_tag(cx: &Cx, Form(input): Form<RenameTagForm>) -> Redirect {
172 if store.rename_tag(&input.tag_id, &name).await.is_err() {187 if store.rename_tag(&input.tag_id, &name).await.is_err() {
173 return redirect(cx, Some(Refusal::Unavailable));188 return redirect(cx, Some(Refusal::Unavailable));
174 }189 }
190+ tag_event(
191+ &store,
192+ &user,
193+ "tag_renamed",
194+ &format!("{} -> {name}", tag.name),
195+ )
196+ .await;
175 redirect(cx, None)197 redirect(cx, None)
176 }198 }
177 199
@@ -187,12 +209,15 @@ struct DeleteTagForm {
187 /// the same rule where it is actually enforced.209 /// the same rule where it is actually enforced.
188 #[route(POST "/api/delete_tag")]210 #[route(POST "/api/delete_tag")]
189 async fn delete_tag(cx: &Cx, Form(input): Form<DeleteTagForm>) -> Redirect {211 async fn delete_tag(cx: &Cx, Form(input): Form<DeleteTagForm>) -> Redirect {
190- let (store, _, _) = match tag_of_this_workspace(cx, &input.tag_id).await {212+ let (store, user, tag) = match tag_of_this_workspace(cx, &input.tag_id).await {
191 Ok(triple) => triple,213 Ok(triple) => triple,
192 Err(refusal) => return redirect(cx, Some(refusal)),214 Err(refusal) => return redirect(cx, Some(refusal)),
193 };215 };
194 match store.delete_tag(&input.tag_id).await {216 match store.delete_tag(&input.tag_id).await {
195- Ok(()) => redirect(cx, None),217+ Ok(()) => {
218+ tag_event(&store, &user, "tag_deleted", &tag.name).await;
219+ redirect(cx, None)
220+ }
196 Err(izlek_core::store::StoreError::Conflict("tag_in_use")) => {221 Err(izlek_core::store::StoreError::Conflict("tag_in_use")) => {
197 redirect(cx, Some(Refusal::TagInUse))222 redirect(cx, Some(Refusal::TagInUse))
198 }223 }
@@ -211,7 +236,7 @@ struct MoveTagForm {
211 /// form gone wrong, and does nothing.236 /// form gone wrong, and does nothing.
212 #[route(POST "/api/move_tag")]237 #[route(POST "/api/move_tag")]
213 async fn move_tag(cx: &Cx, Form(input): Form<MoveTagForm>) -> Redirect {238 async fn move_tag(cx: &Cx, Form(input): Form<MoveTagForm>) -> Redirect {
214- let (store, _, _) = match tag_of_this_workspace(cx, &input.tag_id).await {239+ let (store, user, tag) = match tag_of_this_workspace(cx, &input.tag_id).await {
215 Ok(triple) => triple,240 Ok(triple) => triple,
216 Err(refusal) => return redirect(cx, Some(refusal)),241 Err(refusal) => return redirect(cx, Some(refusal)),
217 };242 };
@@ -223,6 +248,7 @@ async fn move_tag(cx: &Cx, Form(input): Form<MoveTagForm>) -> Redirect {
223 if store.move_tag(&input.tag_id, up).await.is_err() {248 if store.move_tag(&input.tag_id, up).await.is_err() {
224 return redirect(cx, Some(Refusal::Unavailable));249 return redirect(cx, Some(Refusal::Unavailable));
225 }250 }
251+ tag_event(&store, &user, "tag_moved", &tag.name).await;
226 redirect(cx, None)252 redirect(cx, None)
227 }253 }
228 254
crates/izlek-web/tests/http.rsmodified+415 -5
@@ -5010,11 +5010,10 @@ async fn the_topbar_nav_marks_the_active_page() {
5010 }5010 }
5011 5011
5012 /// A wrong current password lands back on the rail section it was posted5012 /// A wrong current password lands back on the rail section it was posted
5013-/// from with a refusal; a right one changes nothing about the query but the5013+/// from with a refusal; a right one lands with the pane's own `saved=` note —
5014-/// refusal — `carry_refusal_on_redirect` never writes a `saved=` for a call5014+/// the user asked the pane to say what happened, other devices included.
5015-/// nobody asked to see a note about.
5016 #[tokio::test]5015 #[tokio::test]
5017-async fn a_password_change_carries_its_own_refusal_and_never_a_saved_note() {5016+async fn a_password_change_carries_its_own_refusal_and_a_saved_note() {
5018 let app = App::open().await;5017 let app = App::open().await;
5019 let admin_cookie = admin(&app).await;5018 let admin_cookie = admin(&app).await;
5020 5019
@@ -5055,7 +5054,7 @@ async fn a_password_change_carries_its_own_refusal_and_never_a_saved_note() {
5055 right5054 right
5056 .location5055 .location
5057 .as_deref()5056 .as_deref()
5058- .is_some_and(|location| !location.contains("saved=")),5057+ .is_some_and(|location| location.contains("saved=change_password")),
5059 "{:?}",5058 "{:?}",
5060 right.location5059 right.location
5061 );5060 );
@@ -9110,3 +9109,414 @@ async fn an_off_step_clock_renders_itself_not_a_rounded_step() {
9110 );9109 );
9111 assert!(html.contains(">Sep 02 11:23<"), "{html}");9110 assert!(html.contains(">Sep 02 11:23<"), "{html}");
9112 }9111 }
9112+
9113+#[tokio::test]
9114+async fn a_page_revalidates_and_an_asset_caches_forever() {
9115+ let app = App::open().await;
9116+
9117+ // A page the browser kept from before a deploy is the old app answering
9118+ // under the new one's address, so HTML is revalidated on every load.
9119+ let page = Request::builder()
9120+ .method("GET")
9121+ .uri("/")
9122+ .body(Body::empty())
9123+ .unwrap();
9124+ let page = app.router.handle(page).await;
9125+ assert_eq!(page.status(), StatusCode::OK);
9126+ let directive = page
9127+ .headers()
9128+ .get(header::CACHE_CONTROL)
9129+ .and_then(|value| value.to_str().ok());
9130+ assert_eq!(directive, Some("no-cache"));
9131+
9132+ // The asset's name carries its content hash, so the year of `immutable`
9133+ // topcoat stamps it with survives the layer untouched.
9134+ let stylesheet = std::fs::read_dir(asset_dir())
9135+ .unwrap()
9136+ .filter_map(|entry| {
9137+ let path = entry.ok()?.path();
9138+ (path.extension()?.to_str()? == "css").then_some(path)
9139+ })
9140+ .next()
9141+ .expect("no compiled stylesheet in the asset bundle");
9142+ let asset_path = format!(
9143+ "/_topcoat/assets/{}",
9144+ stylesheet.file_name().unwrap().to_str().unwrap()
9145+ );
9146+ let asset = Request::builder()
9147+ .method("GET")
9148+ .uri(&asset_path)
9149+ .body(Body::empty())
9150+ .unwrap();
9151+ let asset = app.router.handle(asset).await;
9152+ assert_eq!(asset.status(), StatusCode::OK);
9153+ let directive = asset
9154+ .headers()
9155+ .get(header::CACHE_CONTROL)
9156+ .and_then(|value| value.to_str().ok());
9157+ assert_eq!(directive, Some("public, max-age=31536000, immutable"));
9158+
9159+ // A redirect carries no directive at all: nothing cached, nothing stale.
9160+ let redirected = Request::builder()
9161+ .method("POST")
9162+ .uri("/api/sign_out")
9163+ .header(header::ACCEPT, "application/json")
9164+ .body(Body::empty())
9165+ .unwrap();
9166+ let redirected = app.router.handle(redirected).await;
9167+ assert_eq!(redirected.status(), StatusCode::SEE_OTHER);
9168+ assert!(redirected.headers().get(header::CACHE_CONTROL).is_none());
9169+}
9170+
9171+/// Every tag write lands on the workspace trail with the acting admin as the
9172+/// actor: created, moved, renamed (old -> new) and deleted each name the tag
9173+/// itself in the detail.
9174+#[tokio::test]
9175+async fn tag_writes_record_their_events() {
9176+ let app = App::open().await;
9177+ let admin_cookie = admin(&app).await;
9178+
9179+ app
9180+ .post(
9181+ "/api/create_tag",
9182+ Some(&admin_cookie),
9183+ &[("name", "Urgent")],
9184+ )
9185+ .await;
9186+ let workspace_id = app.workspace_id().await;
9187+ let tag = {
9188+ let board = izlek_core::board::load(app.store.as_ref(), &workspace_id)
9189+ .await
9190+ .unwrap()
9191+ .unwrap();
9192+ app.store
9193+ .tags(&board.board.id)
9194+ .await
9195+ .unwrap()
9196+ .into_iter()
9197+ .find(|tag| tag.name == "Urgent")
9198+ .expect("the tag was created")
9199+ };
9200+ app
9201+ .post(
9202+ "/api/move_tag",
9203+ Some(&admin_cookie),
9204+ &[("tag_id", &tag.id), ("direction", "up")],
9205+ )
9206+ .await;
9207+ app
9208+ .post(
9209+ "/api/rename_tag",
9210+ Some(&admin_cookie),
9211+ &[("tag_id", &tag.id), ("name", "High")],
9212+ )
9213+ .await;
9214+ app
9215+ .post(
9216+ "/api/delete_tag",
9217+ Some(&admin_cookie),
9218+ &[("tag_id", &tag.id)],
9219+ )
9220+ .await;
9221+
9222+ let lines = app
9223+ .store
9224+ .recent_activity(
9225+ 20,
9226+ izlek_core::store::FeedPage::Newest,
9227+ izlek_core::store::Dir::Newest,
9228+ &izlek_core::store::ActivityFilter::default(),
9229+ )
9230+ .await
9231+ .unwrap();
9232+ let line_of = |raw: &str| {
9233+ lines
9234+ .iter()
9235+ .find(|line| line.kind.as_str() == raw)
9236+ .unwrap_or_else(|| panic!("no {raw} line: {lines:?}"))
9237+ };
9238+ assert_eq!(line_of("tag_created").detail, "Urgent");
9239+ assert_eq!(line_of("tag_renamed").detail, "Urgent -> High");
9240+ assert_eq!(line_of("tag_moved").detail, "Urgent");
9241+ assert_eq!(line_of("tag_deleted").detail, "High");
9242+ for raw in ["tag_created", "tag_renamed", "tag_moved", "tag_deleted"] {
9243+ assert_eq!(
9244+ line_of(raw).actor_name.as_deref(),
9245+ Some("Ada Lovelace"),
9246+ "{raw}"
9247+ );
9248+ }
9249+}
9250+
9251+/// Filing a task under a tag writes one line on the task's own trail, naming
9252+/// the tag, with the person who filed it as the actor.
9253+#[tokio::test]
9254+async fn tagging_a_task_records_a_trail_line() {
9255+ let app = App::open().await;
9256+ let admin_cookie = admin(&app).await;
9257+ let workspace_id = app.workspace_id().await;
9258+ let board = izlek_core::board::load(app.store.as_ref(), &workspace_id)
9259+ .await
9260+ .unwrap()
9261+ .unwrap();
9262+ let column = board.columns[0].column.id.clone();
9263+ let task = a_task(&app, &admin_cookie, &column, "Audit me").await;
9264+ app
9265+ .post(
9266+ "/api/create_tag",
9267+ Some(&admin_cookie),
9268+ &[("name", "Shipped")],
9269+ )
9270+ .await;
9271+ let tag = {
9272+ let board = izlek_core::board::load(app.store.as_ref(), &workspace_id)
9273+ .await
9274+ .unwrap()
9275+ .unwrap();
9276+ app.store
9277+ .tags(&board.board.id)
9278+ .await
9279+ .unwrap()
9280+ .into_iter()
9281+ .find(|tag| tag.name == "Shipped")
9282+ .expect("the tag was created")
9283+ };
9284+
9285+ app
9286+ .post(
9287+ "/api/set_task_tag",
9288+ Some(&admin_cookie),
9289+ &[("task_id", &task), ("tag_id", &tag.id)],
9290+ )
9291+ .await;
9292+
9293+ let lines = app
9294+ .store
9295+ .recent_activity(
9296+ 20,
9297+ izlek_core::store::FeedPage::Newest,
9298+ izlek_core::store::Dir::Newest,
9299+ &izlek_core::store::ActivityFilter {
9300+ kind: Some("tagged".to_string()),
9301+ ..Default::default()
9302+ },
9303+ )
9304+ .await
9305+ .unwrap();
9306+ assert_eq!(lines.len(), 1, "{lines:?}");
9307+ assert_eq!(lines[0].detail, "Shipped");
9308+ assert_eq!(lines[0].actor_name.as_deref(), Some("Ada Lovelace"));
9309+}
9310+
9311+/// A profile photo set and cleared both land on the workspace trail, and the
9312+/// person whose photo it is is the actor on both lines.
9313+#[tokio::test]
9314+async fn profile_photo_changes_record_their_events() {
9315+ let app = App::open().await;
9316+ let admin_cookie = admin(&app).await;
9317+
9318+ app
9319+ .post_multipart(
9320+ "/api/profile_photo",
9321+ Some(&admin_cookie),
9322+ &[],
9323+ Some(("me.png", "image/png", &PNG)),
9324+ )
9325+ .await;
9326+ app
9327+ .post("/api/delete_profile_photo", Some(&admin_cookie), &[])
9328+ .await;
9329+
9330+ let lines = app
9331+ .store
9332+ .recent_activity(
9333+ 20,
9334+ izlek_core::store::FeedPage::Newest,
9335+ izlek_core::store::Dir::Newest,
9336+ &izlek_core::store::ActivityFilter::default(),
9337+ )
9338+ .await
9339+ .unwrap();
9340+ let saved = lines
9341+ .iter()
9342+ .find(|line| line.kind.as_str() == "photo_saved")
9343+ .expect("no photo_saved line");
9344+ assert_eq!(saved.actor_name.as_deref(), Some("Ada Lovelace"));
9345+ let removed = lines
9346+ .iter()
9347+ .find(|line| line.kind.as_str() == "photo_removed")
9348+ .expect("no photo_removed line");
9349+ assert_eq!(removed.actor_name.as_deref(), Some("Ada Lovelace"));
9350+}
9351+
9352+/// Asking for a mail-server check rides the trail too — it writes a check
9353+/// row, so the trail says who asked.
9354+#[tokio::test]
9355+async fn checking_the_sender_records_an_event() {
9356+ let app = App::open().await;
9357+ let admin_cookie = admin(&app).await;
9358+
9359+ let answer = app
9360+ .post("/api/check_sender", Some(&admin_cookie), &[])
9361+ .await;
9362+ assert_eq!(answer.status, StatusCode::SEE_OTHER);
9363+
9364+ let lines = app
9365+ .store
9366+ .recent_activity(
9367+ 20,
9368+ izlek_core::store::FeedPage::Newest,
9369+ izlek_core::store::Dir::Newest,
9370+ &izlek_core::store::ActivityFilter {
9371+ kind: Some("sender_checked".to_string()),
9372+ ..Default::default()
9373+ },
9374+ )
9375+ .await
9376+ .unwrap();
9377+ assert_eq!(lines.len(), 1, "{lines:?}");
9378+ assert_eq!(lines[0].actor_name.as_deref(), Some("Ada Lovelace"));
9379+}
9380+
9381+/// The settings pane for a given feedback query, as HTML — every assertion
9382+/// below reads the words the pane itself would show.
9383+async fn password_pane(app: &App, cookie: &str, query: &str) -> String {
9384+ let page = app
9385+ .get(
9386+ &format!("/settings?section=profile&{query}"),
9387+ Some(cookie),
9388+ )
9389+ .await;
9390+ String::from_utf8_lossy(&page.bytes).into_owned()
9391+}
9392+
9393+/// The password pane names each failure — wrong current, same as current,
9394+/// too short, looks-like-you — each with its own refusal code and its own
9395+/// one-line message in either language; a successful change lands with the
9396+/// pane's saved note about the other devices.
9397+#[tokio::test]
9398+async fn the_password_pane_names_each_failure() {
9399+ let app = App::open().await;
9400+ let admin_cookie = admin(&app).await;
9401+ let referer = "http://izlek.test/settings?section=profile";
9402+
9403+ // The current password is wrong.
9404+ let wrong = app
9405+ .post_without_script(
9406+ "/api/change_password",
9407+ Some(&admin_cookie),
9408+ referer,
9409+ &[("current", "not the password"), ("new", "a whole new passphrase")],
9410+ )
9411+ .await;
9412+ let location = wrong.location.expect("a redirect location");
9413+ assert!(
9414+ location.contains("refusal=rejected") && location.contains("on=change_password"),
9415+ "{location}"
9416+ );
9417+ assert!(
9418+ password_pane(&app, &admin_cookie, "refusal=rejected&on=change_password")
9419+ .await
9420+ .contains("The current password is wrong.")
9421+ );
9422+
9423+ // The new password is the one already in force.
9424+ let same = app
9425+ .post_without_script(
9426+ "/api/change_password",
9427+ Some(&admin_cookie),
9428+ referer,
9429+ &[
9430+ ("current", "correct horse battery staple"),
9431+ ("new", "correct horse battery staple"),
9432+ ],
9433+ )
9434+ .await;
9435+ let location = same.location.expect("a redirect location");
9436+ assert!(
9437+ location.contains("refusal=password-current"),
9438+ "{location}"
9439+ );
9440+ assert!(
9441+ password_pane(&app, &admin_cookie, "refusal=password-current&on=change_password")
9442+ .await
9443+ .contains("That's your current password.")
9444+ );
9445+
9446+ // Too short.
9447+ let short = app
9448+ .post_without_script(
9449+ "/api/change_password",
9450+ Some(&admin_cookie),
9451+ referer,
9452+ &[("current", "correct horse battery staple"), ("new", "short")],
9453+ )
9454+ .await;
9455+ let location = short.location.expect("a redirect location");
9456+ assert!(location.contains("refusal=password-short"), "{location}");
9457+ assert!(
9458+ password_pane(&app, &admin_cookie, "refusal=password-short&on=change_password")
9459+ .await
9460+ .contains("At least 10 characters.")
9461+ );
9462+
9463+ // Looks like the address the account wears.
9464+ let you = app
9465+ .post_without_script(
9466+ "/api/change_password",
9467+ Some(&admin_cookie),
9468+ referer,
9469+ &[("current", "correct horse battery staple"), ("new", "ada@izlek.sh!!")],
9470+ )
9471+ .await;
9472+ let location = you.location.expect("a redirect location");
9473+ assert!(location.contains("refusal=password-you"), "{location}");
9474+ assert!(
9475+ password_pane(&app, &admin_cookie, "refusal=password-you&on=change_password")
9476+ .await
9477+ .contains("Not your address or your name.")
9478+ );
9479+
9480+ // A change that works lands with the pane's own note, and the fresh
9481+ // cookie the answer carries is the session that reads it. (`post`
9482+ // keeps the answer's cookie; `post_without_script` models a browser
9483+ // that only follows the redirect and hands none back.)
9484+ let right = app
9485+ .post(
9486+ "/api/change_password",
9487+ Some(&admin_cookie),
9488+ &[
9489+ ("current", "correct horse battery staple"),
9490+ ("new", "brand-new-pass-99"),
9491+ ],
9492+ )
9493+ .await;
9494+ let location = right.location.clone().expect("a redirect location");
9495+ assert!(location.contains("saved=change_password"), "{location}");
9496+ let fresh = right.session.clone().expect("a fresh session cookie");
9497+ let page = app
9498+ .get("/settings?section=profile&saved=change_password", Some(&fresh))
9499+ .await;
9500+ let html = String::from_utf8_lossy(&page.bytes);
9501+ assert!(
9502+ html.contains("Password changed. Your other devices were signed out."),
9503+ "{html}"
9504+ );
9505+
9506+ // The same pane in Turkish names the same failures in Turkish.
9507+ app
9508+ .post(
9509+ "/api/save_profile",
9510+ Some(&fresh),
9511+ &[("display_name", "Ada Lovelace"), ("language", "tr")],
9512+ )
9513+ .await;
9514+ let tr = app
9515+ .get(
9516+ "/settings?section=profile&refusal=password-current&on=change_password",
9517+ Some(&fresh),
9518+ )
9519+ .await;
9520+ let tr_html = String::from_utf8_lossy(&tr.bytes);
9521+ assert!(tr_html.contains("Bu zaten mevcut parolan."), "{tr_html}");
9522+}