This is a test
Show More
@@ -84,6 +84,11 b' def main(global_config, **settings):' | |||
|
84 | 84 | encryption.ENCRYPTION_SECRET = settings.get('encryption_secret') |
|
85 | 85 | # import this later so encyption key can be monkeypatched |
|
86 | 86 | from appenlight.models import DBSession, register_datastores |
|
87 |
|
|
|
88 | # registration | |
|
89 | settings['appenlight.disable_registration'] = asbool( | |
|
90 | settings.get('appenlight.disable_registration')) | |
|
91 | ||
|
87 | 92 | # update config with cometd info |
|
88 | 93 | settings['cometd_servers'] = {'server': settings['cometd.server'], |
|
89 | 94 | 'secret': settings['cometd.secret']} |
@@ -176,6 +176,10 b' def register(request):' | |||
|
176 | 176 | if request.method == 'POST' and form.validate(): |
|
177 | 177 | log.info('registering user') |
|
178 | 178 | # insert new user here |
|
179 | if request.registry.settings['appenlight.disable_registration']: | |
|
180 | request.session.flash(_('Registration is currently disabled.')) | |
|
181 | return HTTPFound(location=request.route_url('/')) | |
|
182 | ||
|
179 | 183 | new_user = User() |
|
180 | 184 | DBSession.add(new_user) |
|
181 | 185 | form.populate_obj(new_user) |
@@ -79,6 +79,10 b' def users_create(request):' | |||
|
79 | 79 | csrf_context=request) |
|
80 | 80 | if form.validate(): |
|
81 | 81 | log.info('registering user') |
|
82 | # probably not needed in the future since this requires root anyways | |
|
83 | # lets keep this here in case we lower view permission in the future | |
|
84 | # if request.registry.settings['appenlight.disable_registration']: | |
|
85 | # return HTTPUnprocessableEntity(body={'error': 'Registration is currently disabled.'}) | |
|
82 | 86 | user = User() |
|
83 | 87 | # insert new user here |
|
84 | 88 | DBSession.add(user) |
General Comments 2
Auto status change to "Under Review"
Please use: https://github.com/Appenlight/appenlight to contribute :) Thanks !
You need to be logged in to leave comments.
Login now