1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 09:24:21 +01:00

properly implementing minimum lenght limit in search

This commit is contained in:
kakwa 2016-07-06 20:47:33 +02:00
parent 3b6cf61b93
commit baee15c40f
4 changed files with 5 additions and 5 deletions

View File

@ -890,7 +890,7 @@ class LdapCherry(object):
""" search user page """ """ search user page """
self._check_auth(must_admin=False) self._check_auth(must_admin=False)
is_admin = self._check_admin() is_admin = self._check_admin()
if searchstring is not None: if searchstring is not None and len(searchstring) > 2:
res = self._search(searchstring) res = self._search(searchstring)
else: else:
res = None res = None
@ -927,7 +927,7 @@ class LdapCherry(object):
""" search user page """ """ search user page """
self._check_auth(must_admin=True) self._check_auth(must_admin=True)
is_admin = self._check_admin() is_admin = self._check_admin()
if searchstring is not None: if searchstring is not None and len(searchstring) > 2:
res = self._search(searchstring) res = self._search(searchstring)
else: else:
res = None res = None

View File

@ -17,7 +17,7 @@
<a class="navbar-brand navbar-right" href='/logout'><span class="glyphicon glyphicon-off"></span> Logout</a> <a class="navbar-brand navbar-right" href='/logout'><span class="glyphicon glyphicon-off"></span> Logout</a>
<form method='GET' action='/searchuser' class="navbar-form navbar-right" role="search" data-toggle="validator"> <form method='GET' action='/searchuser' class="navbar-form navbar-right" role="search" data-toggle="validator">
<div class="form-group"> <div class="form-group">
<input type="text" class="form-control" data-minlength="3" name="searchstring" placeholder="Search User" data-error="Too short"> <input type="text" class="form-control" data-minlength="3" name="searchstring" placeholder="Search User" data-error="Too short" required>
</div> </div>
<button type="submit" class="btn btn-default">Submit</button> <button type="submit" class="btn btn-default">Submit</button>
</form> </form>

View File

@ -6,7 +6,7 @@
<form method='get' action='/searchadmin' role="form" class="form-inline" data-toggle="validator"> <form method='get' action='/searchadmin' role="form" class="form-inline" data-toggle="validator">
<div class="form-group"> <div class="form-group">
<label for="searchstring">Search user to modify/delete</label> <label for="searchstring">Search user to modify/delete</label>
<input type="text" class="form-control" data-minlength="3" data-error="Too short" id="searchstring" name="searchstring" placeholder="Search User"> <input type="text" class="form-control" data-minlength="3" data-error="Too short" id="searchstring" name="searchstring" placeholder="Search User" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="submit">Submit</label> <label for="submit">Submit</label>

View File

@ -6,7 +6,7 @@
<form method='get' action='/searchuser' role="form" class="form-inline" data-toggle="validator"> <form method='get' action='/searchuser' role="form" class="form-inline" data-toggle="validator">
<div class="form-group"> <div class="form-group">
<label for="searchstring">Search user</label> <label for="searchstring">Search user</label>
<input type="text" id="searchstring" data-minlength="3" data-error="Too short" class="form-control" name="searchstring" placeholder="Search User"> <input type="text" id="searchstring" data-minlength="3" data-error="Too short" class="form-control" name="searchstring" placeholder="Search User" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="submit">Submit</label> <label for="submit">Submit</label>