small fixes

This commit is contained in:
Georges-Antoine Assi
2024-01-17 21:22:07 -05:00
parent c3960d78f9
commit eaad1f2353
4 changed files with 7 additions and 7 deletions

View File

@@ -47,7 +47,7 @@ class AuthHandler:
def __init__(self) -> None:
self.pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
def _verify_password(self, plain_password, hashed_password):
def verify_password(self, plain_password, hashed_password):
return self.pwd_context.verify(plain_password, hashed_password)
def get_password_hash(self, password):
@@ -67,7 +67,7 @@ class AuthHandler:
if not user:
return None
if not self._verify_password(password, user.hashed_password):
if not self.verify_password(password, user.hashed_password):
return None
return user

View File

@@ -10,8 +10,8 @@ from handler.redis_handler import cache
def test_verify_password():
assert authh._verify_password("password", authh.get_password_hash("password"))
assert not authh._verify_password("password", authh.get_password_hash("notpassword"))
assert authh.verify_password("password", authh.get_password_hash("password"))
assert not authh.verify_password("password", authh.get_password_hash("notpassword"))
def test_authenticate_user(admin_user):
@@ -94,7 +94,7 @@ def test_create_default_admin_user():
user = dbuserh.get_user_by_username("test_admin")
assert user.username == "test_admin"
assert authh._verify_password("test_admin_password", user.hashed_password)
assert authh.verify_password("test_admin_password", user.hashed_password)
users = dbuserh.get_users()
assert len(users) == 1

View File

@@ -7,7 +7,7 @@ export type { AddRomsResponse } from './models/AddRomsResponse';
export type { Body_add_roms_roms_post } from './models/Body_add_roms_roms_post';
export type { Body_add_saves_saves_post } from './models/Body_add_saves_saves_post';
export type { Body_add_states_states_post } from './models/Body_add_states_states_post';
export type { Body_token_token_get } from './models/Body_token_token_get';
export type { Body_token_token_post } from './models/Body_token_token_post';
export type { Body_update_rom_roms__id__put } from './models/Body_update_rom_roms__id__put';
export type { Body_update_user_users__id__put } from './models/Body_update_user_users__id__put';
export type { ConfigResponse } from './models/ConfigResponse';

View File

@@ -3,7 +3,7 @@
/* tslint:disable */
/* eslint-disable */
export type Body_token_token_get = {
export type Body_token_token_post = {
grant_type?: string;
scope?: string;
username?: (string | null);