Merge pull request #50 from jameswthorne/no-zero-length
Don't allow zero length form submissions
This commit is contained in:
commit
e7f8a40065
1 changed files with 5 additions and 2 deletions
|
@ -65,16 +65,19 @@ def get_password(key):
|
|||
redis_client.delete(key)
|
||||
return password
|
||||
|
||||
def empty(value):
|
||||
if not value:
|
||||
return True
|
||||
|
||||
def clean_input():
|
||||
"""
|
||||
Make sure we're not getting bad data from the front end,
|
||||
format data to be machine readable
|
||||
"""
|
||||
if 'password' not in request.form:
|
||||
if empty(request.form.get('password', '')):
|
||||
abort(400)
|
||||
|
||||
if 'ttl' not in request.form:
|
||||
if empty(request.form.get('ttl', '')):
|
||||
abort(400)
|
||||
|
||||
time_period = request.form['ttl'].lower()
|
||||
|
|
Loading…
Reference in a new issue