Skip to content

Commit a7b2fa0

Browse files
authored
refactor: Copy ignoreEmailVerification from option to data (#2107)
1 parent c591895 commit a7b2fa0

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

src/ParseUser.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,11 @@ class ParseUser extends ParseObject {
546546
/**
547547
* Verify whether a given password is the password of the current user.
548548
*
549-
* @param {string} password A password to be verified
550-
* @param {object} options
551-
* @returns {Promise} A promise that is fulfilled with a user
552-
* when the password is correct.
549+
* @param {string} password The password to be verified.
550+
* @param {object} options The options.
551+
* @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
552+
* the password regardless of whether the email has been verified. This requires the master key.
553+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
553554
*/
554555
verifyPassword(password: string, options?: RequestOptions): Promise<ParseUser> {
555556
const username = this.getUsername() || '';
@@ -865,13 +866,14 @@ class ParseUser extends ParseObject {
865866

866867
/**
867868
* Verify whether a given password is the password of the current user.
868-
*
869-
* @param {string} username A username to be used for identificaiton
870-
* @param {string} password A password to be verified
871-
* @param {object} options
872869
* @static
873-
* @returns {Promise} A promise that is fulfilled with a user
874-
* when the password is correct.
870+
*
871+
* @param {string} username The username of the user whose password should be verified.
872+
* @param {string} password The password to be verified.
873+
* @param {object} options The options.
874+
* @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify
875+
* the password regardless of whether the email has been verified. This requires the master key.
876+
* @returns {Promise} A promise that is fulfilled with a user when the password is correct.
875877
*/
876878
static verifyPassword(username: string, password: string, options?: RequestOptions) {
877879
if (typeof username !== 'string') {
@@ -1262,7 +1264,12 @@ const DefaultController = {
12621264

12631265
verifyPassword(username: string, password: string, options: RequestOptions) {
12641266
const RESTController = CoreManager.getRESTController();
1265-
return RESTController.request('GET', 'verifyPassword', { username, password }, options);
1267+
const data = {
1268+
username,
1269+
password,
1270+
...(options.ignoreEmailVerification !== undefined && { ignoreEmailVerification: options.ignoreEmailVerification }),
1271+
};
1272+
return RESTController.request('GET', 'verifyPassword', data, options);
12661273
},
12671274

12681275
requestEmailVerification(email: string, options: RequestOptions) {

src/RESTController.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,6 @@ const RESTController = {
250250
}
251251
}
252252

253-
if (options.ignoreEmailVerification !== undefined) {
254-
payload.ignoreEmailVerification = options.ignoreEmailVerification;
255-
}
256-
257253
if (CoreManager.get('FORCE_REVOCABLE_SESSION')) {
258254
payload._RevocableSession = '1';
259255
}

0 commit comments

Comments
 (0)