style: rustfmt
This commit is contained in:
@@ -17,14 +17,10 @@ pub struct LoginResult {
|
||||
pub async fn execute(deps: &LoginDeps, cmd: LoginCommand) -> Result<LoginResult, DomainError> {
|
||||
let email = Email::new(&cmd.email)?;
|
||||
|
||||
let user = deps
|
||||
.user_repo
|
||||
.find_by_email(&email)
|
||||
.await?
|
||||
.ok_or_else(|| {
|
||||
tracing::warn!(email = cmd.email, "login attempt with unknown email");
|
||||
DomainError::Unauthorized("invalid credentials".into())
|
||||
})?;
|
||||
let user = deps.user_repo.find_by_email(&email).await?.ok_or_else(|| {
|
||||
tracing::warn!(email = cmd.email, "login attempt with unknown email");
|
||||
DomainError::Unauthorized("invalid credentials".into())
|
||||
})?;
|
||||
|
||||
let valid = deps
|
||||
.password_hasher
|
||||
|
||||
@@ -8,9 +8,7 @@ use super::deps::RegisterDeps;
|
||||
pub async fn execute(deps: &RegisterDeps, cmd: RegisterCommand) -> Result<(), DomainError> {
|
||||
if !deps.allow_registration {
|
||||
tracing::warn!("registration attempt while disabled");
|
||||
return Err(DomainError::Unauthorized(
|
||||
"registration is disabled".into(),
|
||||
));
|
||||
return Err(DomainError::Unauthorized("registration is disabled".into()));
|
||||
}
|
||||
|
||||
let password = Password::new(&cmd.password)?;
|
||||
|
||||
Reference in New Issue
Block a user