]> git.openstreetmap.org Git - osqa.git/blob - forum_modules/facebookauth/templates/button.html
403ef71b12e6b742e897be83e1af5c35f9b0a112
[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     function check_login_status() {\r
7         var FB_API_KEY = "{{ provider.API_KEY }}";\r
8         FB.init({\r
9             appId:FB_API_KEY, cookie:true,\r
10             status:true, xfbml:true, oauth:true\r
11         });\r
12         FB.getLoginStatus(function(response) {\r
13             if (response.session) {\r
14                 redirect_to_done_page();\r
15             } else {\r
16                 FB.login(function(response) {\r
17                     if (response.session) {\r
18                       redirect_to_done_page();\r
19                     } else {\r
20                       // user cancelled login\r
21                     }\r
22                 }, {perms:'email'});\r
23             }\r
24         });\r
25     }\r
26 \r
27     function redirect_to_done_page() {\r
28         window.location = "{% url auth_provider_done provider=provider.id %}";\r
29     }\r
30 </script>\r
31 <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