- add: session_id to the validate token response
- add: session_id to the jwt generated token
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use crate::database_client::DatabaseClientTrait;
|
||||
use crate::database::GetUserResponse;
|
||||
|
||||
use argon2::{
|
||||
password_hash::{
|
||||
@@ -20,11 +21,11 @@ pub fn verify_password(password: &str, hash: &str) -> bool {
|
||||
}
|
||||
|
||||
pub async fn verify_user<T: DatabaseClientTrait>(mut db_client: T,
|
||||
username: &str, password: &str) -> Option<String> {
|
||||
username: &str, password: &str) -> Option<GetUserResponse> {
|
||||
let user = db_client.get_user_by_username(username).await.ok()?;
|
||||
|
||||
if verify_password(password, &user.hashed_password) {
|
||||
Some(user.user_id.to_string())
|
||||
Some(user)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user