mirror of
https://github.com/bec-project/bec_atlas.git
synced 2025-07-14 07:01:48 +02:00
fix(auth): removed groups from token
This commit is contained in:
@ -91,9 +91,8 @@ def get_current_user_sync(token: str) -> UserInfo:
|
||||
)
|
||||
try:
|
||||
payload = decode_token(token)
|
||||
groups = payload.get("groups")
|
||||
email = payload.get("email")
|
||||
if not groups or not email:
|
||||
if not email:
|
||||
raise credentials_exception
|
||||
except Exception as exc:
|
||||
raise credentials_exception from exc
|
||||
|
@ -60,7 +60,7 @@ class UserRouter(BaseRouter):
|
||||
user = self._get_user(user_login)
|
||||
if user is None:
|
||||
raise HTTPException(status_code=401, detail="User not found or password is incorrect")
|
||||
token = create_access_token(data={"groups": list(user.groups), "email": user.email})
|
||||
token = create_access_token(data={"email": user.email})
|
||||
response.set_cookie(key="access_token", value=token, httponly=True, secure=self.use_ssl)
|
||||
return token
|
||||
|
||||
|
Reference in New Issue
Block a user