Throw a descriptive error if accountName or password is missing in login

Closes #119
This commit is contained in:
Alexander Corn
2017-01-04 00:07:33 -05:00
parent 5a5c5373aa
commit 3964af7ade

View File

@@ -56,7 +56,11 @@ function SteamCommunity(options) {
}
SteamCommunity.prototype.login = function(details, callback) {
if(details.steamguard) {
if (!details.accountName || !details.password) {
throw new Error("Missing either accountName or password to login; both are needed");
}
if (details.steamguard) {
var parts = details.steamguard.split('||');
this._setCookie(Request.cookie('steamMachineAuth' + parts[0] + '=' + encodeURIComponent(parts[1])), true);
}