add login by email + feature flag

This commit is contained in:
mcalinghee
2025-03-27 18:00:48 +01:00
parent 8f42fa028b
commit 2fe4752aa4
20 changed files with 188 additions and 14 deletions

View File

@@ -47,6 +47,7 @@ impl SiteConfigExt for SiteConfig {
password_registration: self.password_registration_enabled,
password_login: self.password_login_enabled,
account_recovery: self.account_recovery_allowed,
login_with_email_allowed: self.login_with_email_allowed,
}
}
}

View File

@@ -12,6 +12,7 @@ use minijinja::{
};
/// Site features information.
#[allow(clippy::struct_excessive_bools)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct SiteFeatures {
/// Whether local password-based registration is enabled.
@@ -22,6 +23,9 @@ pub struct SiteFeatures {
/// Whether email-based account recovery is enabled.
pub account_recovery: bool,
/// Whether users can log in with their email address.
pub login_with_email_allowed: bool,
}
impl Object for SiteFeatures {
@@ -30,6 +34,7 @@ impl Object for SiteFeatures {
"password_registration" => Some(Value::from(self.password_registration)),
"password_login" => Some(Value::from(self.password_login)),
"account_recovery" => Some(Value::from(self.account_recovery)),
"login_with_email_allowed" => Some(Value::from(self.login_with_email_allowed)),
_ => None,
}
}
@@ -39,6 +44,7 @@ impl Object for SiteFeatures {
"password_registration",
"password_login",
"account_recovery",
"login_with_email_allowed",
])
}
}

View File

@@ -487,6 +487,7 @@ mod tests {
password_login: true,
password_registration: true,
account_recovery: true,
login_with_email_allowed: true,
};
let vite_manifest_path =
Utf8Path::new(env!("CARGO_MANIFEST_DIR")).join("../../frontend/dist/manifest.json");