Commit 134a9a9e authored by Aurel Wildfellner's avatar Aurel Wildfellner

Added setPassword method in ldapinterface.

parent 0d1bd89c
......@@ -58,6 +58,11 @@ class LdapInterface(object):
those not included will be disbaled. """
pass
@abstractmethod
def setPassword(self, oldpass, newpass):
""" Returns True/False. """
pass
@abstractmethod
def setSpacePassowrd(self, password):
""" Set the space/door password. Returns True/False. """
......@@ -109,6 +114,14 @@ class LdapInterfaceMockup(LdapInterface):
pass
def setPassword(self, oldpass, newpass):
if self.password == oldpass:
self.password = newpass
return True
else:
return False
def setSpacePassword(self, password):
if (len(password) < 8):
return False
......
......@@ -125,17 +125,15 @@ def postPassword():
alertmessage=" "
# good init
if oldpass == current_user.ldapi.password:
if pass0 == pass1:
current_user.ldapi.password = pass0
success = 1
if pass0 == pass1:
success = current_user.ldapi.setPassword(oldpass, pass0)
if success:
alertmessage = "Changed password succesfully."
else:
success = 0
alertmessage = "password mismatch"
alertmessage = "wrong password"
else:
success = 0
alertmessage = "wrong password"
alertmessage = "password mismatch"
return redirect(url_for('mainInterface', alert="password", success=success, alertmessage=alertmessage))
......
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