def register(self): user_model = UserModel() c.auto_active = False for perm in user_model.get_by_username('default', cache=False).user_perms: if perm.permission.permission_name == 'hg.register.auto_activate': c.auto_active = True break if request.POST: register_form = RegisterForm()() try: form_result = register_form.to_python(dict(request.POST)) form_result['active'] = c.auto_active user_model.create_registration(form_result) h.flash(_('You have successfully registered into rhodecode'), category='success') return redirect(url('login_home')) except formencode.Invalid, errors: return htmlfill.render( render('/register.html'), defaults=errors.value, errors=errors.error_dict or {}, prefix_error=False, encoding="UTF-8")
def register(self): user_model = UserModel() c.auto_active = False for perm in User.get_by_username("default").user_perms: if perm.permission.permission_name == "hg.register.auto_activate": c.auto_active = True break if request.POST: register_form = RegisterForm()() try: form_result = register_form.to_python(dict(request.POST)) form_result["active"] = c.auto_active user_model.create_registration(form_result) h.flash(_("You have successfully registered into rhodecode"), category="success") return redirect(url("login_home")) except formencode.Invalid, errors: return htmlfill.render( render("/register.html"), defaults=errors.value, errors=errors.error_dict or {}, prefix_error=False, encoding="UTF-8", )