catch some error cases.
This commit is contained in:
parent
9339015101
commit
4981223ee8
|
@ -27,6 +27,7 @@ def register_post():
|
||||||
if db.by_email(email):
|
if db.by_email(email):
|
||||||
return dict(error='Email address already in use.')
|
return dict(error='Email address already in use.')
|
||||||
# send confirmation mail
|
# send confirmation mail
|
||||||
|
try:
|
||||||
sendmail(
|
sendmail(
|
||||||
email,
|
email,
|
||||||
"[Ticketfrei] Confirm your account",
|
"[Ticketfrei] Confirm your account",
|
||||||
|
@ -37,6 +38,8 @@ def register_post():
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return dict(info='Confirmation mail sent.')
|
return dict(info='Confirmation mail sent.')
|
||||||
|
except Exception:
|
||||||
|
return dict(error='Could not send confirmation mail.')
|
||||||
|
|
||||||
|
|
||||||
@get('/confirm/<token>')
|
@get('/confirm/<token>')
|
||||||
|
@ -53,9 +56,13 @@ def confirm(token):
|
||||||
@view('template/login.tpl')
|
@view('template/login.tpl')
|
||||||
def login_post():
|
def login_post():
|
||||||
# check login
|
# check login
|
||||||
|
try:
|
||||||
if db.by_email(request.forms.get('email', '')) \
|
if db.by_email(request.forms.get('email', '')) \
|
||||||
.check_password(request.forms.get('pass', '')):
|
.check_password(request.forms.get('pass', '')):
|
||||||
return redirect('/settings')
|
return redirect('/settings')
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
finally:
|
||||||
return dict(error='Authentication failed.')
|
return dict(error='Authentication failed.')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue