Add bff
This commit is contained in:
@@ -1 +0,0 @@
|
||||
pub struct CookieService {}
|
@@ -1,2 +1 @@
|
||||
pub mod cookie_service;
|
||||
pub mod users_service;
|
||||
|
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
use anyhow::anyhow;
|
||||
use argon2::{password_hash::SaltString, Argon2, PasswordHash, PasswordHasher, PasswordVerifier};
|
||||
use rand_core::OsRng;
|
||||
@@ -36,7 +34,7 @@ impl UserService {
|
||||
&self,
|
||||
username: String,
|
||||
password: String,
|
||||
) -> anyhow::Result<Option<()>> {
|
||||
) -> anyhow::Result<Option<String>> {
|
||||
let rec = sqlx::query!(
|
||||
r#"
|
||||
SELECT * from users
|
||||
@@ -49,7 +47,7 @@ impl UserService {
|
||||
|
||||
match rec {
|
||||
Some(user) => match self.validate_password(password, user.password_hash)? {
|
||||
true => Ok(Some(())),
|
||||
true => Ok(Some(user.id.to_string())),
|
||||
false => Ok(None),
|
||||
},
|
||||
None => Ok(None),
|
||||
|
Reference in New Issue
Block a user