Fixing bugs with returning status codes

main
Jan Beníček 2024-11-08 05:52:58 +01:00
parent 70ae68b951
commit 0424f1323c
1 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
from src.auth.schemas import Login_request, Login_reply, verify_2FA
from src.user.models import User
from src.auth.models import Auth_token_valid, Auth_2fa_code
from src.auth.pwd import password_hash, password_verify
from src.base.pwd import password_hash, password_verify
from src.auth.static import Types_2FA
from src.base.jwt import jwt_encode, jwt_decode, jwt_verify_by_jti
from src.base.utils import random_string
@ -72,7 +72,7 @@ def request_2fa(db: Session, request: Request) -> Login_reply:
return _return_2fa_request(db=db, user=refresh_token_db.user) # return detail of 2FA
except:
raise HTTPException(status_code=HTTP_401_UNAUTHORIZED, detail="Unauthorized") # If error return unauthorized
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Unauthorized") # If error return unauthorized
@ -102,5 +102,5 @@ def verify_2fa(otp_code: str, db: Session, request: Request, response: Response)
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="2FA code no match")
except:
raise HTTPException(status_code=HTTP_401_UNAUTHORIZED, detail="Unauthorized") # If error return unauthorized
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Unauthorized") # If error return unauthorized