12a236a42d04

fix: Match browser create-vault gating (v2.3.6)

time
2026-06-26 00:50 UTC · 5 months ago
machine
koh2
parent
dd36496a3560
4 files app/build.gradle+2 −2app/src/main/java/com/peachpasswords/ui/lock/LockScreen.kt+1 −1app/src/main/java/com/peachpasswords/ui/lock/LockViewModel.kt+4 −0app/src/test/java/com/peachpasswords/ui/lock/LockScreenTest.kt+6 −0
app/build.gradle+2 −2
@@ -16,8 +16,8 @@1616         applicationId "com.peachpasswords"1717         minSdk 261818         targetSdk 3519-        versionCode 23050020-        versionName "2.3.5"19+        versionCode 23060020+        versionName "2.3.6"2121 2222         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"2323         vectorDrawables {

view file

app/src/main/java/com/peachpasswords/ui/lock/LockScreen.kt+1 −1
@@ -198,7 +198,7 @@198198                 Spacer(Modifier.height(4.dp))199199                 AccentButton(200200                     label = if (state.hasVault) "unlock" else "create vault",201-                    enabled = !state.loading && (state.hasVault || createScore >= MIN_CREATE_STRENGTH),201+                    enabled = !state.loading && (state.hasVault || canSubmitCreateVault(password, confirm, createScore)),202202                     onClick = { if (state.hasVault) vm.unlock(password) else vm.create(password, confirm) },203203                 )204204 

view file

app/src/main/java/com/peachpasswords/ui/lock/LockViewModel.kt+4 −0
@@ -59,6 +59,10 @@5959     else -> null6060 }6161 62+/** Browser parity: create stays disabled until every create-vault rule passes. */63+internal fun canSubmitCreateVault(password: String, confirm: String, score: Int): Boolean =64+    createValidationError(password, confirm, score) == null65+6266 /**6367  * Where to land after a successful unlock (brief Fix 3): the last-viewed entry if6468  * it still exists, else the first active entry, else the vault list when the vault

view file

app/src/test/java/com/peachpasswords/ui/lock/LockScreenTest.kt+6 −0
@@ -34,6 +34,12 @@3434         assertEquals("passwords do not match", err)3535     }3636 37+    @Test fun create_submit_is_blocked_until_confirmation_matches() {38+        assertTrue(!canSubmitCreateVault("Str0ng-Passphrase!23", "", score = 4))39+        assertTrue(!canSubmitCreateVault("Str0ng-Passphrase!23", "Str0ng-Passphrase!99", score = 4))40+        assertTrue(canSubmitCreateVault("Str0ng-Passphrase!23", "Str0ng-Passphrase!23", score = 4))41+    }42+3743     @Test fun valid_create_returns_no_error() {3844         assertNull(createValidationError("Str0ng-Passphrase!23", "Str0ng-Passphrase!23", score = 4))3945     }

view file