feat: add email verification & password reset link

This commit is contained in:
Henri Bourcereau 2026-05-03 21:31:36 +02:00
parent 440bf12c43
commit d24f850882
20 changed files with 928 additions and 62 deletions

View file

@ -30,7 +30,8 @@ impl AuthUser for db::User {
#[derive(Clone)]
pub struct Credentials {
pub username: String,
/// Accepts either a username or an email address.
pub login: String,
pub password: String,
}
@ -66,7 +67,7 @@ impl AuthnBackend for AuthBackend {
&self,
creds: Self::Credentials,
) -> Result<Option<Self::User>, Self::Error> {
let Some(user) = db::get_user_by_username(&self.pool, &creds.username).await? else {
let Some(user) = db::get_user_by_username_or_email(&self.pool, &creds.login).await? else {
return Ok(None);
};