diff options
-rw-r--r-- | accounts/__init__.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/accounts/__init__.py b/accounts/__init__.py index f5afc47..afa348b 100644 --- a/accounts/__init__.py +++ b/accounts/__init__.py @@ -17,10 +17,14 @@ if 'SPLINE_ACCOUNT_WEB_SETTINGS' in os.environ: app.config.from_envvar('SPLINE_ACCOUNT_WEB_SETTINGS') app.all_services = account.SERVICES #TODO: take that from our json file or so -app.username_blacklist = list() app.user_backend = get_backend(app.config['USER_BACKEND'], app) app.mail_backend = get_backend(app.config['MAIL_BACKEND'], app) +app.username_blacklist = list() +if app.config.get('USERNAME_BLACKLIST_FILE'): + with open(app.config['USERNAME_BLACKLIST_FILE']) as f: + app.username_blacklist = f.read().split('\n') + @app.before_request def session_permanent(): if app.config.get('PERMANENT_SESSION_LIFETIME'): @@ -40,9 +44,3 @@ def initialize_user(): except ldap.INVALID_CREDENTIALS: # we had crap in the session, delete it logout_user() - -@app.before_first_request -def read_blacklist(): - if app.config.get('USERNAME_BLACKLIST_FILE'): - with open(app.config['USERNAME_BLACKLIST_FILE']) as f: - app.username_blacklist = f.read().split('\n') |