quick hack to not allow duplicate usernames with spaces

master
q3k 2014-10-11 14:02:15 +02:00
parent 74d8dba84c
commit 72e5449a4f
1 changed files with 4 additions and 0 deletions

View File

@ -21,6 +21,10 @@ def login():
conn = ldap.initialize(app.config['LDAP_URL'])
conn.start_tls_s()
res,code = 'OK', 200
# hack!
if ' ' in request.form['login']:
res, code = 'ERROR', 401
return make_response(res, code, { 'Content-Type': 'text/plain' })
try:
conn.simple_bind_s(app.config['DN_STRING'] % request.form['login'],
request.form.get('password', ''))