Added automatic lockscreen dismissal config option

This commit is contained in:
boltgolt 2018-03-13 21:17:49 +01:00
parent edf3dbfacd
commit df14128a32
2 changed files with 12 additions and 0 deletions

View file

@ -6,6 +6,11 @@ no_confirmation = false
# show an error but fail silently
suppress_unknown = false
# Auto dismiss lock screen on confirmation
# Will run loginctl unlock-sessions after every auth
# Expirimental, can behave incorrectly on some systems
dismiss_lockscreen = false
[video]
# The certainty of the detected face belonging to the user of the account
# On a scale from 1 to 10, values above 5 are not recommended

7
pam.py
View file

@ -29,8 +29,15 @@ def doAuth(pamh):
return pamh.PAM_AUTH_ERR
# Status 0 is a successful exit
if status == 0:
# Show the success message if it isn't suppressed
if config.get("core", "no_confirmation") != "true":
pamh.conversation(pamh.Message(pamh.PAM_TEXT_INFO, "Identified face as " + pamh.get_user()))
# Try to dismiss the lock screen if enabled
if config.get("core", "dismiss_lockscreen") == "true":
# Run it as root with a timeout of 1s, and never ask for a password through the UI
subprocess.Popen(["sudo", "timeout", "1", "loginctl", "unlock-sessions", "--no-ask-password"])
return pamh.PAM_SUCCESS
# Otherwise, we can't discribe what happend but it wasn't successful