##// END OF EJS Templates
login: Bring recaptcha back to work....
johbo -
r46:4bc0185d default
parent child Browse files
Show More
@@ -197,7 +197,7 b' class LoginView(object):'
197 @view_config(
197 @view_config(
198 route_name='register', request_method='GET',
198 route_name='register', request_method='GET',
199 renderer='rhodecode:templates/register.html',)
199 renderer='rhodecode:templates/register.html',)
200 def register(self):
200 def register(self, defaults={}, errors={}):
201 settings = SettingsModel().get_all_settings()
201 settings = SettingsModel().get_all_settings()
202 captcha_public_key = settings.get('rhodecode_captcha_public_key')
202 captcha_public_key = settings.get('rhodecode_captcha_public_key')
203 captcha_private_key = settings.get('rhodecode_captcha_private_key')
203 captcha_private_key = settings.get('rhodecode_captcha_private_key')
@@ -208,6 +208,8 b' class LoginView(object):'
208
208
209 render_ctx = self._get_template_context()
209 render_ctx = self._get_template_context()
210 render_ctx.update({
210 render_ctx.update({
211 'defaults': defaults,
212 'errors': errors,
211 'auto_active': auto_active,
213 'auto_active': auto_active,
212 'captcha_active': captcha_active,
214 'captcha_active': captcha_active,
213 'captcha_public_key': captcha_public_key,
215 'captcha_public_key': captcha_public_key,
@@ -219,10 +221,9 b' class LoginView(object):'
219 route_name='register', request_method='POST',
221 route_name='register', request_method='POST',
220 renderer='rhodecode:templates/register.html')
222 renderer='rhodecode:templates/register.html')
221 def register_post(self):
223 def register_post(self):
222 settings = SettingsModel().get_all_settings()
224 captcha_private_key = SettingsModel().get_setting_by_name(
223 captcha_private_key = settings.get('rhodecode_captcha_private_key')
225 'rhodecode_captcha_private_key')
224 captcha_active = bool(captcha_private_key)
226 captcha_active = bool(captcha_private_key)
225 register_message = settings.get('rhodecode_register_message') or ''
226 auto_active = 'hg.register.auto_activate' in User.get_default_user()\
227 auto_active = 'hg.register.auto_activate' in User.get_default_user()\
227 .AuthUser.permissions['global']
228 .AuthUser.permissions['global']
228
229
@@ -258,13 +259,8 b' class LoginView(object):'
258 except formencode.Invalid as errors:
259 except formencode.Invalid as errors:
259 del errors.value['password']
260 del errors.value['password']
260 del errors.value['password_confirmation']
261 del errors.value['password_confirmation']
261 render_ctx = self._get_template_context()
262 return self.register(
262 render_ctx.update({
263 defaults=errors.value, errors=errors.error_dict)
263 'errors': errors.error_dict,
264 'defaults': errors.value,
265 'register_message': register_message,
266 })
267 return render_ctx
268
264
269 except UserCreationError as e:
265 except UserCreationError as e:
270 # container auth or other auth functions that create users on
266 # container auth or other auth functions that create users on
@@ -272,11 +268,7 b' class LoginView(object):'
272 # with user creation, explanation should be provided in
268 # with user creation, explanation should be provided in
273 # Exception itself
269 # Exception itself
274 self.session.flash(e, queue='error')
270 self.session.flash(e, queue='error')
275 render_ctx = self._get_template_context()
271 return self.register()
276 render_ctx.update({
277 'register_message': register_message,
278 })
279 return render_ctx
280
272
281 @view_config(
273 @view_config(
282 route_name='reset_password', request_method=('GET', 'POST'),
274 route_name='reset_password', request_method=('GET', 'POST'),
General Comments 0
You need to be logged in to leave comments. Login now