More work on post registration form
This commit is contained in:
parent
952949b609
commit
8b03454d6f
27 changed files with 247 additions and 51 deletions
|
@ -109,6 +109,27 @@ export default class AuthService extends Service {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if a given username exist on the server
|
||||
// Note: The server enforces this check itself during both registration and login
|
||||
// but provides the information too so that frontends can provide a better UX
|
||||
async doesUsernameExist(username: string): Promise<boolean> {
|
||||
// TODO: Make API call to check if username/handle is already in use
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if a given username is allowed to log in.
|
||||
// This includes a check for the existence of the username in the first place
|
||||
// A username may not log in for various reasons, two of which are the account not being approved yet
|
||||
// or the account being barred login from an admin
|
||||
// Note: The server enforces this check itself during login. However, it also provides an API endpoint
|
||||
// for performing this check to allow frontends to have a better UX
|
||||
async canUsernameLogin(username: string): Promise<boolean> {
|
||||
// Can't login into a non-existing account
|
||||
if (!(await this.doesUsernameExist(username))) return false;
|
||||
// TODO: Make API call to check if username is allowed to login
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Don't remove this declaration: this is what enables TypeScript to resolve
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue