forked from baron/baron-sso
feat: 사용자 벌크 CSV 등록 시 보조 이메일 지원 (#917)
- `adminfront` CSV 템플릿 헤더에 `secondary_emails` 추가 및 예시 반영 - `adminfront` CSV 파서(`csvParser.ts`)에서 `secondary_emails` 추출 로직 보강 - `backend` 에서 `BulkCreateUsers`, `UpdateUser` 실행 시 보조 이메일을 포함한 모든 이메일에 대해 식별자 유효성(ValidateLoginID) 검사 수행 - `domain.ValidateLoginID`의 파라미터를 복수 이메일 처리를 위해 `[]string`으로 변경 - Playwright E2E 테스트 `users_bulk_secondary.spec.ts` 신규 작성 및 테스트 패스 확인
This commit is contained in:
@@ -8,30 +8,31 @@ func TestValidateLoginID(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
loginID string
|
||||
email string
|
||||
emails []string
|
||||
phone string
|
||||
wantErr bool
|
||||
}{
|
||||
{"Empty", "", "test@email.com", "01012345678", false},
|
||||
{"Valid alphanumeric", "user123", "test@email.com", "01012345678", false},
|
||||
{"Too short", "us", "test@email.com", "01012345678", true},
|
||||
{"Too long", "thisisaverylongloginidthatiswayoverthirtycharacters", "test@email.com", "01012345678", true},
|
||||
{"Email format", "user@domain.com", "test@email.com", "01012345678", true},
|
||||
{"Exact email match", "Test@Email.Com", "test@email.com", "01012345678", true},
|
||||
{"Phone number match", "010-1234-5678", "test@email.com", "01012345678", true},
|
||||
{"Phone number match +82", "+821012345678", "test@email.com", "01012345678", true},
|
||||
{"Phone number match digits", "01012345678", "test@email.com", "01012345678", true},
|
||||
{"Phone format (11 digits)", "01098765432", "test@email.com", "01012345678", true},
|
||||
{"Valid pure digits (employee ID)", "20230001", "test@email.com", "01012345678", false},
|
||||
{"Valid pure digits long", "123456789", "test@email.com", "01012345678", false},
|
||||
{"Valid pure digits 10 chars", "1234567890", "test@email.com", "01012345678", false},
|
||||
{"Reserved word admin", "ADMIN", "test@email.com", "01012345678", true},
|
||||
{"Reserved word root", "root", "test@email.com", "01012345678", true},
|
||||
{"Empty", "", []string{"test@email.com"}, "01012345678", false},
|
||||
{"Valid alphanumeric", "user123", []string{"test@email.com"}, "01012345678", false},
|
||||
{"Too short", "us", []string{"test@email.com"}, "01012345678", true},
|
||||
{"Too long", "thisisaverylongloginidthatiswayoverthirtycharacters", []string{"test@email.com"}, "01012345678", true},
|
||||
{"Email format", "user@domain.com", []string{"test@email.com"}, "01012345678", true},
|
||||
{"Exact email match", "Test@Email.Com", []string{"test@email.com"}, "01012345678", true},
|
||||
{"Secondary email match", "sub@test.com", []string{"test@email.com", "sub@test.com"}, "01012345678", true},
|
||||
{"Phone number match", "010-1234-5678", []string{"test@email.com"}, "01012345678", true},
|
||||
{"Phone number match +82", "+821012345678", []string{"test@email.com"}, "01012345678", true},
|
||||
{"Phone number match digits", "01012345678", []string{"test@email.com"}, "01012345678", true},
|
||||
{"Phone format (11 digits)", "01098765432", []string{"test@email.com"}, "01012345678", true},
|
||||
{"Valid pure digits (employee ID)", "20230001", []string{"test@email.com"}, "01012345678", false},
|
||||
{"Valid pure digits long", "123456789", []string{"test@email.com"}, "01012345678", false},
|
||||
{"Valid pure digits 10 chars", "1234567890", []string{"test@email.com"}, "01012345678", false},
|
||||
{"Reserved word admin", "ADMIN", []string{"test@email.com"}, "01012345678", true},
|
||||
{"Reserved word root", "root", []string{"test@email.com"}, "01012345678", true},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
err := ValidateLoginID(tt.loginID, tt.email, tt.phone)
|
||||
err := ValidateLoginID(tt.loginID, tt.emails, tt.phone)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("ValidateLoginID() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user