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

Unified Diff: impl/memory/user.go

Issue 1525923002: Implement Mail service. (Closed) Base URL: https://github.com/luci/gae.git@filter_user
Patch Set: add tests 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
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))

Powered by Google App Engine
This is Rietveld 408576698