Check code before redirecting
This commit is contained in:
parent
bcf8b39ec4
commit
701ef6db2e
|
@ -18,7 +18,13 @@ def form():
|
||||||
'code' in request.form
|
'code' in request.form
|
||||||
and len(request.form['code']) == 4
|
and len(request.form['code']) == 4
|
||||||
):
|
):
|
||||||
return redirect(url_for('rsvp', code=request.form['code']))
|
code = request.form['code']
|
||||||
|
try:
|
||||||
|
get_name_and_replies(code)
|
||||||
|
except ValueError:
|
||||||
|
error = "Code invalide"
|
||||||
|
else:
|
||||||
|
return redirect(url_for('rsvp', code=code))
|
||||||
else:
|
else:
|
||||||
error = "Code invalide"
|
error = "Code invalide"
|
||||||
return render_template('form.html', error=error)
|
return render_template('form.html', error=error)
|
||||||
|
|
Loading…
Reference in New Issue