Skip to content

Commit

Permalink
set correct avatar (#155)
Browse files Browse the repository at this point in the history
* set correct avatar

* make avatar optional
  • Loading branch information
LeoQuote authored Sep 14, 2023
1 parent 6a11290 commit 8f82c1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
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

0 comments on commit 8f82c1f

Please sign in to comment.