fix(mobile): turning the lock off takes Face ID too

Anyone holding the phone, unlocked, could switch the app lock off from
Settings. Off now asks for Face ID or the passcode, as on does.
This commit is contained in:
l0ng-ai
2026-10-03 20:27:44 +08:00
parent 0b444ce1f0
commit ef2ead73f8
+8 -7
View File
@@ -630,13 +630,14 @@ function settingsScreen() {
class: "row choice",
onclick: async () => {
// Turning it on proves it works first, so no one locks
// themselves out.
if (!prefs.lock) {
try {
await authenticate("Turn on the tty7 lock", { allowDeviceCredential: true });
} catch {
return;
}
// themselves out; turning it off takes the owner too, not
// whoever holds the phone.
try {
await authenticate(prefs.lock ? "Turn off the tty7 lock" : "Turn on the tty7 lock", {
allowDeviceCredential: true,
});
} catch {
return;
}
setPref("lock", !prefs.lock);
draw();