Skip to content

Commit 19d7134

Browse files
author
horai
committed
Remove the actual email value from the error message returned by validateEmail()
1 parent 5e861fd commit 19d7134

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

auth/user_mgt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ func validateEmail(email string) error {
605605
return fmt.Errorf("email must be a non-empty string")
606606
}
607607
if parts := strings.Split(email, "@"); len(parts) != 2 || parts[0] == "" || parts[1] == "" {
608-
return fmt.Errorf("malformed email string: %q", email)
608+
return fmt.Errorf("malformed email string")
609609
}
610610
return nil
611611
}

auth/user_mgt_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ func TestGetUsersInvalidEmail(t *testing.T) {
395395
getUsersResult, err := client.GetUsers(
396396
context.Background(),
397397
[]UserIdentifier{EmailIdentifier{"invalid email addr"}})
398-
want := `malformed email string: "invalid email addr"`
398+
want := `malformed email string`
399399
if getUsersResult != nil || err == nil || err.Error() != want {
400400
t.Errorf("GetUsers() = (%v, %q); want = (nil, %q)", getUsersResult, err, want)
401401
}
@@ -632,16 +632,16 @@ func TestInvalidCreateUser(t *testing.T) {
632632
"email must be a non-empty string",
633633
}, {
634634
(&UserToCreate{}).Email("a"),
635-
`malformed email string: "a"`,
635+
`malformed email string`,
636636
}, {
637637
(&UserToCreate{}).Email("a@"),
638-
`malformed email string: "a@"`,
638+
`malformed email string`,
639639
}, {
640640
(&UserToCreate{}).Email("@a"),
641-
`malformed email string: "@a"`,
641+
`malformed email string`,
642642
}, {
643643
(&UserToCreate{}).Email("a@a@a"),
644-
`malformed email string: "a@a@a"`,
644+
`malformed email string`,
645645
}, {
646646
(&UserToCreate{}).MFASettings(MultiFactorSettings{
647647
EnrolledFactors: []*MultiFactorInfo{
@@ -861,7 +861,7 @@ func TestInvalidUpdateUser(t *testing.T) {
861861
"email must be a non-empty string",
862862
}, {
863863
(&UserToUpdate{}).Email("invalid"),
864-
`malformed email string: "invalid"`,
864+
`malformed email string`,
865865
}, {
866866
(&UserToUpdate{}).PhoneNumber("1"),
867867
"phone number must be a valid, E.164 compliant identifier",
@@ -1528,7 +1528,7 @@ func TestUserToImportError(t *testing.T) {
15281528
},
15291529
{
15301530
(&UserToImport{}).UID("test").Email("not-an-email"),
1531-
`malformed email string: "not-an-email"`,
1531+
`malformed email string`,
15321532
},
15331533
{
15341534
(&UserToImport{}).UID("test").PhoneNumber("not-a-phone"),

0 commit comments

Comments
 (0)