goauthentik / authentik

The authentication glue you need.
https://goauthentik.io
Other
13.1k stars 872 forks source link

custom avatar url: fallback not working #10100

Closed konradmoesch closed 1 month ago

konradmoesch commented 3 months ago

Describe the bug I have configured libravatar as custom avatar source, gravatar and initials as fallback. The config line looks like this: https://seccdn.libravatar.org/avatar/%(mail_hash)s?d=404,gravatar,initials

If no libravatar is found (404 returned), no fallback to gravatar or initials is done. Instead, the "error image" is shown (see screenshot below)

To Reproduce Steps to reproduce the behavior:

  1. Add custom avatar url (e.g. my example from above, any other would work, too, I believe)
  2. Try logging in with a user that has no avatar under that url
  3. Observe wrong avatar (e.g. in login flow, top right corner of /if/user or bottom left corner of /if/admin

Expected behavior On a 404 (or maybe even any other error code), the next available fallback should be shown

Screenshots grafik I would expect "TU" as initials in this case.

Version and Deployment:

Additional context The url loaded in my example (testuser without a mail address) is https://seccdn.libravatar.org/avatar/d41d8cd98f00b204e9800998ecf8427e?d=404, which returns a 404

konradmoesch commented 3 months ago

I think this can be fixed by improving authentik/lib/avatars.py. . The mode_url could be improved to work similar to mode_gravatar (check for 404, cache result and return None if needed). This seems like a pretty simple change. If I find time to set up a dev env, I might try it myself.

authentik-automation[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

konradmoesch commented 1 month ago

Still relevant, pr is still open. Could someone reopen this? Thanks