1 <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US" type="text/javascript"></script>
\r
2 <script type="text/javascript">
\r
3 var FB_API_KEY = "{{ provider.API_KEY }}";
\r
4 var FB_CHANNEL_PATH = "{% url xd_receiver %}";
\r
6 FB.init(FB_API_KEY, FB_CHANNEL_PATH, {permsToRequestOnConnect : "email"});
\r
8 function FB_ConnectPostAuthorization() {
\r
9 if ($('#validate_email').attr('checked')) {
\r
10 FB_RequireFeatures(["Api"], function(){
\r
11 var api = FB.Facebook.apiClient;
\r
12 var fb_uid = api.get_session().uid;
\r
14 $.post('{% url facebook_user_is_registered %}', {'fb_uid': fb_uid}, function(response) {
\r
15 if (response != "yes") {
\r
16 api.users_hasAppPermission("email", function(result) {
\r
18 FB.Connect.showPermissionDialog("email", redirect_to_done_page);
\r
20 redirect_to_done_page()
\r
24 redirect_to_done_page()
\r
29 redirect_to_done_page();
\r
33 function redirect_to_done_page() {
\r
34 window.location = "{% url auth_provider_done provider=provider.id %}";
\r
38 <fb:login-button v="2" size="medium" onlogin="FB_ConnectPostAuthorization()">Facebook</fb:login-button>