Migrate from sqlmodel to pure sqlalchemy
This commit is contained in:
@ -6,9 +6,11 @@ from typing import cast, Any
|
||||
|
||||
import bcrypt
|
||||
import jwt
|
||||
from sqlmodel import Session, select
|
||||
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session
|
||||
from sshecret_admin.core.settings import AdminServerSettings
|
||||
|
||||
from .models import User, TokenData
|
||||
from .exceptions import AuthenticationFailedError
|
||||
|
||||
@ -72,7 +74,7 @@ def check_password(plain_password: str, hashed_password: str) -> None:
|
||||
|
||||
def authenticate_user(session: Session, username: str, password: str) -> User | None:
|
||||
"""Authenticate user."""
|
||||
user = session.exec(select(User).where(User.username == username)).first()
|
||||
user = session.scalars(select(User).where(User.username == username)).first()
|
||||
if not user:
|
||||
return None
|
||||
if not verify_password(password, user.hashed_password):
|
||||
|
||||
Reference in New Issue
Block a user