fix: allow dots in usernames; BCrypt fallback in password verifier for v1 migrations
This commit is contained in:
@@ -13,4 +13,5 @@ tokio = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
jsonwebtoken = "9"
|
||||
argon2 = "0.5"
|
||||
bcrypt = "0.15"
|
||||
rand = "0.8"
|
||||
|
||||
@@ -76,6 +76,10 @@ impl PasswordHasher for Argon2PasswordHasher {
|
||||
}
|
||||
|
||||
async fn verify(&self, plain: &str, hash: &PasswordHash) -> Result<bool, DomainError> {
|
||||
if hash.0.starts_with("$2") {
|
||||
return bcrypt::verify(plain, &hash.0)
|
||||
.map_err(|e| DomainError::Internal(e.to_string()));
|
||||
}
|
||||
use argon2::{password_hash::PasswordHash as ArgonHash, Argon2, PasswordVerifier};
|
||||
let parsed = ArgonHash::new(&hash.0).map_err(|e| DomainError::Internal(e.to_string()))?;
|
||||
Ok(Argon2::default()
|
||||
|
||||
Reference in New Issue
Block a user