fix: harden app lock system unlock flow

This commit is contained in:
Zheng Liu committed 2026-06-24 14:42:49 +08:00
1 parent f6a49dbf0a
commit 0ea707f70f
14 files changed
+114 -26

No files matched your search

+6 -2
View File
@@ -383,8 +383,11 @@ function createAppLockController({
return saved;
}
async function requestReset() {
async function requestReset(currentPassword) {
const current = getSettings();
const verified = await verifyCurrentPassword(current, currentPassword);
if (verified !== true) return verified;
const saved = await saveSettings({
enabled: false,
timeoutMinutes: current.timeoutMinutes,
@@ -547,7 +550,8 @@ function createAppLockController({
ipcMain.handle("netcatty:appLock:requestEnable", () => requestEnable());
ipcMain.handle("netcatty:appLock:requestDisable", (_event, currentPassword) =>
requestDisable(currentPassword));
ipcMain.handle("netcatty:appLock:requestReset", () => requestReset());
ipcMain.handle("netcatty:appLock:requestReset", (_event, currentPassword) =>
requestReset(currentPassword));
ipcMain.handle("netcatty:appLock:requestPasswordChange", (_event, input) =>
requestPasswordChange(input));
ipcMain.handle("netcatty:appLock:setLocked", (_event, reason) => setLocked(reason));