1
0
Fork 0
mirror of https://github.com/kakwa/ldapcherry synced 2025-07-04 20:37:48 +02:00

implementing frontend password policy check

This commit is contained in:
kakwa 2015-07-01 08:50:50 +02:00
parent 04e28f10b1
commit ac7661731c
2 changed files with 11 additions and 2 deletions

View file

@ -765,11 +765,20 @@ class LdapCherry(object):
return self.temp_searchuser.render(searchresult = res, attrs_list = attrs_list, is_admin=is_admin)
@cherrypy.expose
def checkppolicy(self, password):
def checkppolicy(self, **params):
""" search user page """
keys = params.keys()
if len(keys) != 1:
cherrypy.response.status = 403
return "bad argument"
password = params[keys[0]]
self._check_auth(must_admin=False)
is_admin = self._check_admin()
ret = self._checkppolicy(password)
if ret['match']:
cherrypy.response.status = 200
else:
cherrypy.response.status = 400
return json.dumps(ret, separators=(',',':'))
@cherrypy.expose