storage/static.go: storage backend should not explicitly lower-case email ids.

This commit is contained in:
rithu john
2017-08-23 16:43:01 -07:00
parent e40c01ec39
commit fd4f57b5f3
4 changed files with 48 additions and 20 deletions

View File

@@ -128,12 +128,12 @@ func (s *memStorage) CreateAuthRequest(a storage.AuthRequest) (err error) {
}
func (s *memStorage) CreatePassword(p storage.Password) (err error) {
p.Email = strings.ToLower(p.Email)
lowerEmail := strings.ToLower(p.Email)
s.tx(func() {
if _, ok := s.passwords[p.Email]; ok {
if _, ok := s.passwords[lowerEmail]; ok {
err = storage.ErrAlreadyExists
} else {
s.passwords[p.Email] = p
s.passwords[lowerEmail] = p
}
})
return