Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: impl/memory/user.go

Issue 1525923002: Implement Mail service. (Closed) Base URL: https://github.com/luci/gae.git@filter_user
Patch Set: tests and words Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « impl/memory/mail_test.go ('k') | impl/memory/user_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/user.go
diff --git a/impl/memory/user.go b/impl/memory/user.go
index 1813d41f9b465c197219ecf97ff09daa90463e92..50f828f94daf9bf11d875cebcb714b47ac46e25c 100644
--- a/impl/memory/user.go
+++ b/impl/memory/user.go
@@ -8,6 +8,7 @@ import (
"crypto/sha256"
"encoding/binary"
"fmt"
+ "net/mail"
"net/url"
"strings"
"sync"
@@ -93,6 +94,12 @@ func (u *userImpl) SetUser(user *user.User) {
}
func (u *userImpl) Login(email, clientID string, admin bool) {
+ adr, err := mail.ParseAddress(email)
+ if err != nil {
+ panic(err)
+ }
+ email = adr.Address
+
parts := strings.Split(email, "@")
if len(parts) != 2 {
panic(fmt.Errorf("%q doesn't seem to be a valid email", email))
« no previous file with comments | « impl/memory/mail_test.go ('k') | impl/memory/user_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698