1. Home
  2. Docs
  3. UniREST Solution 3.5
  4. UniREST Client
  5. Login and Registration
  6. Change Password

Change Password

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.

Note that this feature is not a password recovery system. It just allows the logged in user to freely change own password. For a password recovery function, see the OTP Password Change feature instead.

ChangePassword()

The ChangePassword() method changes the user’s account password.

_ = UniRESTClient.Async.ChangePassword(username, oldPassword, newPassword, callBack);
usernamestringThe account username.
oldPasswordstringThe old password to change.
newPasswordstringThe new password.
callBackAction<bool>The function to call when the operation is complete.
boolThis 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:

INVALIDThe username and/or the password are invalid strings.
PASS_ERRORThe old password is wrong.
CANT_UPDATEThe 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!