fix(lock): replace pam with python-pam and shim six dependency

Switch from the abandoned  package to .
Patch  into sys.modules before importing pam since
python-pam uses it internally but doesn't declare it as a dependency.
Update authenticate call to use pam.pam().authenticate().
This commit is contained in:
sankalp committed 2026-07-21 15:42:06 +05:45
1 parent d35537b910
commit 361d52b285
3 files changed
+44 -58

No files matched your search

+10 -1
View File
@@ -1,5 +1,14 @@
import getpass
# python-pam uses six.text_type which is just str in Python 3 — shim it out
import sys
import types as _types
if "six" not in sys.modules:
_six = _types.ModuleType("six")
_six.text_type = str # type: ignore[attr-defined]
sys.modules["six"] = _six
import pam
from fabric import Application
from fabric.utils import (
@@ -249,7 +258,7 @@ class LockScreen(Window):
return False # stop timeout
def on_activate(self, entry: Entry, *args):
if not pam.authenticate(getpass.getuser(), (entry.get_text() or "").strip()):
if not pam.pam().authenticate(getpass.getuser(), (entry.get_text() or "").strip()):
entry.set_text("")
entry.set_placeholder_text("Wrong Password")
return