-
Notifications
You must be signed in to change notification settings - Fork 6
/
login-result.ts
49 lines (43 loc) · 1.17 KB
/
login-result.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2022 MillenniumEarl
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
/**
* Object obtained in response to an attempt to login to the portal.
*/
export default class LoginResult {
//#region Login result codes
static REQUIRE_2FA = 100;
static REQUIRE_CAPTCHA = 101;
static AUTH_SUCCESSFUL = 200;
static AUTH_SUCCESSFUL_2FA = 201;
static ALREADY_AUTHENTICATED = 202;
static UNKNOWN_ERROR = 400;
static INCORRECT_CREDENTIALS = 401;
static INCORRECT_2FA_CODE = 402;
//#endregion Login result codes
//#region Properties
/**
* Result of the login operation
*/
readonly success: boolean;
/**
* Code associated with the result of the login operation.
*/
readonly code: number;
/**
* Login response message
*/
readonly message: string;
//#endregion Properties
/**
* @param success Result of the login
* @param code ID code of the result event
* @param message Message associated with the result
*/
constructor(success: boolean, code: number, message?: string) {
this.success = success;
this.code = code;
this.message = message ?? /* c8 ignore next */ "";
}
}