Skip to content

Commit

Permalink
Merge branch 'alpha' into notEqualTo-null
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrezza authored Apr 13, 2024
2 parents 9b13440 + a7b2fa0 commit 0062232
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
29 changes: 18 additions & 11 deletions src/ParseUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<ParseUser> {
const username = this.getUsername() || '';
Expand Down Expand Up @@ -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') {
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 0 additions & 4 deletions src/RESTController.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,6 @@ const RESTController = {
}
}

if (options.ignoreEmailVerification !== undefined) {
payload.ignoreEmailVerification = options.ignoreEmailVerification;
}

if (CoreManager.get('FORCE_REVOCABLE_SESSION')) {
payload._RevocableSession = '1';
}
Expand Down

0 comments on commit 0062232

Please sign in to comment.