mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-03-27 02:52:04 -04:00
Clear PIN data on logout (#1340)
This commit is contained in:
committed by
Leendert de Borst
parent
039e63f5c8
commit
ccf923bc98
@@ -4,6 +4,7 @@ import { sendMessage } from 'webext-bridge/popup';
|
||||
import { useDb } from '@/entrypoints/popup/context/DbContext';
|
||||
|
||||
import { VAULT_LOCKED_DISMISS_UNTIL_KEY } from '@/utils/Constants';
|
||||
import { removeAndDisablePin } from '@/utils/PinUnlockService';
|
||||
|
||||
import { storage } from '#imports';
|
||||
|
||||
@@ -73,6 +74,14 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
|
||||
await storage.removeItems(['local:username', 'local:accessToken', 'local:refreshToken']);
|
||||
dbContext?.clearDatabase();
|
||||
|
||||
// Clear PIN unlock data (if any)
|
||||
try {
|
||||
await removeAndDisablePin();
|
||||
} catch (error) {
|
||||
console.error('Failed to remove PIN data:', error);
|
||||
// Non-fatal error - continue with logout
|
||||
}
|
||||
|
||||
// Set local storage global message that will be shown on the login page.
|
||||
if (errorMessage) {
|
||||
setGlobalMessage(errorMessage);
|
||||
|
||||
@@ -205,6 +205,14 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
|
||||
// Non-fatal error - continue with logout
|
||||
}
|
||||
|
||||
// Clear PIN unlock data (if any)
|
||||
try {
|
||||
await NativeVaultManager.removeAndDisablePin();
|
||||
} catch (error) {
|
||||
console.error('Failed to remove PIN data:', error);
|
||||
// Non-fatal error - continue with logout
|
||||
}
|
||||
|
||||
// Clear from native layer
|
||||
await NativeVaultManager.clearUsername();
|
||||
await NativeVaultManager.clearAuthTokens();
|
||||
|
||||
Reference in New Issue
Block a user