feat: complete Epic 1 production foundation

This commit is contained in:
bsodfather committed 2026-08-25 01:24:11 +03:00
1 parent 767428436d
commit 182bde8ac0
298 files changed
+35711 -5291

No files matched your search

@@ -5,7 +5,7 @@ use crank_core::{
use crank_registry::PostgresRegistry;
use tracing::debug;
use crate::hashing::verify_password;
use crate::hashing::{hash_password, verify_password};
#[derive(Clone)]
pub struct PasswordIdentityProvider {
@@ -36,15 +36,23 @@ impl IdentityProvider for PasswordIdentityProvider {
&self,
payload: crank_core::LoginPayload,
) -> Result<LoginOutcome, IdentityError> {
let user = self
let Some(user) = self
.registry
.get_auth_user_by_email(&payload.email)
.await
.map_err(|error| IdentityError::Internal(error.to_string()))?
.ok_or(IdentityError::BadCredentials)?;
else {
let _ = hash_password(&payload.password, &self.password_pepper);
return Err(IdentityError::BadCredentials);
};
if user.user.status != crank_core::UserStatus::Active {
return Err(IdentityError::AccountDisabled);
let _ = verify_password(
&payload.password,
&self.password_pepper,
&user.password_hash,
);
return Err(IdentityError::BadCredentials);
}
if !verify_password(