Add optimization branch updates
This commit is contained in:
@@ -6,6 +6,7 @@ from app.db.session import get_db
|
||||
from app.models.org import User
|
||||
from app.schemas.database import (
|
||||
AuthChangePasswordRequest,
|
||||
AuthLoginKeyResponse,
|
||||
AuthLoginRequest,
|
||||
AuthResetPasswordRequest,
|
||||
AuthSession,
|
||||
@@ -19,13 +20,20 @@ from app.services.auth import (
|
||||
require_system_admin,
|
||||
verify_password,
|
||||
)
|
||||
from app.services.login_crypto import decrypt_login_password, get_login_public_key
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/login-key", response_model=AuthLoginKeyResponse)
|
||||
def login_key() -> AuthLoginKeyResponse:
|
||||
return AuthLoginKeyResponse(**get_login_public_key().__dict__)
|
||||
|
||||
|
||||
@router.post("/login", response_model=AuthSession)
|
||||
def login(payload: AuthLoginRequest, db: Session = Depends(get_db)) -> AuthSession:
|
||||
return login_with_password(db, payload.username, payload.password)
|
||||
password = decrypt_login_password(payload.password_ciphertext, payload.login_key_id)
|
||||
return login_with_password(db, payload.username, password)
|
||||
|
||||
|
||||
@router.get("/me", response_model=LoginUser)
|
||||
|
||||
Reference in New Issue
Block a user