diff --git a/src/ParseUser.js b/src/ParseUser.js
index 7cea738aa..8b16f0851 100644
--- a/src/ParseUser.js
+++ b/src/ParseUser.js
@@ -420,6 +420,33 @@ class ParseUser extends ParseObject {
return controller.logIn(this, loginOptions);
}
+ /**
+ * Requires email change for user. It save new email into field
+ * emailNew
.
+ *
+ *
Calls options.success or options.error on completion.
+ * + + * @param {string} email + * @param {Object} options + * @return {Promise} A promise that is fulfilled when + * the operation is complete. + */ + requestEmailChange(email: string, options: FullOptions): Promise { + options = options || {}; + + var requestOptions = {}; + if (options.hasOwnProperty('useMasterKey')) { + requestOptions.useMasterKey = options.useMasterKey; + } + if (options.hasOwnProperty('installationId')) { + requestOptions.installationId = options.installationId; + } + + var controller = CoreManager.getUserController(); + return controller.requestEmailChange(this, email, requestOptions); + } + /** * Wrap the default save behavior with functionality to save to local * storage if this is current user. @@ -1061,6 +1088,28 @@ const DefaultController = { } return user; }); + }, + + requestEmailChange(user: ParseUser, email: string, options: RequestOptions) { + var token = user.getSessionToken(); + if (!token) { + return Promise.reject( + new ParseError( + ParseError.SESSION_MISSING, + 'Cannot upgrade a user with no session token' + ) + ); + } + + options.sessionToken = token; + + var RESTController = CoreManager.getRESTController(); + return RESTController.request( + 'POST', + 'requestEmailChange', + { email: email }, + options + ); } };