Rename html/ and add error message
This commit is contained in:
parent
4a0d12971b
commit
08d9de8784
|
@ -5,7 +5,7 @@ Guest Book
|
|||
==========
|
||||
|
||||
If you visited my website, please sign my guestbook!
|
||||
<form action="g/submit" method="POST" accept-charset="UTF-8">
|
||||
<form action="submit" method="POST" accept-charset="UTF-8">
|
||||
Your name:
|
||||
<input name="name">
|
||||
|
5
t0sig.py
5
t0sig.py
|
@ -40,7 +40,7 @@ async def new_message(event):
|
|||
|
||||
entry += '\n\n{}\n\n'.format(data['message'])
|
||||
|
||||
with open('data/html/index.html', 'a') as f:
|
||||
with open('data/g/index.html', 'a') as f:
|
||||
f.write(entry)
|
||||
|
||||
await event.reply('Entry added to t0.vc/g')
|
||||
|
@ -60,6 +60,9 @@ async def submit(request):
|
|||
except KeyError:
|
||||
raise web.HTTPBadRequest(reason='You are missing something.')
|
||||
|
||||
if not len(name) or not len(message):
|
||||
raise web.HTTPBadRequest(reason='You are missing something.')
|
||||
|
||||
if len(name) > 50:
|
||||
raise web.HTTPBadRequest(reason='Name is too long.')
|
||||
if len(website) > 100:
|
||||
|
|
Loading…
Reference in New Issue
Block a user