Show More
@@ -273,16 +273,26 b' class LoginView(BaseAppView):' | |||||
273 | route_name='register', request_method='POST', |
|
273 | route_name='register', request_method='POST', | |
274 | renderer='rhodecode:templates/register.mako') |
|
274 | renderer='rhodecode:templates/register.mako') | |
275 | def register_post(self): |
|
275 | def register_post(self): | |
|
276 | from rhodecode.authentication.plugins import auth_rhodecode | |||
|
277 | ||||
276 | self.load_default_context() |
|
278 | self.load_default_context() | |
277 | captcha = self._get_captcha_data() |
|
279 | captcha = self._get_captcha_data() | |
278 | auto_active = 'hg.register.auto_activate' in User.get_default_user()\ |
|
280 | auto_active = 'hg.register.auto_activate' in User.get_default_user()\ | |
279 | .AuthUser().permissions['global'] |
|
281 | .AuthUser().permissions['global'] | |
280 |
|
282 | |||
|
283 | extern_name = auth_rhodecode.RhodeCodeAuthPlugin.uid | |||
|
284 | extern_type = auth_rhodecode.RhodeCodeAuthPlugin.uid | |||
|
285 | ||||
281 | register_form = RegisterForm(self.request.translate)() |
|
286 | register_form = RegisterForm(self.request.translate)() | |
282 | try: |
|
287 | try: | |
283 |
|
288 | |||
284 | form_result = register_form.to_python(self.request.POST) |
|
289 | form_result = register_form.to_python(self.request.POST) | |
285 | form_result['active'] = auto_active |
|
290 | form_result['active'] = auto_active | |
|
291 | external_identity = self.request.POST.get('external_identity') | |||
|
292 | ||||
|
293 | if external_identity: | |||
|
294 | extern_name = external_identity | |||
|
295 | extern_type = external_identity | |||
286 |
|
296 | |||
287 | if captcha.active: |
|
297 | if captcha.active: | |
288 | captcha_status, captcha_message = self.validate_captcha( |
|
298 | captcha_status, captcha_message = self.validate_captcha( | |
@@ -295,11 +305,17 b' class LoginView(BaseAppView):' | |||||
295 | raise formencode.Invalid( |
|
305 | raise formencode.Invalid( | |
296 | _msg, _value, None, error_dict=error_dict) |
|
306 | _msg, _value, None, error_dict=error_dict) | |
297 |
|
307 | |||
298 |
new_user = UserModel().create_registration( |
|
308 | new_user = UserModel().create_registration( | |
|
309 | form_result, extern_name=extern_name, extern_type=extern_type) | |||
299 |
|
310 | |||
300 | action_data = {'data': new_user.get_api_data(), |
|
311 | action_data = {'data': new_user.get_api_data(), | |
301 | 'user_agent': self.request.user_agent} |
|
312 | 'user_agent': self.request.user_agent} | |
302 |
|
313 | |||
|
314 | ||||
|
315 | ||||
|
316 | if external_identity: | |||
|
317 | action_data['external_identity'] = external_identity | |||
|
318 | ||||
303 | audit_user = audit_logger.UserWrap( |
|
319 | audit_user = audit_logger.UserWrap( | |
304 | username=new_user.username, |
|
320 | username=new_user.username, | |
305 | user_id=new_user.user_id, |
|
321 | user_id=new_user.user_id, |
@@ -344,8 +344,8 b' class UserModel(BaseModel):' | |||||
344 | new_user.is_new_user = not edit |
|
344 | new_user.is_new_user = not edit | |
345 | # for users that didn's specify auth type, we use RhodeCode built in |
|
345 | # for users that didn's specify auth type, we use RhodeCode built in | |
346 | from rhodecode.authentication.plugins import auth_rhodecode |
|
346 | from rhodecode.authentication.plugins import auth_rhodecode | |
347 |
extern_name = extern_name or auth_rhodecode.RhodeCodeAuthPlugin. |
|
347 | extern_name = extern_name or auth_rhodecode.RhodeCodeAuthPlugin.uid | |
348 |
extern_type = extern_type or auth_rhodecode.RhodeCodeAuthPlugin. |
|
348 | extern_type = extern_type or auth_rhodecode.RhodeCodeAuthPlugin.uid | |
349 |
|
349 | |||
350 | try: |
|
350 | try: | |
351 | new_user.username = username |
|
351 | new_user.username = username | |
@@ -392,14 +392,15 b' class UserModel(BaseModel):' | |||||
392 | log.error(traceback.format_exc()) |
|
392 | log.error(traceback.format_exc()) | |
393 | raise |
|
393 | raise | |
394 |
|
394 | |||
395 |
def create_registration(self, form_data |
|
395 | def create_registration(self, form_data, | |
|
396 | extern_name='rhodecode', extern_type='rhodecode'): | |||
396 | from rhodecode.model.notification import NotificationModel |
|
397 | from rhodecode.model.notification import NotificationModel | |
397 | from rhodecode.model.notification import EmailNotificationModel |
|
398 | from rhodecode.model.notification import EmailNotificationModel | |
398 |
|
399 | |||
399 | try: |
|
400 | try: | |
400 | form_data['admin'] = False |
|
401 | form_data['admin'] = False | |
401 |
form_data['extern_name'] = |
|
402 | form_data['extern_name'] = extern_name | |
402 |
form_data['extern_type'] = |
|
403 | form_data['extern_type'] = extern_type | |
403 | new_user = self.create(form_data) |
|
404 | new_user = self.create(form_data) | |
404 |
|
405 | |||
405 | self.sa.add(new_user) |
|
406 | self.sa.add(new_user) |
General Comments 0
You need to be logged in to leave comments.
Login now