Skip to content
Snippets Groups Projects
Commit 6a531ff8 authored by Tim Repke's avatar Tim Repke
Browse files

improve security handling and add token handling options

parent 2f46aa2f
No related branches found
No related tags found
1 merge request!41Master
Pipeline #1444 failed
......@@ -78,11 +78,11 @@ async def save_user(user: UserInDBModel | UserModel, current_user: UserModel = D
@router.put('/my-details', response_model=str)
async def save_user_self(user: UserInDBModel | UserModel,
current_user: UserModel = Depends(get_current_active_user)):
if current_user.user_id != user.user_id:
if str(current_user.user_id) != str(user.user_id):
raise UserPermissionError('This is not you!')
async with db_engine.session() as session: # type: AsyncSession
user_db: User | None = (await session.scalars(select(User).where(User.user_id == user.user_id))).one_or_none()
user_db: User | None = (await session.scalars(select(User).where(User.user_id == str(user.user_id)))).one_or_none()
password: str | None = getattr(user, 'password', None)
if password is not None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment