add checks for ticket lenght and format
This commit is contained in:
parent
62833a2bd6
commit
a3b7ff3f9f
@ -21,7 +21,11 @@ def submit():
|
|||||||
elif request.method == 'POST':
|
elif request.method == 'POST':
|
||||||
timenow = int(time.time())
|
timenow = int(time.time())
|
||||||
ticket_input = request.form['ticket']
|
ticket_input = request.form['ticket']
|
||||||
ticket = Ticket(ticket = ticket_input, timestamp = timenow)
|
|
||||||
|
if ticket_input.isdigit() and len(ticket_input) == 10:
|
||||||
|
ticket = Ticket(ticket = int(ticket_input), timestamp = timenow)
|
||||||
|
else:
|
||||||
|
return 'Ticket format is wrong. Only 10 digits allowed.'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
db.session.add(ticket)
|
db.session.add(ticket)
|
||||||
|
Loading…
Reference in New Issue
Block a user