]> git.openstreetmap.org Git - osqa.git/blob - forum_modules/facebookauth/templates/button.html
ba03a30e88f58a2cf9cabb20c47dfa9642807015
[osqa.git] / forum_modules / facebookauth / templates / button.html
1 {% load extra_tags %}\r
2 \r
3 <div id="fb-root"></div>\r
4 <script src="http://connect.facebook.net/en_US/all.js"></script>\r
5 <script>\r
6     var FB_API_KEY = "{{ provider.API_KEY }}";\r
7     FB.init({\r
8         appId:FB_API_KEY, cookie:true,\r
9         status:true, xfbml:true\r
10     });\r
11 \r
12     function check_login_status() {\r
13         FB.getLoginStatus(function(response) {\r
14             if (response.session) {\r
15                 redirect_to_done_page();\r
16             } else {\r
17                 FB.login(function(response) {\r
18                     if (response.session) {\r
19                       redirect_to_done_page();\r
20                     } else {\r
21                       // user cancelled login\r
22                     }\r
23                 });\r
24             }\r
25         });\r
26     }\r
27 \r
28     function redirect_to_done_page() {\r
29         window.location = "{% url auth_provider_done provider=provider.id %}";\r
30     }\r
31 </script>\r
32 <a style="position: relative; top: -8px;" href="javascript:void(0);" onclick="check_login_status()" perms="email"><img src="{% media '/media/images/openid/facebook.gif' %}" /></a>\r