Check current password before changing

parent 8f9cc387
......@@ -23,11 +23,14 @@ class PamAuthentication(service.FunctionObject) :
def change_password(self, login, old_password, new_password):
if len(new_password) == 0:
return False
if not self.authenticate(login, old_password):
return False
try:
change_password(login, new_password, service=PAM_SERVICE_NAME)
return True
except PAMError as err:
print(err)
return False
......
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