mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-02 02:22:06 -04:00
idle/lock: add option to turn off monitors after lock explicitly
This commit is contained in:
@@ -147,6 +147,13 @@ Scope {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pam {
|
||||||
|
id: sharedPam
|
||||||
|
lockSecured: root.shouldLock
|
||||||
|
buffer: root.sharedPasswordBuffer
|
||||||
|
onUnlockRequested: root.unlock()
|
||||||
|
}
|
||||||
|
|
||||||
WlSessionLock {
|
WlSessionLock {
|
||||||
id: sessionLock
|
id: sessionLock
|
||||||
|
|
||||||
@@ -170,6 +177,7 @@ Scope {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: lockSurface.isActiveScreen
|
visible: lockSurface.isActiveScreen
|
||||||
lock: sessionLock
|
lock: sessionLock
|
||||||
|
pam: sharedPam
|
||||||
sharedPasswordBuffer: root.sharedPasswordBuffer
|
sharedPasswordBuffer: root.sharedPasswordBuffer
|
||||||
screenName: lockSurface.currentScreenName
|
screenName: lockSurface.currentScreenName
|
||||||
isLocked: shouldLock
|
isLocked: shouldLock
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Item {
|
|||||||
|
|
||||||
property string passwordBuffer: ""
|
property string passwordBuffer: ""
|
||||||
property bool demoMode: false
|
property bool demoMode: false
|
||||||
|
property var pam: demoPam
|
||||||
property string screenName: ""
|
property string screenName: ""
|
||||||
property bool unlocking: false
|
property bool unlocking: false
|
||||||
property string pamState: ""
|
property string pamState: ""
|
||||||
@@ -52,20 +53,18 @@ Item {
|
|||||||
return I18n.tr("Touch your security key...");
|
return I18n.tr("Touch your security key...");
|
||||||
if (pam.lockMessage && pam.lockMessage.length > 0)
|
if (pam.lockMessage && pam.lockMessage.length > 0)
|
||||||
return pam.lockMessage;
|
return pam.lockMessage;
|
||||||
if (pam.fprintState === "error") {
|
|
||||||
const detail = (pam.fprint.message || "").trim();
|
|
||||||
return detail.length > 0 ? I18n.tr("Fingerprint error: %1").arg(detail) : I18n.tr("Fingerprint error");
|
|
||||||
}
|
|
||||||
if (pam.fprintState === "max")
|
|
||||||
return I18n.tr("Maximum fingerprint attempts reached. Please use password.");
|
|
||||||
if (pam.fprintState === "fail")
|
|
||||||
return I18n.tr("Fingerprint not recognized (%1/%2). Please try again or use password.").arg(pam.fprint.tries).arg(SettingsData.maxFprintTries);
|
|
||||||
if (root.pamState === "error")
|
if (root.pamState === "error")
|
||||||
return I18n.tr("Authentication error - try again");
|
return I18n.tr("Authentication error - try again");
|
||||||
if (root.pamState === "max")
|
if (root.pamState === "max")
|
||||||
return I18n.tr("Too many attempts - locked out");
|
return I18n.tr("Too many attempts - locked out");
|
||||||
if (root.pamState === "fail")
|
if (root.pamState === "fail")
|
||||||
return I18n.tr("Incorrect password - try again");
|
return I18n.tr("Incorrect password - try again");
|
||||||
|
if (pam.fprintState === "error")
|
||||||
|
return I18n.tr("Fingerprint error");
|
||||||
|
if (pam.fprintState === "max")
|
||||||
|
return I18n.tr("Maximum fingerprint attempts reached. Please use password.");
|
||||||
|
if (pam.fprintState === "fail")
|
||||||
|
return I18n.tr("Fingerprint not recognized (%1/%2). Please try again or use password.").arg(pam.fprint.tries).arg(SettingsData.maxFprintTries);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -745,13 +744,6 @@ Item {
|
|||||||
easing.type: Theme.standardEasing
|
easing.type: Theme.standardEasing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
ColorAnimation {
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
easing.type: Theme.standardEasing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1639,49 +1631,46 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Pam {
|
Pam {
|
||||||
id: pam
|
id: demoPam
|
||||||
lockSecured: !demoMode
|
lockSecured: false
|
||||||
onUnlockRequested: {
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: root.pam
|
||||||
|
|
||||||
|
function onUnlockRequested() {
|
||||||
root.unlocking = true;
|
root.unlocking = true;
|
||||||
lockerReadyArmed = false;
|
lockerReadyArmed = false;
|
||||||
passwordField.text = "";
|
passwordField.text = "";
|
||||||
root.passwordBuffer = "";
|
root.passwordBuffer = "";
|
||||||
root.unlockRequested();
|
root.unlockRequested();
|
||||||
}
|
}
|
||||||
onStateChanged: {
|
|
||||||
root.pamState = state;
|
|
||||||
if (state !== "") {
|
|
||||||
root.unlocking = false;
|
|
||||||
placeholderDelay.restart();
|
|
||||||
passwordField.text = "";
|
|
||||||
root.passwordBuffer = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onU2fPendingChanged: {
|
|
||||||
if (u2fPending) {
|
|
||||||
passwordField.text = "";
|
|
||||||
root.passwordBuffer = "";
|
|
||||||
if (keyboardController.isKeyboardActive)
|
|
||||||
keyboardController.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
function onStateChanged() {
|
||||||
target: pam
|
root.pamState = root.pam.state;
|
||||||
|
if (root.pam.state === "")
|
||||||
|
return;
|
||||||
|
root.unlocking = false;
|
||||||
|
placeholderDelay.restart();
|
||||||
|
passwordField.text = "";
|
||||||
|
root.passwordBuffer = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function onU2fPendingChanged() {
|
||||||
|
if (!root.pam.u2fPending)
|
||||||
|
return;
|
||||||
|
passwordField.text = "";
|
||||||
|
root.passwordBuffer = "";
|
||||||
|
if (keyboardController.isKeyboardActive)
|
||||||
|
keyboardController.hide();
|
||||||
|
}
|
||||||
|
|
||||||
function onUnlockInProgressChanged() {
|
function onUnlockInProgressChanged() {
|
||||||
if (!pam.unlockInProgress && root.unlocking)
|
if (!root.pam.unlockInProgress && root.unlocking)
|
||||||
root.unlocking = false;
|
root.unlocking = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Binding {
|
|
||||||
target: pam
|
|
||||||
property: "buffer"
|
|
||||||
value: root.passwordBuffer
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: placeholderDelay
|
id: placeholderDelay
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ Rectangle {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property WlSessionLock lock
|
required property WlSessionLock lock
|
||||||
|
required property var pam
|
||||||
required property string sharedPasswordBuffer
|
required property string sharedPasswordBuffer
|
||||||
required property string screenName
|
required property string screenName
|
||||||
required property bool isLocked
|
required property bool isLocked
|
||||||
@@ -21,6 +22,7 @@ Rectangle {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
demoMode: false
|
demoMode: false
|
||||||
|
pam: root.pam
|
||||||
passwordBuffer: root.sharedPasswordBuffer
|
passwordBuffer: root.sharedPasswordBuffer
|
||||||
screenName: root.screenName
|
screenName: root.screenName
|
||||||
onUnlockRequested: root.unlockRequested()
|
onUnlockRequested: root.unlockRequested()
|
||||||
|
|||||||
@@ -179,6 +179,8 @@ Scope {
|
|||||||
abort();
|
abort();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (active)
|
||||||
|
return;
|
||||||
|
|
||||||
tries = 0;
|
tries = 0;
|
||||||
errorTries = 0;
|
errorTries = 0;
|
||||||
@@ -192,22 +194,23 @@ Scope {
|
|||||||
if (!available)
|
if (!available)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (res === PamResult.Success) {
|
switch (res) {
|
||||||
|
case PamResult.Success:
|
||||||
if (!root.unlockInProgress) {
|
if (!root.unlockInProgress) {
|
||||||
passwd.abort();
|
passwd.abort();
|
||||||
root.proceedAfterPrimaryAuth();
|
root.proceedAfterPrimaryAuth();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
case PamResult.Error:
|
||||||
|
|
||||||
if (res === PamResult.Error) {
|
|
||||||
root.fprintState = "error";
|
|
||||||
errorTries++;
|
errorTries++;
|
||||||
if (errorTries < 5) {
|
if (errorTries < 200) {
|
||||||
abort();
|
abort();
|
||||||
errorRetry.restart();
|
errorRetry.restart();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else if (res === PamResult.MaxTries) {
|
abort();
|
||||||
|
return;
|
||||||
|
case PamResult.MaxTries:
|
||||||
tries++;
|
tries++;
|
||||||
if (tries < SettingsData.maxFprintTries) {
|
if (tries < SettingsData.maxFprintTries) {
|
||||||
root.fprintState = "fail";
|
root.fprintState = "fail";
|
||||||
@@ -216,6 +219,9 @@ Scope {
|
|||||||
root.fprintState = "max";
|
root.fprintState = "max";
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
root.flashMsg();
|
root.flashMsg();
|
||||||
@@ -294,7 +300,7 @@ Scope {
|
|||||||
Timer {
|
Timer {
|
||||||
id: errorRetry
|
id: errorRetry
|
||||||
|
|
||||||
interval: 800
|
interval: 1500
|
||||||
onTriggered: fprint.start()
|
onTriggered: fprint.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,26 +352,22 @@ Scope {
|
|||||||
id: fprintStateReset
|
id: fprintStateReset
|
||||||
|
|
||||||
interval: 4000
|
interval: 4000
|
||||||
onTriggered: {
|
onTriggered: root.fprintState = ""
|
||||||
root.fprintState = "";
|
|
||||||
fprint.errorTries = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onLockSecuredChanged: {
|
onLockSecuredChanged: {
|
||||||
if (lockSecured) {
|
if (!lockSecured) {
|
||||||
SettingsData.refreshAuthAvailability();
|
|
||||||
root.state = "";
|
|
||||||
root.fprintState = "";
|
|
||||||
root.u2fState = "";
|
|
||||||
root.u2fPending = false;
|
|
||||||
root.lockMessage = "";
|
|
||||||
root.resetAuthFlows();
|
|
||||||
fprint.checkAvail();
|
|
||||||
u2f.checkAvail();
|
|
||||||
} else {
|
|
||||||
root.resetAuthFlows();
|
root.resetAuthFlows();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
root.state = "";
|
||||||
|
root.fprintState = "";
|
||||||
|
root.u2fState = "";
|
||||||
|
root.u2fPending = false;
|
||||||
|
root.lockMessage = "";
|
||||||
|
root.resetAuthFlows();
|
||||||
|
fprint.checkAvail();
|
||||||
|
u2f.checkAvail();
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#%PAM-1.0
|
#%PAM-1.0
|
||||||
|
|
||||||
auth required pam_fprintd.so max-tries=1 timeout=5
|
auth required pam_fprintd.so max-tries=5
|
||||||
|
|||||||
Reference in New Issue
Block a user