Skip to content

Commit

Permalink
Merge pull request #98 from cr0wst/devel
Browse files Browse the repository at this point in the history
Added the ability to specify a login domain as a config parameter.  P…
  • Loading branch information
macbre committed Apr 21, 2016
2 parents 2b2face + b26db48 commit d5ee81b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Config file is a JSON-encoded object with the following fields (see ``/examples/
"debug": false, // is more verbose when set to true
"username": "foo", // account to be used when logIn is called (optional)
"password": "bar", // password to be used when logIn is called (optional)
"domain" : "auth.bar.net", // domain to be used when logIn is called (optional)
"userAgent": "Custom UA", // define custom bot's user agent
"concurrency": 5 // how many API requests can be run in parallel (defaults to 3)
}
Expand Down
1 change: 1 addition & 0 deletions examples/config-DIST.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"debug": false,
"username": "foo",
"password": "bar",
"domain" : "auth.bar.net",
"userAgent": "foo/bar.net",
"concurrency": 5
}
9 changes: 7 additions & 2 deletions lib/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ module.exports = (function() {
password = this.options.password;
}

// assign domain if applicable
var domain = this.options.domain || '';

this.log('Obtaining login token...');

const logInCallback = function(err, data) {
Expand All @@ -174,7 +177,8 @@ module.exports = (function() {
this.api.call({
action: 'login',
lgname: username,
lgpassword: password
lgpassword: password,
lgdomain: domain
}, function(err, data) {
if (err) {
callback(err);
Expand All @@ -191,7 +195,8 @@ module.exports = (function() {
action: 'login',
lgname: username,
lgpassword: password,
lgtoken: token
lgtoken: token,
lgdomain: domain
}, logInCallback, 'POST');
} else {
logInCallback(err, data);
Expand Down

0 comments on commit d5ee81b

Please sign in to comment.