##// 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 renderer='rhodecode:templates/register.html',)
198 renderer='rhodecode:templates/register.html',)
199 def register(self):
199 def register(self):
200 settings = SettingsModel().get_all_settings()
200 settings = SettingsModel().get_all_settings()
201
201 captcha_public_key = settings.get('rhodecode_captcha_public_key')
202 social_data = self.session.get('rhodecode.social_auth')
202 captcha_private_key = settings.get('rhodecode_captcha_private_key')
203 form_defaults = {}
203 captcha_active = bool(captcha_private_key)
204 if social_data:
204 register_message = settings.get('rhodecode_register_message') or ''
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
213 auto_active = 'hg.register.auto_activate' in User.get_default_user()\
205 auto_active = 'hg.register.auto_activate' in User.get_default_user()\
214 .AuthUser.permissions['global']
206 .AuthUser.permissions['global']
215 captcha_private_key = settings.get('rhodecode_captcha_private_key')
207
216 render_ctx = self._get_template_context()
208 render_ctx = self._get_template_context()
217 render_ctx.update({
209 render_ctx.update({
218 'auto_active': auto_active,
210 'auto_active': auto_active,
219 'captcha_active': bool(captcha_private_key),
211 'captcha_active': captcha_active,
220 'captcha_public_key': settings.get('rhodecode_captcha_public_key'),
212 'captcha_public_key': captcha_public_key,
221 'defaults': form_defaults,
213 'register_message': register_message,
222 'register_message': settings.get('rhodecode_register_message') or '',
223 })
214 })
224 return render_ctx
215 return render_ctx
225
216
@@ -227,13 +218,12 b' class LoginView(object):'
227 route_name='register', request_method='POST',
218 route_name='register', request_method='POST',
228 renderer='rhodecode:templates/register.html')
219 renderer='rhodecode:templates/register.html')
229 def register_post(self):
220 def register_post(self):
230 social_data = self.session.get('rhodecode.social_auth')
231 settings = SettingsModel().get_all_settings()
221 settings = SettingsModel().get_all_settings()
232 captcha_private_key = settings.get('rhodecode_captcha_private_key')
222 captcha_private_key = settings.get('rhodecode_captcha_private_key')
233 captcha_active = bool(captcha_private_key)
223 captcha_active = bool(captcha_private_key)
224 register_message = settings.get('rhodecode_register_message') or ''
234 auto_active = 'hg.register.auto_activate' in User.get_default_user()\
225 auto_active = 'hg.register.auto_activate' in User.get_default_user()\
235 .AuthUser.permissions['global']
226 .AuthUser.permissions['global']
236 register_message = settings.get('rhodecode_register_message') or ''
237
227
238 register_form = RegisterForm()()
228 register_form = RegisterForm()()
239 try:
229 try:
@@ -253,15 +243,7 b' class LoginView(object):'
253 raise formencode.Invalid(_msg, _value, None,
243 raise formencode.Invalid(_msg, _value, None,
254 error_dict=error_dict)
244 error_dict=error_dict)
255
245
256 new_user = UserModel().create_registration(form_result)
246 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)
265 self.session.flash(
247 self.session.flash(
266 _('You have successfully registered with RhodeCode'),
248 _('You have successfully registered with RhodeCode'),
267 queue='success')
249 queue='success')
General Comments 0
You need to be logged in to leave comments. Login now