mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-11 16:22:09 -04:00
refactor(greeter): Update auth flows and add configurable opts
- Finally fix debug info logs before dms greeter loads - prevent greeter/lockscreen auth stalls with timeout recovery and unlock-state sync
This commit is contained in:
@@ -755,7 +755,7 @@ Item {
|
||||
}
|
||||
}
|
||||
onAccepted: {
|
||||
if (!demoMode && !pam.passwd.active && !pam.u2fPending) {
|
||||
if (!demoMode && !root.unlocking && !pam.passwd.active && !pam.u2fPending) {
|
||||
pam.passwd.start();
|
||||
}
|
||||
}
|
||||
@@ -764,6 +764,11 @@ Item {
|
||||
return;
|
||||
}
|
||||
|
||||
if (root.unlocking) {
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
if (pam.u2fPending) {
|
||||
pam.cancelU2fPending();
|
||||
@@ -1017,7 +1022,7 @@ Item {
|
||||
visible: (demoMode || (!pam.passwd.active && !root.unlocking && !pam.u2fPending))
|
||||
enabled: !demoMode
|
||||
onClicked: {
|
||||
if (!demoMode && !pam.u2fPending) {
|
||||
if (!demoMode && !root.unlocking && !pam.u2fPending) {
|
||||
pam.passwd.start();
|
||||
}
|
||||
}
|
||||
@@ -1626,6 +1631,7 @@ Item {
|
||||
onStateChanged: {
|
||||
root.pamState = state;
|
||||
if (state !== "") {
|
||||
root.unlocking = false;
|
||||
placeholderDelay.restart();
|
||||
passwordField.text = "";
|
||||
root.passwordBuffer = "";
|
||||
@@ -1641,6 +1647,15 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: pam
|
||||
|
||||
function onUnlockInProgressChanged() {
|
||||
if (!pam.unlockInProgress && root.unlocking)
|
||||
root.unlocking = false;
|
||||
}
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: pam
|
||||
property: "buffer"
|
||||
|
||||
@@ -25,6 +25,29 @@ Scope {
|
||||
signal flashMsg
|
||||
signal unlockRequested
|
||||
|
||||
function resetAuthFlows(): void {
|
||||
passwd.abort();
|
||||
fprint.abort();
|
||||
u2f.abort();
|
||||
errorRetry.running = false;
|
||||
u2fErrorRetry.running = false;
|
||||
u2fPendingTimeout.running = false;
|
||||
passwdActiveTimeout.running = false;
|
||||
unlockRequestTimeout.running = false;
|
||||
u2fPending = false;
|
||||
u2fState = "";
|
||||
unlockInProgress = false;
|
||||
}
|
||||
|
||||
function recoverFromAuthStall(newState: string): void {
|
||||
resetAuthFlows();
|
||||
state = newState;
|
||||
flashMsg();
|
||||
stateReset.restart();
|
||||
fprint.checkAvail();
|
||||
u2f.checkAvail();
|
||||
}
|
||||
|
||||
function completeUnlock(): void {
|
||||
if (!unlockInProgress) {
|
||||
unlockInProgress = true;
|
||||
@@ -36,6 +59,7 @@ Scope {
|
||||
u2fPendingTimeout.running = false;
|
||||
u2fPending = false;
|
||||
u2fState = "";
|
||||
unlockRequestTimeout.restart();
|
||||
unlockRequested();
|
||||
}
|
||||
}
|
||||
@@ -102,6 +126,13 @@ Scope {
|
||||
return;
|
||||
}
|
||||
|
||||
unlockRequestTimeout.running = false;
|
||||
root.unlockInProgress = false;
|
||||
root.u2fPending = false;
|
||||
root.u2fState = "";
|
||||
u2fPendingTimeout.running = false;
|
||||
u2f.abort();
|
||||
|
||||
if (res === PamResult.Error)
|
||||
root.state = "error";
|
||||
else if (res === PamResult.MaxTries)
|
||||
@@ -114,6 +145,18 @@ Scope {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: passwd
|
||||
|
||||
function onActiveChanged() {
|
||||
if (passwd.active) {
|
||||
passwdActiveTimeout.restart();
|
||||
} else {
|
||||
passwdActiveTimeout.running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PamContext {
|
||||
id: fprint
|
||||
|
||||
@@ -279,6 +322,26 @@ Scope {
|
||||
onTriggered: root.cancelU2fPending()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: passwdActiveTimeout
|
||||
|
||||
interval: 15000
|
||||
onTriggered: {
|
||||
if (passwd.active)
|
||||
root.recoverFromAuthStall("error");
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: unlockRequestTimeout
|
||||
|
||||
interval: 8000
|
||||
onTriggered: {
|
||||
if (root.unlockInProgress)
|
||||
root.recoverFromAuthStall("error");
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: stateReset
|
||||
|
||||
@@ -308,17 +371,9 @@ Scope {
|
||||
root.u2fState = "";
|
||||
root.u2fPending = false;
|
||||
root.lockMessage = "";
|
||||
root.unlockInProgress = false;
|
||||
root.resetAuthFlows();
|
||||
} else {
|
||||
fprint.abort();
|
||||
passwd.abort();
|
||||
u2f.abort();
|
||||
errorRetry.running = false;
|
||||
u2fErrorRetry.running = false;
|
||||
u2fPendingTimeout.running = false;
|
||||
root.u2fPending = false;
|
||||
root.u2fState = "";
|
||||
root.unlockInProgress = false;
|
||||
root.resetAuthFlows();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,6 +393,7 @@ Scope {
|
||||
u2f.abort();
|
||||
u2fErrorRetry.running = false;
|
||||
u2fPendingTimeout.running = false;
|
||||
unlockRequestTimeout.running = false;
|
||||
root.u2fPending = false;
|
||||
root.u2fState = "";
|
||||
u2f.checkAvail();
|
||||
|
||||
Reference in New Issue
Block a user