o3-panther-cli
Version:
Panther CLI for developing and editing sites.
23 lines (22 loc) • 677 B
JavaScript
const path = require('path');
const request = require('request-promise').defaults({ jar: true });
const cnf = require(path.resolve(process.cwd(), 'o3.json'));
module.exports = (info) => {
var options = {
method: 'POST',
uri: (info.https ? 'https://' : 'http://') + info.uri,
form: {
username: info.user,
password: info.pass
},
simple: false,
headers: {
'content-type': 'application/x-www-form-urlencoded'
}
};
return request(options).then((data) => {
if (data.indexOf('Found. Redirecting to') < 0) {
throw new Error('Login failed');
}
});
}