diff --git a/crates/izlek-core/src/auth.rs b/crates/izlek-core/src/auth.rs
index 7abe465..f18c7e7 100644
--- a/crates/izlek-core/src/auth.rs
+++ b/crates/izlek-core/src/auth.rs
@@ -187,6 +187,17 @@ pub fn check_password(
mod tests {
use super::*;
+ /// The exact report: an invited member typed `abcde*abcde` and was told it
+ /// looked like his address or his name. It is eleven characters and shares
+ /// nothing with either.
+ #[test]
+ fn a_password_sharing_nothing_with_the_person_is_accepted() {
+ assert_eq!(
+ check_password("abcde*abcde", "burakboduroglu0@gmail.com", "Burak Boduroğlu"),
+ Ok(())
+ );
+ }
+
#[test]
fn a_password_round_trips_and_a_wrong_one_does_not() {
let phc = hash_password("correct horse battery").unwrap();
diff --git a/crates/izlek-web/src/i18n.rs b/crates/izlek-web/src/i18n.rs
index 3e615d6..3649499 100644
--- a/crates/izlek-web/src/i18n.rs
+++ b/crates/izlek-web/src/i18n.rs
@@ -155,6 +155,7 @@ pub enum Key {
ActiveStatus,
You,
ResendMail,
+ SendSigninLink,
RoleMemberOption,
RoleViewerOption,
RoleAdminOption,
@@ -592,6 +593,8 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
(You, Tr) => "sen",
(ResendMail, En) => "Resend mail",
(ResendMail, Tr) => "Postayı yeniden gönder",
+ (SendSigninLink, En) => "Send a sign-in link",
+ (SendSigninLink, Tr) => "Giriş bağlantısı gönder",
(RoleMemberOption, En) => "Member",
(RoleMemberOption, Tr) => "Üye",
(RoleViewerOption, En) => "Viewer",
diff --git a/crates/izlek-web/src/settings.rs b/crates/izlek-web/src/settings.rs
index b80e2da..66a04b4 100644
--- a/crates/izlek-web/src/settings.rs
+++ b/crates/izlek-web/src/settings.rs
@@ -1583,11 +1583,29 @@ async fn settings_page(cx: &Cx) -> Result {
(account)
- if !member.has_password {
-
+ // The control is here for everyone an admin could
+ // send a link to, which is everyone. It used to be
+ // drawn only for a member who had never set a
+ // password — so the one person who needs a fresh
+ // link, the one who forgot theirs, was the one
+ // person the button was hidden from, and the
+ // workspace had no way back in for them at all.
+ // `resend_invitation` never cared: it mints a link
+ // for any member of this workspace. Not for
+ // yourself: your own password is in Your profile,
+ // and mailing yourself a link to it is a longer
+ // way round to the same pane.
+ if !member.is_you {
+
}
|
diff --git a/crates/izlek-web/tests/http.rs b/crates/izlek-web/tests/http.rs
index 54e9e0a..d82038e 100644
--- a/crates/izlek-web/tests/http.rs
+++ b/crates/izlek-web/tests/http.rs
@@ -536,6 +536,68 @@ async fn queued_join_token(app: &App, email: &str) -> String {
}
/// Invites someone in the given role and signs them in, returning their cookie.
+#[tokio::test]
+async fn an_admin_can_send_a_signin_link_to_somebody_who_already_has_a_password() {
+ // Somebody who forgets their password is the person who needs a fresh
+ // link, and they were the one person the button was hidden from: it was
+ // drawn only while `!has_password`. There was no other way back into the
+ // workspace — no reset anywhere — so a forgotten password was the end of
+ // that account.
+ let app = App::open().await;
+ let admin_cookie = admin(&app).await;
+ // `invited` redeems the link, so this member has a password.
+ let _member = invited(&app, &admin_cookie, "emre@izlek.sh", "Emre", Role::Member).await;
+
+ let page = app.get("/settings?section=members", Some(&admin_cookie)).await;
+ let page = String::from_utf8_lossy(&page.bytes);
+ assert!(
+ page.contains("Send a sign-in link"),
+ "no way to send a link to a member who has a password: {page}"
+ );
+
+ // And the link it sends actually works: a new password, set on the
+ // strength of it.
+ let workspace_id = app.workspace_id().await;
+ let member_id = app
+ .store
+ .user_by_email(&workspace_id, "emre@izlek.sh")
+ .await
+ .unwrap()
+ .expect("the member is not in the store")
+ .id;
+ let answer = app
+ .post(
+ "/api/resend_link",
+ Some(&admin_cookie),
+ &[("user_id", &member_id)],
+ )
+ .await;
+ assert_eq!(answer.status, StatusCode::SEE_OTHER, "{}", answer.body);
+
+ let token = queued_join_token(&app, "emre@izlek.sh").await;
+ let answer = app
+ .post(
+ "/api/redeem_link",
+ None,
+ &[("token", &token), ("password", "second thoughts about oats")],
+ )
+ .await;
+ assert_eq!(answer.status, StatusCode::SEE_OTHER, "{}", answer.body);
+ assert_eq!(answer.body, "null", "the reissued link was refused");
+
+ let back = app
+ .post(
+ "/api/sign_in",
+ None,
+ &[
+ ("email", "emre@izlek.sh"),
+ ("password", "second thoughts about oats"),
+ ],
+ )
+ .await;
+ assert!(back.session.is_some(), "the new password does not sign in: {}", back.body);
+}
+
#[tokio::test]
async fn a_password_may_be_made_of_punctuation() {
// An invited member reported "it would not accept the *". Nothing in the