Created
January 16, 2013 07:40
-
-
Save hysios/4545325 to your computer and use it in GitHub Desktop.
AjaxAuth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// client = new AjaxAuthClient({ | |
// | |
// }) | |
// AjaxAuth.registerDialog(function(element){ | |
// $(element) | |
// .appendTo('body') | |
// .addClass('center_model') | |
// .width(400) | |
// .height(500) | |
// .fadeIn(); | |
// }) | |
// | |
// AJaxAuth.onSuccess(funciton(user){ | |
// | |
// }) | |
// | |
// 登陆 | |
// AjaxAuth.signin(); | |
// 注册 | |
// AjaxAuth.signup(); | |
// | |
// | |
OmniAuthClient = function(){ | |
this.setupAuthCallback(); | |
} | |
OmniAuthClient.prototype.setupAuthCallback = function(xhr){ | |
$(document).ajaxComplete(function(xhr){ | |
var url = xhr.getResponseHeader("sso_auth_url"); | |
var data = JSON.parse(xhr.getResponseHeader("sso_auth_params")); | |
$.ajax({ | |
url : url, | |
data : data, | |
dataType : "jsonp", | |
jsonpCallback : this.default_params.jsonp_callback_name | |
}); | |
}) | |
} | |
OmniAuthClient.prototype.sendParentSuccess = function(){ | |
if(!$.pm){ | |
console.error("include postMessage.js file ? "); | |
return | |
} | |
//登陆成功触发iframe的父类消息,告诉它登陆成功 | |
pm({ target : window.parent, type : this.default_params.pm_type, data : true }); | |
} | |
var AjaxAuthClient = function(options){ | |
} | |
window.AjaxAuth ||= new AjaxAuthClient; | |
AjaxAuth. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment