summaryrefslogtreecommitdiffstats
path: root/app.py
diff options
context:
space:
mode:
authorMarian Sigler <m@qjym.de>2012-09-26 23:46:15 +0200
committerMarian Sigler <m@qjym.de>2012-09-26 23:46:15 +0200
commitdfdd6899668bb153bfe992566ec1d11de29f2ad7 (patch)
tree7998631746076a26d75ad4ed1603c65af9bb45c8 /app.py
parentdfa0c8f473dab87dfa69ebab3a70883dab03b236 (diff)
downloadweb-dfdd6899668bb153bfe992566ec1d11de29f2ad7.tar.gz
web-dfdd6899668bb153bfe992566ec1d11de29f2ad7.tar.bz2
web-dfdd6899668bb153bfe992566ec1d11de29f2ad7.zip
Implement username blacklist; Don't allow registration with existing usernames.
Diffstat (limited to 'app.py')
-rw-r--r--app.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/app.py b/app.py
index 2b47f53..3785ac8 100644
--- a/app.py
+++ b/app.py
@@ -34,6 +34,15 @@ def ldap_connect():
# we had crap in the session, delete it
logout_user()
+@app.before_request
+def read_blacklist():
+ app.username_blacklist = None
+
+ # use @before_first_request as soon as we require flask 0.8
+ if app.username_blacklist is None and app.config.get('USERNAME_BLACKLIST_FILE'):
+ with open(app.config['USERNAME_BLACKLIST_FILE']) as f:
+ app.username_blacklist = f.read().split('\n')
+
@app.route('/', methods=['GET', 'POST'])
@templated('index.html')