Skip to content

Commit

Permalink
Remove the actual email value from the error message returned by vali…
Browse files Browse the repository at this point in the history
…dateEmail()
  • Loading branch information
horai committed Sep 28, 2023
1 parent 5e861fd commit 19d7134
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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

0 comments on commit 19d7134

Please sign in to comment.