##// END OF EJS Templates
login: Remove social auth fragments from register views.
johbo -
r38:2451deb0 default
parent child Browse files
Show More
@@ -198,28 +198,19 b' class LoginView(object):'
198 198 renderer='rhodecode:templates/register.html',)
199 199 def register(self):
200 200 settings = SettingsModel().get_all_settings()
201
202 social_data = self.session.get('rhodecode.social_auth')
203 form_defaults = {}
204 if social_data:
205 password = str(uuid.uuid4())
206 form_defaults = {
207 'username': social_data['user'].get('user_name'),
208 'password': password,
209 'password_confirmation': password,
210 'email': social_data['user'].get('email'),
211 }
212
201 captcha_public_key = settings.get('rhodecode_captcha_public_key')
202 captcha_private_key = settings.get('rhodecode_captcha_private_key')
203 captcha_active = bool(captcha_private_key)
204 register_message = settings.get('rhodecode_register_message') or ''
213 205 auto_active = 'hg.register.auto_activate' in User.get_default_user()\
214 206 .AuthUser.permissions['global']
215 captcha_private_key = settings.get('rhodecode_captcha_private_key')
207
216 208 render_ctx = self._get_template_context()
217 209 render_ctx.update({
218 210 'auto_active': auto_active,
219 'captcha_active': bool(captcha_private_key),
220 'captcha_public_key': settings.get('rhodecode_captcha_public_key'),
221 'defaults': form_defaults,
222 'register_message': settings.get('rhodecode_register_message') or '',
211 'captcha_active': captcha_active,
212 'captcha_public_key': captcha_public_key,
213 'register_message': register_message,
223 214 })
224 215 return render_ctx
225 216
@@ -227,13 +218,12 b' class LoginView(object):'
227 218 route_name='register', request_method='POST',
228 219 renderer='rhodecode:templates/register.html')
229 220 def register_post(self):
230 social_data = self.session.get('rhodecode.social_auth')
231 221 settings = SettingsModel().get_all_settings()
232 222 captcha_private_key = settings.get('rhodecode_captcha_private_key')
233 223 captcha_active = bool(captcha_private_key)
224 register_message = settings.get('rhodecode_register_message') or ''
234 225 auto_active = 'hg.register.auto_activate' in User.get_default_user()\
235 226 .AuthUser.permissions['global']
236 register_message = settings.get('rhodecode_register_message') or ''
237 227
238 228 register_form = RegisterForm()()
239 229 try:
@@ -253,15 +243,7 b' class LoginView(object):'
253 243 raise formencode.Invalid(_msg, _value, None,
254 244 error_dict=error_dict)
255 245
256 new_user = UserModel().create_registration(form_result)
257 if social_data:
258 plugin_name = 'egg:rhodecode-enterprise-ee#{}'.format(
259 social_data['credentials.provider']
260 )
261 auth_plugin = loadplugin(plugin_name)
262 if auth_plugin:
263 auth_plugin.handle_social_data(
264 self.session, new_user.user_id, social_data)
246 UserModel().create_registration(form_result)
265 247 self.session.flash(
266 248 _('You have successfully registered with RhodeCode'),
267 249 queue='success')
General Comments 0
You need to be logged in to leave comments. Login now