appstore: try to fix login for people with no avatar x_x

This commit is contained in:
Alexandre Aubin 2023-09-26 13:41:40 +02:00
parent 8659c2f089
commit f7f57ebb4a
2 changed files with 8 additions and 4 deletions

View file

@ -416,7 +416,7 @@ def sso_login_callback():
session["user"] = {
"id": user_data["external_id"][0],
"username": user_data["username"][0],
"avatar_url": user_data["avatar_url"][0],
"avatar_url": user_data["avatar_url"][0] if "avatar_url" in user_data else "",
}
if uri_to_redirect_to_after_login:

View file

@ -60,15 +60,17 @@
type="button"
class="group flex shrink-0 items-center rounded-md transition"
>
{% if user['avatar_url'] %}
<img
alt="Avatar"
src="{{ user['avatar_url'] }}"
class="h-10 w-10 rounded-full object-cover"
>
<p class="ms-2 text-left text-xs inline-block">
{% endif %}
<p class="pt-3 ms-2 text-left text-xs inline-block">
<strong class="block font-medium">{{ user['username'] }}</strong>
</p>
<i class="fa fa-caret-down fa-fw" aria-hidden="true"></i>
<i class="pt-3 fa fa-caret-down fa-fw" aria-hidden="true"></i>
</button>
<div
id="userMenu"
@ -156,12 +158,14 @@
class="block rounded-md px-4 py-2 text-sm text-gray-500"
role="menuitem"
>
{% if user['avatar_url'] %}
<img
alt="Avatar"
src="{{ user['avatar_url'] }}"
class="h-10 w-10 rounded-full object-cover inline-block"
>
<p class="ms-2 inline-block text-left">
{% endif %}
<p class="pt-2 ms-2 inline-block text-left">
<strong class="font-medium">{{ user['username'] }}</strong>
</p>
</span>