From a26e4c74701dd05e41ccd611445f9a7c3663991a Mon Sep 17 00:00:00 2001 From: RiverAge Date: Sat, 8 Jul 2017 20:29:02 +0800 Subject: [PATCH] fix: proper error message when login with wechat fails (#4000) * fix typo it should be weixin not qq. * change error message from weixin to wechat * remove unnecessary check --- src/Adapters/Auth/vkontakte.js | 2 +- src/Adapters/Auth/wechat.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Adapters/Auth/vkontakte.js b/src/Adapters/Auth/vkontakte.js index 7a445566..8c9bd5ef 100644 --- a/src/Adapters/Auth/vkontakte.js +++ b/src/Adapters/Auth/vkontakte.js @@ -9,7 +9,7 @@ var logger = require('../../logger').default; // Returns a promise that fulfills iff this user id is valid. function validateAuthData(authData, params) { return vkOAuth2Request(params).then(function (response) { - if (response && response && response.access_token) { + if (response && response.access_token) { return request("api.vk.com", "method/secure.checkToken?token=" + authData.access_token + "&client_secret=" + params.appSecret + "&access_token=" + response.access_token).then(function (response) { if (response && response.response && response.response.user_id == authData.id) { return; diff --git a/src/Adapters/Auth/wechat.js b/src/Adapters/Auth/wechat.js index 9432b7c5..e42d5c36 100644 --- a/src/Adapters/Auth/wechat.js +++ b/src/Adapters/Auth/wechat.js @@ -8,7 +8,7 @@ function validateAuthData(authData) { if (data.errcode == 0) { return; } - throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'qq auth is invalid for this user.'); + throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'wechat auth is invalid for this user.'); }); } @@ -34,7 +34,7 @@ function graphRequest(path) { resolve(data); }); }).on('error', function () { - reject('Failed to validate this access token with weixin.'); + reject('Failed to validate this access token with wechat.'); }); }); }