This is a test
Show More
@@ -84,6 +84,11 b' def main(global_config, **settings):' | |||||
84 | encryption.ENCRYPTION_SECRET = settings.get('encryption_secret') |
|
84 | encryption.ENCRYPTION_SECRET = settings.get('encryption_secret') | |
85 | # import this later so encyption key can be monkeypatched |
|
85 | # import this later so encyption key can be monkeypatched | |
86 | from appenlight.models import DBSession, register_datastores |
|
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 | # update config with cometd info |
|
92 | # update config with cometd info | |
88 | settings['cometd_servers'] = {'server': settings['cometd.server'], |
|
93 | settings['cometd_servers'] = {'server': settings['cometd.server'], | |
89 | 'secret': settings['cometd.secret']} |
|
94 | 'secret': settings['cometd.secret']} |
@@ -176,6 +176,10 b' def register(request):' | |||||
176 | if request.method == 'POST' and form.validate(): |
|
176 | if request.method == 'POST' and form.validate(): | |
177 | log.info('registering user') |
|
177 | log.info('registering user') | |
178 | # insert new user here |
|
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 | new_user = User() |
|
183 | new_user = User() | |
180 | DBSession.add(new_user) |
|
184 | DBSession.add(new_user) | |
181 | form.populate_obj(new_user) |
|
185 | form.populate_obj(new_user) |
@@ -79,6 +79,10 b' def users_create(request):' | |||||
79 | csrf_context=request) |
|
79 | csrf_context=request) | |
80 | if form.validate(): |
|
80 | if form.validate(): | |
81 | log.info('registering user') |
|
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 | user = User() |
|
86 | user = User() | |
83 | # insert new user here |
|
87 | # insert new user here | |
84 | DBSession.add(user) |
|
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