diff options
| -rw-r--r-- | fb/templates/fb_gateway.html | 0 | ||||
| -rw-r--r-- | fb/templates/fb_js.html | 30 | ||||
| -rw-r--r-- | fb/views.py | 8 |
3 files changed, 28 insertions, 10 deletions
diff --git a/fb/templates/fb_gateway.html b/fb/templates/fb_gateway.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/fb/templates/fb_gateway.html diff --git a/fb/templates/fb_js.html b/fb/templates/fb_js.html index 199281c..da728ac 100644 --- a/fb/templates/fb_js.html +++ b/fb/templates/fb_js.html @@ -1,11 +1,23 @@ <div id="fb-root"></div> - -<script src="http://connect.facebook.net/en_US/all.js"></script> <script> - FB.init({ - appId : '{{ FACEBOOK_APP_ID }}', - status : true, // check login status - cookie : true, // enable cookies to allow the server to access the session - xfbml : true // parse XFBML - }); -</script>
\ No newline at end of file + window.fbAsyncInit = function() { + FB.init({ + appId: '{{ FACEBOOK_APP_ID }}', + status: true, + cookie: true, + xfbml: true + }); + + FB.Event.subscribe('auth.sessionChange', function(res) { + if (res.session) { + alert('authenticated!'); + } + }); + }; + (function() { + var e = document.createElement('script'); e.async = true; + e.src = document.location.protocol + + '//connect.facebook.net/en_US/all.js'; + document.getElementById('fb-root').appendChild(e); + }()); +</script> diff --git a/fb/views.py b/fb/views.py index 60f00ef..1ef23c5 100644 --- a/fb/views.py +++ b/fb/views.py @@ -1 +1,7 @@ -# Create your views here. +from django.contrib import auth +from django.http import HttpResponse, HttpResponseRedirect +from django.shortcuts import render_to_response +from django.template import RequestContext + +def index(request): + return render_to_response('index.html', {}, context_instance=RequestContext(request)) |
