add registration switch env
This commit is contained in:
@ -77,6 +77,9 @@ def logout():
|
||||
def register():
|
||||
if current_user.is_authenticated:
|
||||
return redirect(url_for('index'))
|
||||
if not app.config['ALLOW_REGISTRATION'] == "true":
|
||||
flash('Registration temporarily disabled.')
|
||||
return redirect(url_for('login'))
|
||||
form = RegistrationForm()
|
||||
if form.validate_on_submit():
|
||||
user = User(username=form.username.data, email=form.email.data)
|
||||
|
@ -16,6 +16,7 @@ class Config:
|
||||
ADMINS = [os.environ.get('DOTENV_ADMIN_EMAIL')]
|
||||
FROM_ADDRESS = os.environ.get('DOTENV_FROM_ADDRESS')
|
||||
REAL_HOSTNAME = os.environ.get('DOTENV_REAL_HOSTNAME')
|
||||
ALLOW_REGISTRATION = os.environ.get('DOTENV_ALLOW_REGISTRATION')
|
||||
|
||||
|
||||
DC_LOGGING = True
|
||||
|
Reference in New Issue
Block a user