fix: move ownership into auth fn

This commit is contained in:
Per Stark
2025-03-21 08:01:04 +01:00
parent b4cf020f36
commit 42e63600a1
4 changed files with 8 additions and 11 deletions

View File

@@ -122,8 +122,8 @@ impl User {
}
pub async fn authenticate(
email: String,
password: String,
email: &str,
password: &str,
db: &SurrealDbClient,
) -> Result<Self, AppError> {
let user: Option<User> = db
@@ -133,8 +133,8 @@ impl User {
WHERE email = $email
AND crypto::argon2::compare(password, $password)",
)
.bind(("email", email))
.bind(("password", password))
.bind(("email", email.to_owned()))
.bind(("password", password.to_owned()))
.await?
.take(0)?;
user.ok_or(AppError::Auth("User failed to authenticate".into()))