added ability to authorize on github thru new window, changed redirecting url to /auth and added rout function to cloudcmd.js

This commit is contained in:
coderaiser 2012-12-18 06:32:58 -05:00
parent 32ed528c38
commit 9ce26c1640
9 changed files with 76 additions and 80 deletions

View file

@ -51,15 +51,16 @@ var CloudCommander, Util, DOM, $, Github, cb;
});
}
function init(pCallBack){
GithubStore.init = function(pCallBack, pCode){
var lToken = Cache.get('token');
if(lToken){
GithubStore.Login(lToken);
Util.exec(pCallBack);
}
else{
var lCode = window.location.search;
if ( Util.isContainStr(lCode, '?code=') ){
var lCode = pCode || window.location.search;
if (pCode || Util.isContainStr(lCode, '?code=') ){
lCode = lCode.replace('?code=','');
var lSuccess = function(pData){
@ -83,14 +84,17 @@ var CloudCommander, Util, DOM, $, Github, cb;
DOM.ajax(lData);
}
else
//window.open('welcome.html', 'welcome','width=300,height=200,menubar=yes,status=yes')">
window.open('https://github.com/login/oauth/authorize?client_id=' +
GitHub_ID + '&&scope=repo,user,gist', 'Cloud Commander Auth');
/*
window.location =
'https://github.com/login/oauth/authorize?client_id=' +
GitHub_ID + '&&scope=repo,user,gist';
*/
}
}
};
function getUserData(pCallBack){
GithubStore.getUserData = function(pCallBack){
var lName,
lShowUserInfo = function(pError, pData){
@ -163,8 +167,8 @@ var CloudCommander, Util, DOM, $, Github, cb;
cloudcmd.GitHub.init = function(pCallBack){
Util.loadOnLoad([
Util.retExec(pCallBack),
getUserData,
init,
GithubStore.getUserData,
GithubStore.init,
setConfig,
load
]);