Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
csrf errors gracefully handled now
  • Loading branch information
proost committed Jan 25, 2018
1 parent 0affee4 commit 717a356
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions conekt/app.py
Expand Up @@ -326,6 +326,13 @@ def configure_admin_panel(app):
def configure_error_handlers(app):
# Custom error handler for 404 errors

from flask_wtf.csrf import CSRFError

@app.errorhandler(CSRFError)
def handle_csrf_error(e):
flash("Could not handle request, CSRF token has expired. Please try again...", "warning")
return redirect(url_for('main.screen'))

@app.errorhandler(405)
def method_not_allowed(e):
return render_template('error/405.html'), 405
Expand Down

0 comments on commit 717a356

Please sign in to comment.