Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Set PIN unlock as last used so it shows up by default after enabling in settings (#2136)

Leendert de Borstfff1db9c294a
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/settings/VaultUnlockSettings.tsx b/apps/browser-extension/src/entrypoints/popup/pages/settings/VaultUnlockSettings.tsx
index f2ece917a..486c69daa 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/settings/VaultUnlockSettings.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/settings/VaultUnlockSettings.tsx
@@ -8,6 +8,7 @@ import PageTitle from '@/entrypoints/popup/components/PageTitle';
import { useDb } from '@/entrypoints/popup/context/DbContext';
import { useLoading } from '@/entrypoints/popup/context/LoadingContext';
+import { LocalPreferencesService } from '@/utils/LocalPreferencesService';
import {
isPinEnabled,
setupPin,
@@ -128,6 +129,13 @@ const VaultUnlockSettings: React.FC = () => {
/* Setup PIN with the encryption key */
await setupPin(newPin, encryptionKey);
+ /*
+ * Mark PIN as the last-used unlock method so the unlock screen defaults to
+ * the PIN prompt next time. Otherwise a previous password unlock would keep
+ * the password screen as the default even though the user just enabled PIN.
+ */
+ await LocalPreferencesService.setLastUsedUnlockMethod('pin');
+
setPinEnabled(true);
setPinSetupStep(1);
setNewPin('');