Commits

Sarvi Shanmugham committed 78a8403

Added support for separate account creation using social auth.
Instead of automatically creating accouts. Now you can create accounts with
a separate view and URL. The regular login URL will not automatically create
accounts. The old behaviour is left alone using the settings flag.

Added support for separate settings for redirect URLs for userena account
creattions.
Some cleanup and New templates.

Comments (0)

Files changed (2)

                            name='userena_signup'),
                        url(r'^signin/$',
                            userena_views.signin,
+                           {'extra_context':{'loginerror':''},},
                            name='userena_signin'),
                        url(r'^signout/$',
                            auth_views.logout,
                            {'next_page': userena_settings.USERENA_REDIRECT_ON_SIGNOUT,
                             'template_name': 'userena/signout.html'},
                            name='userena_signout'),
+                       url(r'^login-error/$',
+                           userena_views.signin,
+                           {'extra_context':{'loginerror':'Error Logging in. Please Retry'},},
+                           name='userena_signin_error',),
 
                        # Reset password
                        url(r'^password/reset/$',
 
     if not extra_context: extra_context = dict()
     extra_context['form'] = form
+    try:
+        names = request.user.social_auth.values_list('provider', flat=True)
+    except AttributeError:
+        names=[]
+        pass
+    for name in names:
+        extra_context[name.lower().replace('-', '_')] = True
     return direct_to_template(request,
                               template_name,
                               extra_context=extra_context)
                 return redirect(reverse('userena_disabled',
                                         kwargs={'username': user.username}))
 
-    if not extra_context: extra_context = dict()
+    if not extra_context: extra_context = {'loginerror':''}
     extra_context['form'] = form
     return direct_to_template(request,
                               template_name,
-                              extra_context={'form': form})
+                              extra_context=extra_context)