[snowy: 9/26] [django_openid_auth] Redirect new OpenID users to initial_preferences page



commit f8df6f2585322fc69a61746549ad36f64e4ae87f
Author: Leon Handreke <leon handreke gmail com>
Date:   Sun Apr 11 21:55:31 2010 +0200

    [django_openid_auth] Redirect new OpenID users to initial_preferences page
    
    If the email or the display name are not given, the user is redirected

 lib/django_openid_auth/views.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/lib/django_openid_auth/views.py b/lib/django_openid_auth/views.py
index 5488cf2..d3c8bfe 100644
--- a/lib/django_openid_auth/views.py
+++ b/lib/django_openid_auth/views.py
@@ -207,7 +207,11 @@ def login_complete(request, redirect_field_name=REDIRECT_FIELD_NAME):
         if user is not None:
             if user.is_active:
                 auth_login(request, user)
-                return HttpResponseRedirect(sanitise_redirect_url(redirect_to))
+                # Check if the user has filled in relevant credentials
+                if (user.get_profile().display_name and user.email):
+                    return HttpResponseRedirect(sanitise_redirect_url(redirect_to))
+                else:
+                    return HttpResponseRedirect(reverse('initial_preferences'))
             else:
                 return render_failure(request, 'Disabled account')
         else:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]