mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 17:05:17 +00:00
added ability to authorith on github
This commit is contained in:
parent
387f95c63e
commit
13870902f9
2 changed files with 28 additions and 9 deletions
|
|
@ -609,7 +609,7 @@ CloudClient.Util = (function(){
|
|||
this.isContainStr = function(pStr1, pStr2){
|
||||
return pStr1 &&
|
||||
pStr2 &&
|
||||
pStr1.indexOf(pStr2) > 0;
|
||||
pStr1.indexOf(pStr2) >= 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue