From 3fbd1291e134ae39d9bf7fc45076eab394f1fd4f Mon Sep 17 00:00:00 2001 From: blagoev Date: Tue, 12 Sep 2017 20:26:08 +0300 Subject: [PATCH] fix _authenticate call to always pass the json object --- lib/user-methods.js | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/lib/user-methods.js b/lib/user-methods.js index 0b2d9d4e..16335c39 100644 --- a/lib/user-methods.js +++ b/lib/user-methods.js @@ -152,7 +152,7 @@ function _authenticate(userConstructor, server, json, callback) { callback(null, user); }) .catch(err => { - callback(err) + callback(err); }); } else { return promise; @@ -188,11 +188,9 @@ const staticMethods = { user_info: { password: password, register: true }, data: username }; - if (callback) { - _authenticate(this, server, json, callback); - } else { - return _authenticate(this, server) - } + + _authenticate(this, server, json, callback); + }, login(server, username, password, callback) { @@ -202,11 +200,8 @@ const staticMethods = { user_info: { password: password }, data: username }; - if (callback) { - _authenticate(this, server, json, callback); - } else { - return _authenticate(this, server) - } + + _authenticate(this, server, json, callback); }, registerWithProvider(server, options, callback) { @@ -233,11 +228,7 @@ const staticMethods = { json.user_info = options.userInfo; } - if (callback) { - _authenticate(this, server, json, callback); - } else { - return _authenticate(this, server) - } + _authenticate(this, server, json, callback); }, _refreshAccessToken: refreshAccessToken