Menu

## Login extends KBase
in package

Login.php : 20

This class is responsible for handling user login functionality.

##### Tags

see
  https://www.kotchasan.com/

### Table of Contents

$from_submit : bool
  Indicates whether the login request is submitted.
$login_input : string
  The name of the input field to be focused.
$login_message : string
  The login message.
$login_params : array<string|int, mixed>
  The login parameters submitted by the user.
$cfg : object
  Config class instance.
$request : Request
  Server request class instance.
checkLogin() : string|array<string|int, mixed>
  Validates the login credentials against the configured username and password.
checkStatus() : array<string|int, mixed>|null
  Check the status of a login.
create() : static
  Validates the login request and performs the login process.
forgot() : void
  Initiates the password recovery process.
isAdmin() : array<string|int, mixed>|null
  Checks if the user is an admin.
isMember() : array<string|int, mixed>|null
  Checks if the user is a member.
login() : void
  Validates the login credentials and performs the login process.
logout() : void
  Logs out the user by clearing the session and displaying a success message.

### Properties

#### $from_submit

Login.php : 27

Indicates whether the login request is submitted.

`public static bool $from_submit = false`

#### $login_input

Login.php : 35

The name of the input field to be focused.

`public static string $login_input`

Can be 'login_username' or 'login_password'.

#### $login_message

Login.php : 42

The login message.

`public static string $login_message`

#### $login_params

Login.php : 49

The login parameters submitted by the user.

`public static array<string|int, mixed> $login_params = []`

#### $cfg

KBase.php : 26

Config class instance.

`protected static object $cfg`

#### $request

KBase.php : 33

Server request class instance.

`protected static Request $request`

### Methods

#### checkLogin()

Login.php : 158

Validates the login credentials against the configured username and password.

`public checkLogin(array<string|int, mixed> $loginParams) : string|array<string|int, mixed>`

##### Parameters

$loginParams : array<string|int, mixed>

  The login parameters. e.g., array('username' => '', 'password' => '');

##### Return values

string|array<string|int, mixed> —

Returns a string error message if login fails, or an array with login information.

#### checkStatus()

Login.php : 208

Check the status of a login.

`public static checkStatus(array<string|int, mixed> $login, mixed $statuses) : array<string|int, mixed>|null`

If the login is empty or the status does not match the provided statuses, null is returned. If the status matches, the login is returned.

##### Parameters

$login : array<string|int, mixed>

  The login information.

$statuses : mixed

  The allowed status(es) to check against.

##### Return values

array<string|int, mixed>|null —

The login information if the status matches, null otherwise.

#### create()

Login.php : 57

Validates the login request and performs the login process.

`public static create(Request $request) : static`

##### Parameters

$request : Request

  The HTTP request object.

##### Return values

static —

#### forgot()

Login.php : 120

Initiates the password recovery process.

`public forgot(Request $request) : void`

##### Parameters

$request : Request

  The HTTP request object.

##### Return values

void —

#### isAdmin()

Login.php : 181

Checks if the user is an admin.

`public static isAdmin() : array<string|int, mixed>|null`

##### Return values

array<string|int, mixed>|null —

Returns the login information if the user is an admin, or null otherwise.

#### isMember()

Login.php : 192

Checks if the user is a member.

`public static isMember() : array<string|int, mixed>|null`

##### Return values

array<string|int, mixed>|null —

Returns the login information if the user is a member, or null otherwise.

#### login()

Login.php : 133

Validates the login credentials and performs the login process.

`public login(Request $request, array<string|int, mixed> $loginParams) : void`

##### Parameters

$request : Request

  The HTTP request object.

$loginParams : array<string|int, mixed>

  The login parameters.

##### Return values

void —

#### logout()

Login.php : 107

Logs out the user by clearing the session and displaying a success message.

`public logout(Request $request) : void`

##### Parameters

$request : Request

  The HTTP request object.

##### Return values

void —

## Search results