1var RegistrationBehaviorObj = null; 2 3RegistrationBehavior = function (ServiceUrl, FBAppId, redirectUrl) { 4 this.Proxy = new serviceProxy(ServiceUrl); 5 6 this.FBAppId = FBAppId; 7 8 this.RedirectUrl = redirectUrl; 9 10 if (this.FBAppId != "") { 11 btnSignup = $("#FBsignup"); 12 btnSignup.css("display", ""); 13 14 btnSignup.unbind("click").click(function () { 15 RegistrationBehaviorObj.FBSignUp(); 16 }); 17 18 19 if (window.fbAsyncInit == null) 20 { 21 window.fbAsyncInit = function () { 22 FB.init({ 23 appId: FBAppId,//'418301024905516', // App ID 24 status: true, // check login status 25 cookie: true, // enable cookies to allow the server to access the session 26 xfbml: true // parse XFBML 27 }); 28 29 } 30 // Additional initialization code here 31 32 33 }; 34 35 // Load the SDK Asynchronously 36 (function (d) { 37 var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; 38 if (d.getElementById(id)) { return; } 39 js = d.createElement('script'); js.id = id; js.async = true; 40 js.src = "//connect.facebook.net/en_US/all.js"; 41 ref.parentNode.insertBefore(js, ref); 42 }(document)); 43 44 (function (d) { 45 var js, id = 'jqueryui', ref = d.getElementsByTagName('script')[0]; 46 if (d.getElementById(id)) { return; } 47 js = d.createElement('script'); js.id = id; js.async = true; 48 js.src = "//code.jquery.com/ui/1.9.2/jquery-ui.js"; 49 ref.parentNode.insertBefore(js, ref); 50 }(document)); 51 52 } 53} 54 55 56RegistrationBehavior.prototype = { 57 FBSignUp: function () { 58 redirectUrl = this.RedirectUrl; 59 proxy = this.Proxy; 60 FB.login(function (response) { 61 if (response.status === 'connected') { 62 63 64 // the user is logged in and has authenticated your 65 // app, and response.authResponse supplies 66 // the user's ID, a valid access token, a signed 67 // request, and the time the access token 68 // and signed request each expire 69 var uid = response.authResponse.userID; 70 var accessToken = response.authResponse.accessToken; 71 72 73 // TODO: Handle the access token 74 proxy.invoke("FacebookLogin", { isLogin: false, accessToken: accessToken }, 75 function (FacebookLogin) { 76 if (FacebookLogin.IsLoggedIn) { 77 location.href = redirectUrl; 78 } 79 else { 80 81 txbEmail = $("#BSEmailFBsignup"); 82 txbPassword = $("#BSPasswordFBsignup"); 83 txbPassword.val(""); 84 txbEmail.val(FacebookLogin.Email); 85 if (FacebookLogin.Email != "") 86 txbEmail.attr("disabled", true); 87 else 88 txbEmail.removeAttr("disabled"); 89 90 form = $("#BSCredentialsFormFBsignup"); 91 form.css("display", ""); 92 93 // Popup login 94 form.dialog({ 95 autoOpen: true, 96 height: 300, 97 width: 350, 98 modal: true, 99 buttons: { 100 "Submit": function () { 101 102 // Call ws 103 proxy.invoke("FacebookLoginAuthorization", { 104 accessToken: accessToken, 105 BSusername: txbEmail.val(), 106 BSpassword: txbPassword.val() 107 }, 108 function (FacebookLogin) { 109 if (FacebookLogin.IsLoggedIn) { 110 location.href = redirectUrl; 111 } 112 else { 113 alert(FacebookLogin.Message); 114 } 115 }, 116 function (result) { 117 alert("KO"); 118 } 119 ); 120 121 122 $(this).dialog("close"); 123 124 }, 125 Cancel: function () { 126 $(this).dialog("close"); 127 } 128 }, 129 close: function () { 130 } 131 }); 132 133 } 134 135 }, 136 function (result) { 137 alert("KO"); 138 } 139 ); 140 141 } else if (response.status === 'not_authorized') { 142 // the user is logged in to Facebook, 143 // but has not authenticated your app 144 alert("You didn't give the permissions to the application"); 145 } else { 146 // the user isn't logged in to Facebook. 147 alert("You are not registered in the system"); 148 } 149 }, { scope: 'email, user_birthday' }); 150 151 152 } 153}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.