The UniRESTClient class has two methods for changing the account password, one for the UniREST users and one for the users shared with WordPress.
Use this method(s) if you want to give your users the ability to change their password.
ChangePassword()
The ChangePassword() method changes the user’s account password.
username | string | The account username. |
oldPassword | string | The old password to change. |
newPassword | string | The new password. |
callBack | Action<bool> | The function to call when the operation is complete. |
bool | This method just returns true or false. |
In case of error (the method has returned false), the following error codes are available in the ServerError property:
INVALID | The username and/or the password are invalid strings. |
PASS_ERROR | The old password is wrong. |
CANT_UPDATE | The account doesn’t exist or can’t be updated for some reason. |
_ = UniRESTClient.Async.ChangePassword("pippo", "pluto9", "newplutopass", (bool ok) =>
{
if (ok) Debug.Log("Password updated!"); else Debug.LogError("Error!");
});
WPChangePassword()
The WPChangePassword() method works exactly as the ChangePassword() method, but it works with WordPress users.
This method expects that the user exists both in WordPress and in the UniREST Server.
About password recovery
The UniREST Solution hasn’t a built-in system to give the users the ability to recover a lost password. This mainly because the passwords are decoded (also WordPress decodes own users password) and it’s impossible to know the original password.
However, by creating custom tables and APIs you can easily develop a feature like this on your own… and responsibility too!