Skip to content
This repository has been archived by the owner on Jun 27, 2021. It is now read-only.

Commit

Permalink
catch the case where an non-email is provided (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathyourlife-fitbit authored Aug 27, 2020
1 parent 75277e5 commit 2be2a54
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions gsuite/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ func validateEmail(v interface{}, k string) (warnings []string, errors []error)
if err != nil {
errors = append(errors,
fmt.Errorf("unable to parse email address %s", email))
return
}

if e.Name != "" {
Expand Down
1 change: 1 addition & 0 deletions gsuite/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ func TestValidateEmail(t *testing.T) {
{"Alice <[email protected]>", false},
{"much-much-much-much-much-much-much-much-much-much-much-much-too-long@domain.com", false},
{"\"some@much-much-much-much-much-much-much-much-much-much-much-much-too-long\"@domain.com", false},
{"not an email address", false},
}

for _, testCase := range testCases {
Expand Down

0 comments on commit 2be2a54

Please sign in to comment.