diff --git a/src/ParseUser.js b/src/ParseUser.js index 9347d1239..26dec8820 100644 --- a/src/ParseUser.js +++ b/src/ParseUser.js @@ -546,10 +546,11 @@ class ParseUser extends ParseObject { /** * Verify whether a given password is the password of the current user. * - * @param {string} password A password to be verified - * @param {object} options - * @returns {Promise} A promise that is fulfilled with a user - * when the password is correct. + * @param {string} password The password to be verified. + * @param {object} options The options. + * @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify + * the password regardless of whether the email has been verified. This requires the master key. + * @returns {Promise} A promise that is fulfilled with a user when the password is correct. */ verifyPassword(password: string, options?: RequestOptions): Promise { const username = this.getUsername() || ''; @@ -865,13 +866,14 @@ class ParseUser extends ParseObject { /** * Verify whether a given password is the password of the current user. - * - * @param {string} username A username to be used for identificaiton - * @param {string} password A password to be verified - * @param {object} options * @static - * @returns {Promise} A promise that is fulfilled with a user - * when the password is correct. + * + * @param {string} username The username of the user whose password should be verified. + * @param {string} password The password to be verified. + * @param {object} options The options. + * @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify + * the password regardless of whether the email has been verified. This requires the master key. + * @returns {Promise} A promise that is fulfilled with a user when the password is correct. */ static verifyPassword(username: string, password: string, options?: RequestOptions) { if (typeof username !== 'string') { @@ -1262,7 +1264,12 @@ const DefaultController = { verifyPassword(username: string, password: string, options: RequestOptions) { const RESTController = CoreManager.getRESTController(); - return RESTController.request('GET', 'verifyPassword', { username, password }, options); + const data = { + username, + password, + ...(options.ignoreEmailVerification !== undefined && { ignoreEmailVerification: options.ignoreEmailVerification }), + }; + return RESTController.request('GET', 'verifyPassword', data, options); }, requestEmailVerification(email: string, options: RequestOptions) { diff --git a/src/RESTController.js b/src/RESTController.js index 73c962cff..552c3d058 100644 --- a/src/RESTController.js +++ b/src/RESTController.js @@ -250,10 +250,6 @@ const RESTController = { } } - if (options.ignoreEmailVerification !== undefined) { - payload.ignoreEmailVerification = options.ignoreEmailVerification; - } - if (CoreManager.get('FORCE_REVOCABLE_SESSION')) { payload._RevocableSession = '1'; }