diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-04-19 16:46:40 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-04-19 16:46:40 +0200 |
commit | e9b1e7a7346b39d500e71504f9dde798c49a9216 (patch) | |
tree | b95c29a7fabbfa57f043f3d211699baf7c937f3d | |
parent | Merge branch 'master' of bitbucket.org:cedricbonhomme/pyaggr3g470r (diff) | |
download | newspipe-e9b1e7a7346b39d500e71504f9dde798c49a9216.tar.gz newspipe-e9b1e7a7346b39d500e71504f9dde798c49a9216.tar.bz2 newspipe-e9b1e7a7346b39d500e71504f9dde798c49a9216.zip |
Updated error messages for authentication
-rw-r--r-- | pyaggr3g470r/views.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index c1fa459e..21ca153c 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -79,16 +79,6 @@ def before_request(): #db.session.add(g.user) #db.session.commit() -@app.errorhandler(403) -def authentication_failed(e): - flash('Authentication failed.', 'danger') - return redirect(url_for('login')) - -@app.errorhandler(401) -def authentication_failed(e): - flash('Authentication required.', 'info') - return redirect(url_for('login')) - @login_manager.user_loader def load_user(email): # Return an instance of the User model @@ -98,6 +88,16 @@ def load_user(email): # # Custom error pages. # +@app.errorhandler(401) +def authentication_failed(e): + flash('Authentication required.', 'info') + return redirect(url_for('login')), 401 + +@app.errorhandler(403) +def authentication_failed(e): + flash('Authentication failed.', 'danger') + return redirect(url_for('login')), 403 + @app.errorhandler(404) def page_not_found(e): return render_template('errors/404.html'), 404 |