added ability to authorith on github

This commit is contained in:
coderaiser 2012-10-25 10:41:23 -04:00
parent 387f95c63e
commit 13870902f9
2 changed files with 28 additions and 9 deletions

View file

@ -609,7 +609,7 @@ CloudClient.Util = (function(){
this.isContainStr = function(pStr1, pStr2){
return pStr1 &&
pStr2 &&
pStr1.indexOf(pStr2) > 0;
pStr1.indexOf(pStr2) >= 0;
};
/**

View file

@ -30,6 +30,7 @@ var CloudCommander, Github;
function(){
console.timeEnd('github load');
Util.Images.hideLoad();
init();
});
}
@ -41,19 +42,37 @@ var CloudCommander, Github;
console.log(pDate);
}
GithubStore.login = function(pUser, pPasswd){
/* PUBLICK FUNCTIONS */
GithubStore.basicLogin = function(pUser, pPasswd){
cloudcmd.Storage.Github = new Github({
username: pUser,
password: pPasswd,
auth : 'oauth'
auth : 'basic'
});
};
/* PUBLICK FUNCTIONS */
/**
* function bind keys
*/
cloudcmd.Storage.Keys = function(){
GithubStore.Login = function(pToken){
cloudcmd.Storage.Github = new Github({
token : pToken,
auth : 'oauth'
});
};
function init(){
var lTokin = window.location.search;
if ( Util.isContainStr(lTokin, '?code=') )
lTokin = lTokin.replace('?code=','');
GithubStore.Login(lTokin);
}
cloudcmd.Auth = function(){
window.location =
'https://github.com/login/oauth/authorize?client_id=' +
'891c251b925e4e967fa9';
};
cloudcmd.Storage.Keys = function(){
load();
};