fix _authenticate call to always pass the json object

This commit is contained in:
blagoev 2017-09-12 20:26:08 +03:00
parent a51ea72151
commit 3fbd1291e1
1 changed files with 7 additions and 16 deletions

View File

@ -152,7 +152,7 @@ function _authenticate(userConstructor, server, json, callback) {
callback(null, user); callback(null, user);
}) })
.catch(err => { .catch(err => {
callback(err) callback(err);
}); });
} else { } else {
return promise; return promise;
@ -188,11 +188,9 @@ const staticMethods = {
user_info: { password: password, register: true }, user_info: { password: password, register: true },
data: username data: username
}; };
if (callback) {
_authenticate(this, server, json, callback); _authenticate(this, server, json, callback);
} else {
return _authenticate(this, server)
}
}, },
login(server, username, password, callback) { login(server, username, password, callback) {
@ -202,11 +200,8 @@ const staticMethods = {
user_info: { password: password }, user_info: { password: password },
data: username data: username
}; };
if (callback) {
_authenticate(this, server, json, callback); _authenticate(this, server, json, callback);
} else {
return _authenticate(this, server)
}
}, },
registerWithProvider(server, options, callback) { registerWithProvider(server, options, callback) {
@ -233,11 +228,7 @@ const staticMethods = {
json.user_info = options.userInfo; json.user_info = options.userInfo;
} }
if (callback) {
_authenticate(this, server, json, callback); _authenticate(this, server, json, callback);
} else {
return _authenticate(this, server)
}
}, },
_refreshAccessToken: refreshAccessToken _refreshAccessToken: refreshAccessToken