shift-shell/shell/contents/lockscreen/LockScreenState.qml
Devin Lin e044c84219 lockscreen: Fix potential cause of input unresponsiveness
BUG: 484054
This is a potential fix for the input to stop working. There was unused code for passwordless login that could cause the "waitingForAuth" variable to never be set to false after user input.
2024-06-23 13:03:12 -04:00

84 lines
2.3 KiB
QML

// SPDX-FileCopyrightText: 2022 Devin Lin <espidev@gmail.com>
// SPDX-License-Identifier: GPL-2.0-or-later
import QtQml
import QtQuick
import org.kde.kscreenlocker 1.0 as ScreenLocker
QtObject {
id: root
// current password being typed
property string password: ""
// whether waiting for authentication after trying password
property bool waitingForAuth: false
// the info message given
property string info: ""
// whether the lockscreen was passwordless
property bool passwordless: false // TODO true
// whether the device can log in with fingerprint
readonly property bool isFingerprintSupported: authenticator.authenticatorTypes & ScreenLocker.Authenticator.Fingerprint
signal reset()
signal unlockSucceeded()
signal unlockFailed()
function tryPassword() {
if (root.password !== '') { // prevent typing lock when password is empty
waitingForAuth = true;
}
authenticator.startAuthenticating();
}
function resetPassword() {
password = "";
root.reset();
}
property var connections: Connections {
target: authenticator
function onSucceeded() {
console.log('login succeeded');
root.waitingForAuth = false;
root.unlockSucceeded();
Qt.quit();
}
function onFailed() {
console.log('login failed');
root.waitingForAuth = false;
root.password = "";
root.unlockFailed();
}
function onInfoMessageChanged() {
console.log('info: ' + authenticator.infoMessage);
root.info += authenticator.infoMessage + " ";
}
// TODO
function onErrorMessageChanged() {
console.log('error: ' + authenticator.errorMessage);
}
// TODO
function onPromptChanged() {
console.log('prompt: ' + authenticator.prompt);
}
function onPromptForSecretChanged() {
console.log('prompt secret: ' + authenticator.promptForSecret);
if (root.password !== "") {
authenticator.respond(root.password);
authenticator.startAuthenticating();
}
}
}
}