Skip to content

Commit e09d4b0

Browse files
committed
Addressing comments
1 parent 2a17c0c commit e09d4b0

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

auth/user_mgt.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const (
4141
maxDeleteAccountsBatchSize = 1000
4242
createUserMethod = "createUser"
4343
updateUserMethod = "updateUser"
44-
phoneMultiFactor = "phone"
44+
phoneMultiFactorID = "phone"
4545
)
4646

4747
// 'REDACTED', encoded as a base64 string.
@@ -170,7 +170,7 @@ func convertMultiFactorInfoToServerFormat(mfaInfo MultiFactorInfo) (multiFactorI
170170
if mfaInfo.EnrollmentTimestamp != 0 {
171171
authFactorInfo.EnrolledAt = time.Unix(mfaInfo.EnrollmentTimestamp, 0).Format("2006-01-02T15:04:05Z07:00Z")
172172
}
173-
if mfaInfo.FactorID == phoneMultiFactor {
173+
if mfaInfo.FactorID == phoneMultiFactorID {
174174
authFactorInfo.PhoneInfo = mfaInfo.PhoneNumber
175175
authFactorInfo.DisplayName = mfaInfo.DisplayName
176176
authFactorInfo.MFAEnrollmentID = mfaInfo.UID
@@ -674,7 +674,7 @@ func validateAndFormatMfaSettings(mfaSettings MultiFactorSettings, methodType st
674674
if err := validateDisplayName(multiFactorInfo.DisplayName); err != nil {
675675
return nil, fmt.Errorf("the second factor \"displayName\" for \"%s\" must be a valid non-empty string", multiFactorInfo.DisplayName)
676676
}
677-
if multiFactorInfo.FactorID == phoneMultiFactor {
677+
if multiFactorInfo.FactorID == phoneMultiFactorID {
678678
if err := validatePhone(multiFactorInfo.PhoneNumber); err != nil {
679679
return nil, fmt.Errorf("the second factor \"phoneNumber\" for \"%s\" must be a non-empty E.164 standard compliant identifier string", multiFactorInfo.PhoneNumber)
680680
}
@@ -1083,7 +1083,7 @@ func (r *userQueryResponse) makeExportedUserRecord() (*ExportedUserRecord, error
10831083
UID: factor.MFAEnrollmentID,
10841084
DisplayName: factor.DisplayName,
10851085
EnrollmentTimestamp: enrollmentTimestamp,
1086-
FactorID: phoneMultiFactor,
1086+
FactorID: phoneMultiFactorID,
10871087
PhoneNumber: factor.PhoneInfo,
10881088
})
10891089
}

auth/user_mgt_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ func TestInvalidCreateUser(t *testing.T) {
647647
EnrolledFactors: []*MultiFactorInfo{
648648
{
649649
UID: "EnrollmentID",
650-
PhoneNumber: "+16505557348",
650+
PhoneNumber: "+11234567890",
651651
DisplayName: "Spouse's phone number",
652652
FactorID: "phone",
653653
},
@@ -669,7 +669,7 @@ func TestInvalidCreateUser(t *testing.T) {
669669
(&UserToCreate{}).MFASettings(MultiFactorSettings{
670670
EnrolledFactors: []*MultiFactorInfo{
671671
{
672-
PhoneNumber: "+16505557348",
672+
PhoneNumber: "+11234567890",
673673
DisplayName: "Spouse's phone number",
674674
FactorID: "phone",
675675
EnrollmentTimestamp: time.Now().UTC().Unix(),
@@ -681,7 +681,7 @@ func TestInvalidCreateUser(t *testing.T) {
681681
(&UserToCreate{}).MFASettings(MultiFactorSettings{
682682
EnrolledFactors: []*MultiFactorInfo{
683683
{
684-
PhoneNumber: "+16505557348",
684+
PhoneNumber: "+11234567890",
685685
DisplayName: "Spouse's phone number",
686686
FactorID: "",
687687
},
@@ -692,7 +692,7 @@ func TestInvalidCreateUser(t *testing.T) {
692692
(&UserToCreate{}).MFASettings(MultiFactorSettings{
693693
EnrolledFactors: []*MultiFactorInfo{
694694
{
695-
PhoneNumber: "+16505557348",
695+
PhoneNumber: "+11234567890",
696696
FactorID: "phone",
697697
},
698698
},
@@ -773,15 +773,15 @@ var createUserCases = []struct {
773773
(&UserToCreate{}).MFASettings(MultiFactorSettings{
774774
EnrolledFactors: []*MultiFactorInfo{
775775
{
776-
PhoneNumber: "+16505557348",
776+
PhoneNumber: "+11234567890",
777777
DisplayName: "Spouse's phone number",
778778
FactorID: "phone",
779779
},
780780
},
781781
}),
782782
map[string]interface{}{"mfaInfo": []*multiFactorInfoResponse{
783783
{
784-
PhoneInfo: "+16505557348",
784+
PhoneInfo: "+11234567890",
785785
DisplayName: "Spouse's phone number",
786786
},
787787
},
@@ -790,24 +790,24 @@ var createUserCases = []struct {
790790
(&UserToCreate{}).MFASettings(MultiFactorSettings{
791791
EnrolledFactors: []*MultiFactorInfo{
792792
{
793-
PhoneNumber: "+16505557348",
793+
PhoneNumber: "+11234567890",
794794
DisplayName: "number1",
795795
FactorID: "phone",
796796
},
797797
{
798-
PhoneNumber: "+16505557348",
798+
PhoneNumber: "+11234567890",
799799
DisplayName: "number2",
800800
FactorID: "phone",
801801
},
802802
},
803803
}),
804804
map[string]interface{}{"mfaInfo": []*multiFactorInfoResponse{
805805
{
806-
PhoneInfo: "+16505557348",
806+
PhoneInfo: "+11234567890",
807807
DisplayName: "number1",
808808
},
809809
{
810-
PhoneInfo: "+16505557348",
810+
PhoneInfo: "+11234567890",
811811
DisplayName: "number2",
812812
},
813813
},
@@ -876,7 +876,7 @@ func TestInvalidUpdateUser(t *testing.T) {
876876
EnrolledFactors: []*MultiFactorInfo{
877877
{
878878
UID: "enrolledSecondFactor1",
879-
PhoneNumber: "+16505557348",
879+
PhoneNumber: "+11234567890",
880880
FactorID: "phone",
881881
},
882882
},
@@ -898,7 +898,7 @@ func TestInvalidUpdateUser(t *testing.T) {
898898
(&UserToUpdate{}).MFASettings(MultiFactorSettings{
899899
EnrolledFactors: []*MultiFactorInfo{
900900
{
901-
PhoneNumber: "+16505557348",
901+
PhoneNumber: "+11234567890",
902902
FactorID: "phone",
903903
DisplayName: "Spouse's phone number",
904904
},
@@ -1050,13 +1050,13 @@ var updateUserCases = []struct {
10501050
EnrolledFactors: []*MultiFactorInfo{
10511051
{
10521052
UID: "enrolledSecondFactor1",
1053-
PhoneNumber: "+16505557348",
1053+
PhoneNumber: "+11234567890",
10541054
DisplayName: "Spouse's phone number",
10551055
FactorID: "phone",
10561056
EnrollmentTimestamp: time.Now().Unix(),
10571057
}, {
10581058
UID: "enrolledSecondFactor2",
1059-
PhoneNumber: "+16505557348",
1059+
PhoneNumber: "+11234567890",
10601060
DisplayName: "Spouse's phone number",
10611061
FactorID: "phone",
10621062
},
@@ -1065,14 +1065,14 @@ var updateUserCases = []struct {
10651065
map[string]interface{}{"mfaInfo": []*multiFactorInfoResponse{
10661066
{
10671067
MFAEnrollmentID: "enrolledSecondFactor1",
1068-
PhoneInfo: "+16505557348",
1068+
PhoneInfo: "+11234567890",
10691069
DisplayName: "Spouse's phone number",
10701070
EnrolledAt: time.Now().Format("2006-01-02T15:04:05Z07:00Z"),
10711071
},
10721072
{
10731073
MFAEnrollmentID: "enrolledSecondFactor2",
10741074
DisplayName: "Spouse's phone number",
1075-
PhoneInfo: "+16505557348",
1075+
PhoneInfo: "+11234567890",
10761076
},
10771077
},
10781078
},

integration/auth/user_mgt_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ func TestCreateUserMFA(t *testing.T) {
434434
tc.MFASettings(auth.MultiFactorSettings{
435435
EnrolledFactors: []*auth.MultiFactorInfo{
436436
{
437-
PhoneNumber: "+16505557348",
437+
PhoneNumber: "+11234567890",
438438
DisplayName: "Spouse's phone number",
439439
FactorID: "phone",
440440
},
@@ -451,7 +451,7 @@ func TestCreateUserMFA(t *testing.T) {
451451
UID: user.MultiFactor.EnrolledFactors[0].UID,
452452
DisplayName: "Spouse's phone number",
453453
FactorID: "phone",
454-
PhoneNumber: "+16505557348",
454+
PhoneNumber: "+11234567890",
455455
EnrollmentTimestamp: user.MultiFactor.EnrolledFactors[0].EnrollmentTimestamp,
456456
},
457457
}

0 commit comments

Comments
 (0)