wpResetPassword method
Changes the user's password. currentPassword is the user's current
password and password is the new one.
All of the user's other tokens are revoked; the token used for this request stays valid.
Returns a WPUserResetPasswordResponse future.
Throws an IncorrectPasswordException if currentPassword is wrong,
WeakPasswordException if the new password is too short,
InvalidUserTokenException if the token is not valid.
Implementation
Future<WPUserResetPasswordResponse> wpResetPassword({
required String currentPassword,
required String password,
String? userToken,
}) async {
Map<String, dynamic> payload = {
"current_password": currentPassword,
"password": password,
};
// send http request
final Map<String, dynamic> json = await _http(
method: "POST",
url: _urlForRouteType(WPRouteType.UserUpdatePassword),
body: payload,
userToken: userToken,
shouldAuthRequest: true);
return WPUserResetPasswordResponse.fromJson(json);
}