LoginManager
A class in Root.Township, the global namespace.
Logs the client in to the Alta API: automatic login at startup, or username (or email) and password. Raises static events and runs queued actions after login. Get it with SingletonBehaviour<LoginManager>.Instance.
- Listed in Global namespace: I to L
- Inherits or implements
SingletonBehaviour<LoginManager> - Derived types
LoginManager - Attributes
ApplicationShutdownOrder
Constructors
| Member | What it is |
|---|---|
LoginManager() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|---|
private static readonly Logger logger | NLog logger for this class. |
private ILoginPreferences loginPreferences | Saved login settings and credentials, injected. |
private readonly List<Action> postLoginActions | Actions waiting for the next successful login. |
private IUserService userService | Injected user service used for automatic login. |
Properties
| Member | What it is |
|---|---|
static bool IsLoggedIn { get; } | True when the API client has logged-in user info. |
static bool IsLoggedInWithOculusAccount { get; set; } | Set when logging in on Quest. Marked obsolete. |
ILoginPreferences Preferences { get; } | Saved login preferences (username, remember details, credentials). |
Events
Methods
| Member | What it is |
|---|---|
void AddPostLoginAction(Action action) | Runs the action now if already logged in, otherwise queues it to run after the next successful login. |
async Task<IResult> LoginAsync(string username, string password) | Logs in with a hashed password. Email logins return success without running post-login actions or raising LoggedIn. |
IResult Logout() | Logs out, clears saved credentials and raises LoggedOut. On Android it opens the registration scene. |
void ProcessSuccessfulLogin() | Saves credentials, runs queued post-login actions and raises LoggedIn. |
protected override void Awake() | Hooks automatic login to application startup. |
protected void Inject(IUserService userService, ILoginPreferences loginPreferences) | Receives the user service and login preferences from dependency injection. |