Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the actual email value from the error message returned by validateEmail() #587

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion auth/user_mgt.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ func validateEmail(email string) error {
return fmt.Errorf("email must be a non-empty string")
}
if parts := strings.Split(email, "@"); len(parts) != 2 || parts[0] == "" || parts[1] == "" {
return fmt.Errorf("malformed email string: %q", email)
return fmt.Errorf("malformed email string")
}
return nil
}
Expand Down
14 changes: 7 additions & 7 deletions auth/user_mgt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func TestGetUsersInvalidEmail(t *testing.T) {
getUsersResult, err := client.GetUsers(
context.Background(),
[]UserIdentifier{EmailIdentifier{"invalid email addr"}})
want := `malformed email string: "invalid email addr"`
want := `malformed email string`
if getUsersResult != nil || err == nil || err.Error() != want {
t.Errorf("GetUsers() = (%v, %q); want = (nil, %q)", getUsersResult, err, want)
}
Expand Down Expand Up @@ -632,16 +632,16 @@ func TestInvalidCreateUser(t *testing.T) {
"email must be a non-empty string",
}, {
(&UserToCreate{}).Email("a"),
`malformed email string: "a"`,
`malformed email string`,
}, {
(&UserToCreate{}).Email("a@"),
`malformed email string: "a@"`,
`malformed email string`,
}, {
(&UserToCreate{}).Email("@a"),
`malformed email string: "@a"`,
`malformed email string`,
}, {
(&UserToCreate{}).Email("a@a@a"),
`malformed email string: "a@a@a"`,
`malformed email string`,
}, {
(&UserToCreate{}).MFASettings(MultiFactorSettings{
EnrolledFactors: []*MultiFactorInfo{
Expand Down Expand Up @@ -861,7 +861,7 @@ func TestInvalidUpdateUser(t *testing.T) {
"email must be a non-empty string",
}, {
(&UserToUpdate{}).Email("invalid"),
`malformed email string: "invalid"`,
`malformed email string`,
}, {
(&UserToUpdate{}).PhoneNumber("1"),
"phone number must be a valid, E.164 compliant identifier",
Expand Down Expand Up @@ -1528,7 +1528,7 @@ func TestUserToImportError(t *testing.T) {
},
{
(&UserToImport{}).UID("test").Email("not-an-email"),
`malformed email string: "not-an-email"`,
`malformed email string`,
},
{
(&UserToImport{}).UID("test").PhoneNumber("not-a-phone"),
Expand Down