Skip to content

Commit 0f9a14b

Browse files
committed
fix inconsistency with pin length
1 parent 11f24ae commit 0f9a14b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/src/main/java/com/secure/privacyfirst/ui/screens/SetupScreen.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ fun SetupScreen(
100100
OutlinedTextField(
101101
value = pin,
102102
onValueChange = {
103-
if (it.length <= 6 && it.all { char -> char.isDigit() }) {
103+
if (it.length <= 4 && it.all { char -> char.isDigit() }) {
104104
pin = it
105105
showError = false
106106
}
107107
},
108-
label = { Text("Create 4-6 Digit PIN") },
108+
label = { Text("Create 4 Digit PIN") },
109109
modifier = Modifier.fillMaxWidth(),
110110
singleLine = true,
111111
visualTransformation = if (isPinVisible) VisualTransformation.None else PasswordVisualTransformation(),
@@ -130,7 +130,7 @@ fun SetupScreen(
130130
OutlinedTextField(
131131
value = confirmPin,
132132
onValueChange = {
133-
if (it.length <= 6 && it.all { char -> char.isDigit() }) {
133+
if (it.length <= 4 && it.all { char -> char.isDigit() }) {
134134
confirmPin = it
135135
showError = false
136136
}
@@ -174,9 +174,9 @@ fun SetupScreen(
174174
showError = true
175175
errorMessage = "Please enter your name"
176176
}
177-
pin.length < 4 -> {
177+
pin.length != 4 -> {
178178
showError = true
179-
errorMessage = "PIN must be at least 4 digits"
179+
errorMessage = "PIN must be exactly 4 digits"
180180
}
181181
pin != confirmPin -> {
182182
showError = true
@@ -218,7 +218,7 @@ fun SetupScreen(
218218
colors = ButtonDefaults.buttonColors(
219219
containerColor = MaterialTheme.colorScheme.primary
220220
),
221-
enabled = userName.isNotBlank() && pin.length >= 4 && confirmPin.length >= 4
221+
enabled = userName.isNotBlank() && pin.length == 4 && confirmPin.length == 4
222222
) {
223223
Text(
224224
text = "Complete Setup",

0 commit comments

Comments
 (0)