User Registration
Logging in into the UniREST system is possible only if an account has been previously registered. Registering a new account just requires a unique username, a password and the use of Registration() method:
Parameter | Data-type | Description |
username | string | The user username. The maximum allowed length is 32 characters. |
password | string | The user password. |
callBack | Action<bool> | The function to call or the code to execute at operations completed. |
Returned value | Description |
bool | This method just returns true or false. |
If the user registration occurs without problems, this method returns true. This method is for registration only and doesn’t perform any login operation.
If something goes wrong and the registration fails, this method returns false.
_ = UniRESTClient.Async.Registration("pluto", "planet9", (bool ok) =>
{
if (ok)
{
Debug.Log("Registration done!");
}
else
{
Debug.Log("Registration failed!");
}
});
Once a new account is registered, it’s added to the user table and it becomes visible in the UniREST Server Database Manager:
Note that the password is sha256 coded.
DBResponse
After a successful user account registration, the UniREST Server replies with the ID of this new account. This ID is available in the DBResponse property:
_ = UniRESTClient.Async.Registration("pluto", "planet9", (bool ok) =>
{
if (ok)
{
Debug.Log("Registration done! New user ID: " + UniRESTClient.DBResponse);
}
else
{
Debug.Log("Registration failed!");
}
});