This commit is contained in:
arrelin
2026-01-17 10:15:44 +03:00
parent 564adac629
commit a4b06fb057
26 changed files with 1542 additions and 346 deletions

View File

@@ -20,7 +20,7 @@ impl AuthUser for user::Model {
}
fn session_auth_hash(&self) -> &[u8] {
self.password_hash.as_bytes()
self.password_hash.as_deref().unwrap_or("oauth").as_bytes()
}
}
@@ -56,7 +56,8 @@ impl AuthnBackend for AuthBackend {
.await?;
if let Some(user) = user {
let parsed_hash = PasswordHash::new(&user.password_hash)
let password_hash = user.password_hash.as_ref().ok_or(Error::InvalidCredentials)?;
let parsed_hash = PasswordHash::new(password_hash)
.map_err(|_| Error::PasswordHash)?;
let is_valid = Argon2::default()