Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
a1b7f9e7
Commit
a1b7f9e7
authored
Dec 01, 2015
by
bobbyrullo
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #190 from ericchiang/valid_email
user: fix bug in ValidEmail helper
parents
b30cb7d2
137330b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
user.go
user/user.go
+3
-4
user_test.go
user/user_test.go
+3
-0
No files found.
user/user.go
View file @
a1b7f9e7
...
...
@@ -163,10 +163,9 @@ func ValidEmail(email string) bool {
return
false
}
if
address
.
Name
!=
""
||
address
.
Address
==
""
{
return
false
}
return
true
// Has mail.ParseAddress parsed the entire string and only found a single
// address without a name?
return
address
.
Address
==
email
}
func
ValidPassword
(
plaintext
string
)
bool
{
...
...
user/user_test.go
View file @
a1b7f9e7
...
...
@@ -103,6 +103,9 @@ func TestValidEmail(t *testing.T) {
{
"r@r.com"
,
true
},
{
"Barry Gibbs <bg@example.com>"
,
false
},
{
""
,
false
},
{
"invalidemail"
,
false
},
{
"example@example.com example@example.com"
,
false
},
{
"example@example.com Hello, 世界"
,
false
},
}
for
i
,
tt
:=
range
tests
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment