From 986dc910115de75e6da17c9dcadbf73614339ed8 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Fri, 12 Apr 2024 19:34:47 -0500 Subject: [PATCH 1/3] fix: Incorrecly use `ignoreEmailVerification` option on `Parse.User.verifyPassword` --- src/RESTController.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/RESTController.js b/src/RESTController.js index 73c962cff..3b410b05a 100644 --- a/src/RESTController.js +++ b/src/RESTController.js @@ -249,15 +249,9 @@ const RESTController = { throw new Error('Cannot use the Master Key, it has not been provided.'); } } - - if (options.ignoreEmailVerification !== undefined) { - payload.ignoreEmailVerification = options.ignoreEmailVerification; - } - if (CoreManager.get('FORCE_REVOCABLE_SESSION')) { payload._RevocableSession = '1'; } - const installationId = options.installationId; let installationIdPromise; if (installationId && typeof installationId === 'string') { From 9abd5a05d6efe4d3fc70a724844eba8ff8b1e9d3 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Fri, 12 Apr 2024 19:54:23 -0500 Subject: [PATCH 2/3] refactor: Add missing test for Parse.User.verifyPassword option ignoreEmailVerification --- src/__tests__/RESTController-test.js | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/__tests__/RESTController-test.js b/src/__tests__/RESTController-test.js index 02d72e94d..5c70496a4 100644 --- a/src/__tests__/RESTController-test.js +++ b/src/__tests__/RESTController-test.js @@ -647,6 +647,39 @@ describe('RESTController', () => { }); }); + it('can handle ignoreEmailVerification option', async () => { + const xhr = { + setRequestHeader: jest.fn(), + open: jest.fn(), + send: jest.fn(), + }; + RESTController._setXHR(function () { + return xhr; + }); + RESTController.request( + 'GET', + 'verifyPassword', + { username: 'parseuser', password: 'parsepass' }, + { ignoreEmailVerification: true } + ); + await flushPromises(); + expect(xhr.open.mock.calls[0]).toEqual([ + 'POST', + 'https://api.parse.com/1/verifyPassword', + true, + ]); + expect(JSON.parse(xhr.send.mock.calls[0][0])).toEqual({ + _method: 'GET', + _ApplicationId: 'A', + _JavaScriptKey: 'B', + _ClientVersion: 'V', + _InstallationId: 'iid', + ignoreEmailVerification: true, + username: 'parseuser', + password: 'parsepass', + }); + }); + it('can handle wechat request', async () => { const XHR = require('../Xhr.weapp'); const xhr = new XHR(); From 30718b24ce74078587ab6005aa7e37e64c86c8e2 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Fri, 12 Apr 2024 19:56:10 -0500 Subject: [PATCH 3/3] clean up test --- src/RESTController.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/RESTController.js b/src/RESTController.js index 3b410b05a..73c962cff 100644 --- a/src/RESTController.js +++ b/src/RESTController.js @@ -249,9 +249,15 @@ const RESTController = { throw new Error('Cannot use the Master Key, it has not been provided.'); } } + + if (options.ignoreEmailVerification !== undefined) { + payload.ignoreEmailVerification = options.ignoreEmailVerification; + } + if (CoreManager.get('FORCE_REVOCABLE_SESSION')) { payload._RevocableSession = '1'; } + const installationId = options.installationId; let installationIdPromise; if (installationId && typeof installationId === 'string') {