mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04: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)
|
photo = generateAvatarURL(profile.username, profile.emails[0], bigger)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
|
if (profile.emails && profile.emails.length > 0) {
|
||||||
|
photo = generateAvatarURL(profile.username, profile.emails[0])
|
||||||
|
break
|
||||||
|
}
|
||||||
photo = generateAvatarURL(profile.username)
|
photo = generateAvatarURL(profile.username)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ function parseProfile (data) {
|
||||||
id: id || username,
|
id: id || username,
|
||||||
username: username,
|
username: username,
|
||||||
displayName: displayName,
|
displayName: displayName,
|
||||||
email: email
|
emails: email ? [email] : []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue