- update: database client to implement a database trait so we can mock it out
- update unit tests - add: database client mock
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::database_client::DatabaseClient;
|
||||
use crate::database_client::{DatabaseClient, DatabaseClientTrait};
|
||||
|
||||
use argon2::{
|
||||
password_hash::{
|
||||
@@ -19,7 +19,7 @@ pub fn verify_password(password: &str, hash: &str) -> bool {
|
||||
Argon2::default().verify_password(password.as_bytes(), &parsed_hash).is_ok()
|
||||
}
|
||||
|
||||
pub async fn verify_user(mut db_client: DatabaseClient,
|
||||
pub async fn verify_user<T: DatabaseClientTrait>(mut db_client: T,
|
||||
username: &str, password: &str) -> Option<String> {
|
||||
// Placeholder: Replace with a gRPC call to the Database Service
|
||||
let user = db_client.get_user_by_username(username).await.ok()?;
|
||||
|
||||
Reference in New Issue
Block a user