mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-31 16:54:46 +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
|
id: root
|
||||||
required property real keypadHeight
|
required property real keypadHeight
|
||||||
|
|
||||||
|
property real animationDuration
|
||||||
|
|
||||||
readonly property real openFactor: position / keypadHeight
|
readonly property real openFactor: position / keypadHeight
|
||||||
property real position: 0
|
property real position: 0
|
||||||
property bool movingUp: false
|
property bool movingUp: false
|
||||||
|
|
@ -47,7 +49,7 @@ MobileShell.SwipeArea {
|
||||||
|
|
||||||
NumberAnimation on position {
|
NumberAnimation on position {
|
||||||
id: positionAnim
|
id: positionAnim
|
||||||
duration: 800
|
duration: root.animationDuration
|
||||||
easing.type: Easing.OutExpo
|
easing.type: Easing.OutExpo
|
||||||
|
|
||||||
onFinished: {
|
onFinished: {
|
||||||
|
|
|
||||||
|
|
@ -83,9 +83,19 @@ Item {
|
||||||
id: flickable
|
id: flickable
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
// Speed up animation when passwordless
|
||||||
|
animationDuration: root.lockScreenState.canBeUnlocked ? 400 : 800
|
||||||
|
|
||||||
// Distance to swipe to fully open keypad
|
// Distance to swipe to fully open keypad
|
||||||
keypadHeight: Kirigami.Units.gridUnit * 20
|
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
|
// Clear entered password after closing keypad
|
||||||
onOpenFactorChanged: {
|
onOpenFactorChanged: {
|
||||||
if (flickable.openFactor < 0.1) {
|
if (flickable.openFactor < 0.1) {
|
||||||
|
|
@ -142,6 +152,7 @@ Item {
|
||||||
|
|
||||||
Keypad {
|
Keypad {
|
||||||
id: keypad
|
id: keypad
|
||||||
|
visible: !root.lockScreenState.canBeUnlocked // don't show for passwordless login
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
openProgress: flickable.openFactor
|
openProgress: flickable.openFactor
|
||||||
lockScreenState: root.lockScreenState
|
lockScreenState: root.lockScreenState
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@ QtObject {
|
||||||
// the info message given
|
// the info message given
|
||||||
property string info: ""
|
property string info: ""
|
||||||
|
|
||||||
// whether the lockscreen was passwordless
|
// whether the lockscreen can be unlocked (no password needed, passwordless login)
|
||||||
property bool passwordless: false // TODO true
|
readonly property bool canBeUnlocked: authenticator.unlocked
|
||||||
|
|
||||||
// whether the device can log in with fingerprint
|
// whether the device can log in with fingerprint
|
||||||
readonly property bool isFingerprintSupported: authenticator.authenticatorTypes & ScreenLocker.Authenticator.Fingerprint
|
readonly property bool isFingerprintSupported: authenticator.authenticatorTypes & ScreenLocker.Authenticator.Fingerprint
|
||||||
|
|
@ -38,9 +38,14 @@ QtObject {
|
||||||
Component.onCompleted: authenticator.startAuthenticating();
|
Component.onCompleted: authenticator.startAuthenticating();
|
||||||
|
|
||||||
function tryPassword() {
|
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;
|
root.waitingForAuth = true;
|
||||||
}
|
}
|
||||||
|
console.log('attempt password');
|
||||||
authenticator.respond(root.password);
|
authenticator.respond(root.password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,10 +71,12 @@ QtObject {
|
||||||
target: authenticator
|
target: authenticator
|
||||||
|
|
||||||
function onSucceeded() {
|
function onSucceeded() {
|
||||||
console.log('login succeeded');
|
if (authenticator.hadPrompt) {
|
||||||
root.waitingForAuth = false;
|
console.log('login succeeded');
|
||||||
root.unlockSucceeded();
|
root.waitingForAuth = false;
|
||||||
Qt.quit();
|
root.unlockSucceeded();
|
||||||
|
Qt.quit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFailed(kind: int): void {
|
function onFailed(kind: int): void {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue