Add option for resetting testing user password

parent 7c64a3c9
...@@ -33,6 +33,16 @@ class PamAuthentication(service.FunctionObject) : ...@@ -33,6 +33,16 @@ class PamAuthentication(service.FunctionObject) :
except PAMError as err: except PAMError as err:
return False return False
@service.functionMethod("pam")
def restore_testing_user(self):
try:
with open('/etc/testing-user', 'r') as file:
login, password = file.read().split(' ', 1)
print(login, password)
change_password(login.strip(), password.strip(), service=PAM_SERVICE_NAME)
except FileNotFoundError:
pass
class Service(service.Service) : class Service(service.Service) :
def initService(self): def initService(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment