Hello @ezequieldevjs,
First, you need to call POST /user/reset_password
. This will set the user_activation_key
in the database.(documentation: https://simplejwtlogin.com/docs/reset-password)
After that, you need to call PUT /user/reset_password
with the code. This call will change the password. (documentation: https://simplejwtlogin.com/docs/change-password).
The reset code might contain special characters, and I would recommend sending the request parameters in the body, as a JSON. If you send them as query parameters, they are encoded.
https://simplejwtlogin.com/api-explorer#tag/reset_password
I will add here, a very simple javascript example for the reset-password flow:
function call(method, endpoint, params) {
var xhttp = new XMLHttpRequest();
xhttp.open(method, endpoint, true);
xhttp.setRequestHeader("Content-type", "application/json;charset=UTF-8");
xhttp.send(JSON.stringify(params));
return xhttp.responseText;
}
var siteUrl = 'https://your_site.com/?rest_route=/simple-jwt-login/v1/user/reset_password';
//Send Reset Password code:
var params = {
'email' : '[email protected]',
};
call('POST', siteUrl, params);
//Change the password
params['code']='your_code';
params['new_password']='your_new_password';
call('PUT', siteUrl, params);
Best regards,
Nicu.