mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 01:14:21 +01:00
implementing frontend password policy check
This commit is contained in:
parent
04e28f10b1
commit
ac7661731c
@ -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
|
||||
|
@ -57,7 +57,7 @@ for a in sorted(attributes.keys(), key=lambda attr: attributes[attr]['weight']):
|
||||
%endfor
|
||||
</select>
|
||||
% elif attr['type'] == 'password':
|
||||
<input type="password" class="form-control" name="attr.${a}1" id="${a}1" placeholder="${attr['description']}" ${required}>
|
||||
<input type="password" class="form-control" data-error="Don't meet password policy" data-remote="/checkppolicy" name="attr.${a}1" id="${a}1" placeholder="${attr['description']}" ${required}>
|
||||
<span class="input-group-addon" id="basic-addon1">Retype ${attr['display_name']}</span>
|
||||
<input type="password" class="form-control" data-match="#${a}1" data-match-error="Passwords don't match" name="attr.${a}2" id="#${a}2" placeholder="Confirm" ${required}>
|
||||
% endif
|
||||
|
Loading…
Reference in New Issue
Block a user