Skip to content

Commit e6aa829

Browse files
authored
fix(auth): Fix parsing of REQUIRES_UPPERCASE/REQUIRES_LOWERCASE password settings in Gen1 (#2836)
1 parent e181875 commit e6aa829

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/AuthConfiguration.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,16 +202,16 @@ data class AuthConfiguration internal constructor(
202202
length = passwordLength,
203203
requiresNumber = passwordRequirements.contains("REQUIRES_NUMBERS"),
204204
requiresSpecial = passwordRequirements.contains("REQUIRES_SYMBOLS"),
205-
requiresLower = passwordRequirements.contains("REQUIRES_LOWER"),
206-
requiresUpper = passwordRequirements.contains("REQUIRES_UPPER")
205+
requiresLower = passwordRequirements.contains("REQUIRES_LOWERCASE"),
206+
requiresUpper = passwordRequirements.contains("REQUIRES_UPPERCASE")
207207
)
208208
}
209209

210210
private fun PasswordProtectionSettings.toGen1Json() = JSONObject().apply {
211211
put("passwordPolicyMinLength", length)
212212
val characters = JSONArray().apply {
213-
if (requiresLower) put("REQUIRES_LOWER")
214-
if (requiresUpper) put("REQUIRES_UPPER")
213+
if (requiresLower) put("REQUIRES_LOWERCASE")
214+
if (requiresUpper) put("REQUIRES_UPPERCASE")
215215
if (requiresNumber) put("REQUIRES_NUMBERS")
216216
if (requiresSpecial) put("REQUIRES_SYMBOLS")
217217
}

aws-auth-cognito/src/test/java/com/amplifyframework/auth/cognito/AuthConfigurationTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class AuthConfigurationTest {
7373
],
7474
"passwordProtectionSettings": {
7575
"passwordPolicyMinLength": 10,
76-
"passwordPolicyCharacters": ["REQUIRES_NUMBERS", "REQUIRES_LOWER"]
76+
"passwordPolicyCharacters": ["REQUIRES_NUMBERS", "REQUIRES_LOWERCASE"]
7777
},
7878
"mfaConfiguration": "OFF",
7979
"mfaTypes": [

0 commit comments

Comments
 (0)