Prepare to use another auth code
This commit is contained in:
parent
30140f058f
commit
52d9ad3399
@ -19,8 +19,10 @@ class User(BaseModel):
|
||||
phone: Union[int, None] = None
|
||||
email: str
|
||||
name: Union[str, None] = None
|
||||
surname: Union[str, None] = None
|
||||
surname: str
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
class UserInDB(User):
|
||||
password: str
|
||||
|
@ -42,7 +42,7 @@ def get_password_hash(password):
|
||||
|
||||
|
||||
# проблема здесь
|
||||
def get_user(db: SessionLocal, email: str, response_model=User):
|
||||
def get_user(db: SessionLocal, email: str):
|
||||
user_with_required_email = db.query(UserDatabase).filter(UserDatabase.email == email).one()
|
||||
if user_with_required_email:
|
||||
return UserInDB(user_with_required_email)
|
||||
@ -69,7 +69,7 @@ def create_access_token(data: dict, expires_delta: Union[timedelta, None] = None
|
||||
return encoded_jwt
|
||||
|
||||
|
||||
async def get_current_user(db: SessionLocal, token: Annotated[str, Depends(oauth2_scheme)], response_model=User):
|
||||
async def get_current_user(db: SessionLocal, token: Annotated[str, Depends(oauth2_scheme)]):
|
||||
credentials_exception = HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail="Could not validate credentials",
|
||||
|
Loading…
x
Reference in New Issue
Block a user