mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
lockscreen: Fix lockscreen password entry after suspend, and restore passwordless
Fixes https://invent.kde.org/plasma/plasma-mobile/-/issues/334
This commit is contained in:
parent
3efb51279e
commit
daf43eae27
3 changed files with 28 additions and 8 deletions
|
|
@ -11,6 +11,8 @@ MobileShell.SwipeArea {
|
|||
id: root
|
||||
required property real keypadHeight
|
||||
|
||||
property real animationDuration
|
||||
|
||||
readonly property real openFactor: position / keypadHeight
|
||||
property real position: 0
|
||||
property bool movingUp: false
|
||||
|
|
@ -47,7 +49,7 @@ MobileShell.SwipeArea {
|
|||
|
||||
NumberAnimation on position {
|
||||
id: positionAnim
|
||||
duration: 800
|
||||
duration: root.animationDuration
|
||||
easing.type: Easing.OutExpo
|
||||
|
||||
onFinished: {
|
||||
|
|
|
|||
|
|
@ -83,9 +83,19 @@ Item {
|
|||
id: flickable
|
||||
anchors.fill: parent
|
||||
|
||||
// Speed up animation when passwordless
|
||||
animationDuration: root.lockScreenState.canBeUnlocked ? 400 : 800
|
||||
|
||||
// Distance to swipe to fully open keypad
|
||||
keypadHeight: Kirigami.Units.gridUnit * 20
|
||||
|
||||
// Unlock lockscreen if it's already unlocked
|
||||
onOpened: {
|
||||
if (root.lockScreenState.canBeUnlocked) {
|
||||
Qt.quit();
|
||||
}
|
||||
}
|
||||
|
||||
// Clear entered password after closing keypad
|
||||
onOpenFactorChanged: {
|
||||
if (flickable.openFactor < 0.1) {
|
||||
|
|
@ -142,6 +152,7 @@ Item {
|
|||
|
||||
Keypad {
|
||||
id: keypad
|
||||
visible: !root.lockScreenState.canBeUnlocked // don't show for passwordless login
|
||||
anchors.fill: parent
|
||||
openProgress: flickable.openFactor
|
||||
lockScreenState: root.lockScreenState
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ QtObject {
|
|||
// the info message given
|
||||
property string info: ""
|
||||
|
||||
// whether the lockscreen was passwordless
|
||||
property bool passwordless: false // TODO true
|
||||
// whether the lockscreen can be unlocked (no password needed, passwordless login)
|
||||
readonly property bool canBeUnlocked: authenticator.unlocked
|
||||
|
||||
// whether the device can log in with fingerprint
|
||||
readonly property bool isFingerprintSupported: authenticator.authenticatorTypes & ScreenLocker.Authenticator.Fingerprint
|
||||
|
|
@ -38,9 +38,14 @@ QtObject {
|
|||
Component.onCompleted: authenticator.startAuthenticating();
|
||||
|
||||
function tryPassword() {
|
||||
if (root.password !== '') { // prevent typing lock when password is empty
|
||||
// ensure it's in authenticating state (it might get unset after suspend)
|
||||
authenticator.startAuthenticating();
|
||||
|
||||
// prevent typing lock when password is empty
|
||||
if (root.password !== '') {
|
||||
root.waitingForAuth = true;
|
||||
}
|
||||
console.log('attempt password');
|
||||
authenticator.respond(root.password);
|
||||
}
|
||||
|
||||
|
|
@ -66,10 +71,12 @@ QtObject {
|
|||
target: authenticator
|
||||
|
||||
function onSucceeded() {
|
||||
console.log('login succeeded');
|
||||
root.waitingForAuth = false;
|
||||
root.unlockSucceeded();
|
||||
Qt.quit();
|
||||
if (authenticator.hadPrompt) {
|
||||
console.log('login succeeded');
|
||||
root.waitingForAuth = false;
|
||||
root.unlockSucceeded();
|
||||
Qt.quit();
|
||||
}
|
||||
}
|
||||
|
||||
function onFailed(kind: int): void {
|
||||
|
|
|
|||
Loading…
Reference in a new issue