]> git.parisson.com Git - django-social-auth.git/commitdiff
Google OAuth support in example proyect
authorMatías Aguirre <matiasaguirre@gmail.com>
Fri, 14 Jan 2011 05:13:58 +0000 (03:13 -0200)
committerMatías Aguirre <matiasaguirre@gmail.com>
Fri, 14 Jan 2011 05:13:58 +0000 (03:13 -0200)
example/app/views.py
example/settings.py
example/templates/done.html
example/templates/home.html

index 74d2cffddb2188962925852d47aa929e76bcc65f..50f3b3ea9fb71641a4d0b1cffde95a5b7181b182 100644 (file)
@@ -17,7 +17,8 @@ def done(request):
     """Login complete view, displays user data"""
     names = request.user.social_auth.values_list('provider', flat=True)
     return render_to_response('done.html',
-                              dict((name.lower(), True) for name in names),
+                              dict((name.lower().replace('-', '_'), True)
+                                        for name in names),
                               RequestContext(request))
 
 def error(request):
index 84716d204c38f281c50a8de286e2bd3ccad5664b..1b0008952d30b030b1f760f5ef11d0489fbe883a 100644 (file)
@@ -1,6 +1,3 @@
-import sys
-import random
-import os
 from os.path import abspath, dirname, basename, join
 
 DEBUG = True
@@ -67,6 +64,7 @@ INSTALLED_APPS = (
 AUTHENTICATION_BACKENDS = (
     'social_auth.backends.TwitterBackend',
     'social_auth.backends.FacebookBackend',
+    'social_auth.backends.GoogleOAuthBackend',
     'social_auth.backends.GoogleBackend',
     'social_auth.backends.YahooBackend',
     'social_auth.backends.OpenIDBackend',
index e8a426220b823421e78c287924c842ca1c5de666..a558549bd4d7fc5cb298451dda825c7c7dbc23e7 100644 (file)
@@ -15,7 +15,7 @@
 </div>
 
 <div>
-  <h3>Associate new credentials:</h3>
+  <h3>Associate new OAuth credentials:</h3>
   <ul>
     <li>
       <a rel="nofollow" href="/associate/twitter/">Twitter</a>
       <a rel="nofollow" href="/associate/orkut/">Orkut</a>
       {% if orkut %}<span class="associated">(associated)</span>{% endif %}
     </li>
+    <li>
+      <a rel="nofollow" href="/associate/google-oauth/">Google</a>
+      {% if google_oauth %}<span class="associated">(associated)</span>{% endif %}
+    </li>
+  </ul>
+
+  <h3>Associate new OpenID credentials:</h3>
+  <ul>
     <li>
       <a rel="nofollow" href="/associate/google/">Google</a>
       {% if google %}<span class="associated">(associated)</span>{% endif %}
index aae415a18da760983f68cef6a7e5ca39d15f6467..30b091f22c397c4a0938d8edaa4c872a43e2a895 100644 (file)
@@ -9,6 +9,7 @@
     <li><a rel="nofollow" href="/login/twitter/">Twitter</a></li>
     <li><a rel="nofollow" href="/login/facebook/">Facebook</a></li>
     <li><a rel="nofollow" href="/login/orkut/">Orkut</a></li>
+    <li><a rel="nofollow" href="/login/google-oauth/">Google OAuth</a></li>
   </ul>
 </div>