Permalink
Browse files

logout from facebook

  • Loading branch information...
1 parent b9545c2 commit c2431f1ffcedea88b1e1b50ef00a662d4a20bf25 @tuxcanfly tuxcanfly committed Jul 2, 2010
@@ -12,6 +12,29 @@
<body>
<h1>social-auth</h1>
+ {% if FACEBOOK_APP_ID %}
+ <div id="fb-root"></div>
+ <script>
+ window.fbAsyncInit = function() {
+ FB.init({appId: '{{ FACEBOOK_APP_ID }}', status: true, cookie: true, xfbml: true});
+ FB.Event.subscribe('auth.sessionChange', function(response) {
+ if (response.session) {
+ window.location = '{% url socialauth_facebook_login_done %}';
+ } else {
+ //window.location = '{% url socialauth_social_logout %}';
+ }
+ });
+ };
+ (function() {
+ var e = document.createElement('script');
+ e.type = 'text/javascript';
+ e.src = document.location.protocol +
+ '//connect.facebook.net/en_US/all.js';
+ e.async = true;
+ document.getElementById('fb-root').appendChild(e);
+ }());
+ </script>
+ {% endif %}
{% block extra_body %}
{% endblock %}
@@ -42,32 +42,10 @@
<p>Please click your account provider:</p>
<div id="openid_btns">
- {% if FACEBOOK_APP_ID %}
+ {% if FACEBOOK_APP_ID %}
<div id="facebook">
<p><fb:login-button perms="{{ login_button_perms }}"></fb:login-button></p>
- </div>
-
- <div id="fb-root"></div>
- <script>
- window.fbAsyncInit = function() {
- FB.init({appId: '{{ FACEBOOK_APP_ID }}', status: true, cookie: true, xfbml: true});
- FB.Event.subscribe('auth.sessionChange', function(response) {
- if (response.session) {
- window.location = '{% url socialauth_facebook_login_done %}';
- } else {
- //window.location = '{% url socialauth_social_logout %}';
- }
- });
- };
- (function() {
- var e = document.createElement('script');
- e.type = 'text/javascript';
- e.src = document.location.protocol +
- '//connect.facebook.net/en_US/all.js';
- e.async = true;
- document.getElementById('fb-root').appendChild(e);
- }());
- </script>
+ </div>
{% endif %}
<div id="linkedin">
@@ -3,6 +3,6 @@
{% block main_content %}
You have signed in.<br/>
-<a href="{% url socialauth_social_logout %}">Logout</a>
+<a onclick="FB.logout(); window.location='{% url socialauth_social_logout %}';" href="#">Logout</a>
{% endblock %}

0 comments on commit c2431f1

Please sign in to comment.