diff options
| author | rubenwardy <rw@rubenwardy.com> | 2018-05-26 01:58:56 +0100 |
|---|---|---|
| committer | rubenwardy <rw@rubenwardy.com> | 2018-05-26 01:58:56 +0100 |
| commit | ef0a32524e83d73ac5234ef5765d54b9348e52bf (patch) | |
| tree | 3b77734a9add3b69bc1dc991d56cb5157bfe47b4 /app/views | |
| parent | 2abcd8ee474e0f98c54af8bfe6fb40979f3b18ba (diff) | |
| download | cheatdb-ef0a32524e83d73ac5234ef5765d54b9348e52bf.tar.xz | |
Add banning
Fixes #13
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/__init__.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/views/__init__.py b/app/views/__init__.py index abaacd7..8bfb178 100644 --- a/app/views/__init__.py +++ b/app/views/__init__.py @@ -51,3 +51,10 @@ def flatpage(path): page = pages.get_or_404(path) template = page.meta.get('template', 'flatpage.html') return render_template(template, page=page) + +@app.before_request +def do_something_whenever_a_request_comes_in(): + if current_user.is_authenticated and current_user.rank == UserRank.BANNED: + flash("You have been banned.", "error") + logout_user() + return redirect(url_for('user.login')) |
