oauth2
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user