Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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