Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set correct avatar #155

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helpdesk/libs/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ async def dispatch(self, request, call_next):
access = id_token.get('resource_access', {})
roles = access.get(validator.client_id, {}).get('roles', [])

user = User(name=username, email=email, roles=roles, avatar=id_token.get('picture'))
user = User(name=username, email=email, roles=roles, avatar=id_token.get('picture', ''))

request.session['user'] = user.json()
break
Expand Down
4 changes: 2 additions & 2 deletions helpdesk/models/user.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8

import logging
from typing import List
from typing import List, Optional
from pydantic import BaseModel, validator


Expand All @@ -14,7 +14,7 @@ class User(BaseModel):
name: str
email: str
roles: List[str] = []
avatar: str = None
avatar: Optional[str] = None

@property
def is_authenticated(self) -> bool:
Expand Down
Loading