Permalink
Browse files

with --cookies-file and check for login

  • Loading branch information...
fayland committed Nov 10, 2013
1 parent 512038c commit ff21daa956b6f79b4dcd9e671a889973f686e604
Showing with 13 additions and 8 deletions.
  1. +2 −2 app.js
  2. +11 −6 googleplus.js
View
4 app.js
@@ -51,7 +51,7 @@ function postUpdatedToGoogle(){
_.each(updates,function(el,i,list){
console.log('Posting update to google+ : ' ,el.text);
work_dir = (process.env["WORKING_DIR"])? process.env["WORKING_DIR"] : require('path').join(__dirname);
exec('cd ' +work_dir+';casperjs googleplus.js --username='+ config.google_conf.email +' --password='+config.google_conf.password+' --text="'+ el.text +'"',function(e,stdout,stderr){
exec('cd ' +work_dir+';casperjs googleplus.js --cookies-file=cookies.txt --username='+ config.google_conf.email +' --password='+config.google_conf.password+' --text="'+ el.text +'"',function(e,stdout,stderr){
sys.puts(stdout);
console.log(e);
});
@@ -101,4 +101,4 @@ function bufferAPI(url,callback,params){
function puts(error, stdout, stderr) {
sys.puts(stdout)
}
}
View
@@ -18,14 +18,19 @@ username = casper.cli.get("username")
password = casper.cli.get("password")
text = casper.cli.get("text")
casper.start('https://accounts.google.com/ServiceLogin?hl=en&continue=https://www.google.com/ncr', function LoginWithGoogle() {
casper.start('https://www.google.com/ncr', function () {
this.viewport(800, 600);
console.info('Starting Casper');
this.fillSelectors('form#gaia_loginform', {
'input[name="Email"]': username,
'input[name="Passwd"]': password
}, true);
if (! (this.getHTML().indexOf(username) > -1)) {
console.info('## Login ...');
this.thenOpen('https://accounts.google.com/ServiceLogin?hl=en&continue=https://www.google.com/ncr', function() {
this.fillSelectors('form#gaia_loginform', {
'input[name="Email"]': username,
'input[name="Passwd"]': password
}, true);
});
}
});
casper.then(function CheckIfGoogleWantsVerification(){

0 comments on commit ff21daa

Please sign in to comment.