Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
V
vidai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SexHackMe
vidai
Commits
eb0a9847
Commit
eb0a9847
authored
Oct 08, 2025
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix avatar display to show standard user icon when no Gravatar exists
parent
e07758bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
base.html
templates/base.html
+6
-1
utils.py
vidai/utils.py
+1
-1
No files found.
templates/base.html
View file @
eb0a9847
...
@@ -16,7 +16,9 @@
...
@@ -16,7 +16,9 @@
.user-menu
{
display
:
flex
;
align-items
:
center
;
gap
:
1rem
;
position
:
relative
;
}
.user-menu
{
display
:
flex
;
align-items
:
center
;
gap
:
1rem
;
position
:
relative
;
}
.user-icon
{
cursor
:
pointer
;
padding
:
0.5rem
;
border-radius
:
8px
;
background
:
#f8fafc
;
transition
:
background
0.2s
;
display
:
flex
;
align-items
:
center
;
gap
:
0.5rem
;
}
.user-icon
{
cursor
:
pointer
;
padding
:
0.5rem
;
border-radius
:
8px
;
background
:
#f8fafc
;
transition
:
background
0.2s
;
display
:
flex
;
align-items
:
center
;
gap
:
0.5rem
;
}
.user-icon
:hover
{
background
:
#e2e8f0
;
}
.user-icon
:hover
{
background
:
#e2e8f0
;
}
.user-avatar-container
{
width
:
32px
;
height
:
32px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
.user-avatar
{
width
:
32px
;
height
:
32px
;
border-radius
:
50%
;
}
.user-avatar
{
width
:
32px
;
height
:
32px
;
border-radius
:
50%
;
}
.user-icon-fallback
{
font-size
:
1.2rem
;
color
:
#64748b
;
}
.user-name
{
font-weight
:
500
;
color
:
#64748b
;
}
.user-name
{
font-weight
:
500
;
color
:
#64748b
;
}
.user-dropdown
{
display
:
none
;
position
:
absolute
;
top
:
100%
;
right
:
0
;
background
:
white
;
min-width
:
200px
;
box-shadow
:
0
4px
12px
rgba
(
0
,
0
,
0
,
0.15
);
border-radius
:
8px
;
z-index
:
1000
;
}
.user-dropdown
{
display
:
none
;
position
:
absolute
;
top
:
100%
;
right
:
0
;
background
:
white
;
min-width
:
200px
;
box-shadow
:
0
4px
12px
rgba
(
0
,
0
,
0
,
0.15
);
border-radius
:
8px
;
z-index
:
1000
;
}
.user-dropdown
a
{
display
:
block
;
padding
:
0.75rem
1rem
;
text-decoration
:
none
;
color
:
#374151
;
border-bottom
:
1px
solid
#f1f5f9
;
}
.user-dropdown
a
{
display
:
block
;
padding
:
0.75rem
1rem
;
text-decoration
:
none
;
color
:
#374151
;
border-bottom
:
1px
solid
#f1f5f9
;
}
...
@@ -112,7 +114,10 @@
...
@@ -112,7 +114,10 @@
</nav>
</nav>
<div
class=
"user-menu"
>
<div
class=
"user-menu"
>
<div
class=
"user-icon"
onclick=
"toggleUserMenu()"
>
<div
class=
"user-icon"
onclick=
"toggleUserMenu()"
>
<img
src=
"{{ user.avatar_url }}"
alt=
"Avatar"
class=
"user-avatar"
>
<div
class=
"user-avatar-container"
>
<img
src=
"{{ user.avatar_url }}"
alt=
"Avatar"
class=
"user-avatar"
onerror=
"this.style.display='none'; this.parentNode.querySelector('.user-icon-fallback').style.display='block';"
>
<i
class=
"fas fa-user user-icon-fallback"
style=
"display: none;"
></i>
</div>
<span
class=
"user-name"
>
{{ user.username }}
</span>
<span
class=
"user-name"
>
{{ user.username }}
</span>
</div>
</div>
<div
id=
"userDropdown"
class=
"user-dropdown"
>
<div
id=
"userDropdown"
class=
"user-dropdown"
>
...
...
vidai/utils.py
View file @
eb0a9847
...
@@ -30,7 +30,7 @@ def get_current_user_session():
...
@@ -30,7 +30,7 @@ def get_current_user_session():
if
user
and
user
.
get
(
'email'
):
if
user
and
user
.
get
(
'email'
):
import
hashlib
import
hashlib
email_hash
=
hashlib
.
md5
(
user
[
'email'
]
.
lower
()
.
encode
())
.
hexdigest
()
email_hash
=
hashlib
.
md5
(
user
[
'email'
]
.
lower
()
.
encode
())
.
hexdigest
()
user
[
'gravatar_url'
]
=
f
"https://www.gravatar.com/avatar/{email_hash}?s=32&d=
mp
"
user
[
'gravatar_url'
]
=
f
"https://www.gravatar.com/avatar/{email_hash}?s=32&d=
404
"
# If custom avatar, use that instead
# If custom avatar, use that instead
if
user
.
get
(
'avatar'
):
if
user
.
get
(
'avatar'
):
user
[
'avatar_url'
]
=
f
"/static/avatars/{user['avatar']}"
user
[
'avatar_url'
]
=
f
"/static/avatars/{user['avatar']}"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment