mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-04-17 14:38:52 +00:00
Use libravatar image if email address is defined
We use the attribute `emails` (plural) for email addresses with other auth providers like LDAP or SAML. In case of OAuth2 we used the attribute `email` (singular) which resulted in problems. Furthermore the OAuth2 strategy fell into the default fallback of the provider switch statement. This statement did not check email addresses but did generate the letter-avatar instantly. Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
fe98f63149
commit
6e983ba5dc
2 changed files with 5 additions and 1 deletions
|
@ -133,6 +133,10 @@ module.exports = function (sequelize, DataTypes) {
|
|||
photo = generateAvatarURL(profile.username, profile.emails[0], bigger)
|
||||
break
|
||||
default:
|
||||
if (profile.emails && profile.emails.length > 0) {
|
||||
photo = generateAvatarURL(profile.username, profile.emails[0])
|
||||
break
|
||||
}
|
||||
photo = generateAvatarURL(profile.username)
|
||||
break
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ function parseProfile (data) {
|
|||
id: id || username,
|
||||
username: username,
|
||||
displayName: displayName,
|
||||
email: email
|
||||
emails: email ? [email] : []
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue