mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-16 12:01:13 +00:00
fix: harden app lock system unlock flow
This commit is contained in:
1 parent
f6a49dbf0a
commit
0ea707f70f
14 files changed
+114
-26
No files matched your search
@@ -71,6 +71,15 @@ test("app lock system unlock enablement requires current password", () => {
|
||||
assert.match(handlerSource, /currentPassword: enabled \? appLockSystemUnlockPassword : undefined/);
|
||||
});
|
||||
|
||||
test("app lock system unlock toggle still allows disabling when system auth is unavailable", () => {
|
||||
const source = readFileSync(new URL("./SettingsSystemTab.tsx", import.meta.url), "utf8");
|
||||
const appLockSectionStart = source.indexOf('<SectionHeader title={t("settings.appLock.title")} />');
|
||||
const nextSectionStart = source.indexOf("<SectionHeader", appLockSectionStart + 1);
|
||||
const appLockSection = source.slice(appLockSectionStart, nextSectionStart);
|
||||
|
||||
assert.match(appLockSection, /disabled=\{isSavingAppLockSystemUnlock \|\| \(!appLockSettings\.systemUnlockEnabled && !appLockSystemUnlockStatus\.available\)\}/);
|
||||
});
|
||||
|
||||
test("app lock disable explains that turning it off removes the saved password", () => {
|
||||
const englishLocale = readFileSync(new URL("../../../application/i18n/locales/en/core.ts", import.meta.url), "utf8");
|
||||
|
||||
|
||||
@@ -761,7 +761,7 @@ const SettingsSystemTab: React.FC<SettingsSystemTabProps> = ({
|
||||
)}
|
||||
<Toggle
|
||||
checked={appLockSettings.systemUnlockEnabled}
|
||||
disabled={!appLockSystemUnlockStatus.available || isSavingAppLockSystemUnlock}
|
||||
disabled={isSavingAppLockSystemUnlock || (!appLockSettings.systemUnlockEnabled && !appLockSystemUnlockStatus.available)}
|
||||
ariaLabel={t("settings.appLock.systemUnlock.label").replace("{label}", appLockSystemUnlockStatus.label)}
|
||||
onChange={(enabled) => void handleAppLockSystemUnlockChange(enabled)}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user