Fix GPG email checking to be case insensitive (#1988)

This commit is contained in:
Lauris BH 2017-06-17 13:56:40 +03:00 committed by Lunny Xiao
parent 6678593b3c
commit 1a906f800d
2 changed files with 41 additions and 2 deletions

View file

@ -211,9 +211,9 @@ func parseGPGKey(ownerID int64, e *openpgp.Entity) (*GPGKey, error) {
emails := make([]*EmailAddress, len(e.Identities))
n := 0
for _, ident := range e.Identities {
email := strings.ToLower(strings.TrimSpace(ident.UserId.Email))
for _, e := range userEmails {
if e.Email == ident.UserId.Email && e.IsActivated {
if e.Email == email && e.IsActivated {
emails[n] = e
break
}