Function __global->cns_authorise_login
Definitions
sources/cns_forum_driver_helper_auth.php
- Find if the given member ID and password is valid. If username is null, then the member ID is used instead.All authorisation, cookies, and form-logins, are passed through this function.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: array
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $this_ref | object | No | No | required parameter | N/A | N/A | Link to the real forum driver |
| $username | ?SHORT_TEXT | No | No | required parameter | N/A | N/A | The member username (null: use $member_id) |
| $member_id | ?MEMBER | No | No | required parameter | N/A | N/A | The member ID (null: use $username) |
| $password_mixed | string | No | No | required parameter | N/A | N/A | If $cookie_login is true then this is the value of the password cookie, otherwise it's the password the user tried to log in with |
| $cookie_login | boolean | No | No | False | N/A | N/A | Whether this is a cookie login, determines how the hashed password is treated for the value passed in |
Returns
- A map of 'id' (?MEMBER; member logged in), 'error' (?string; failed login), 'reasoned_ban' (?string; a ban message if banned with a reason), and 'failed_login' (boolean; whether the login should be logged as failed)
- Type: array
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Find if the given member ID and password is valid. If username is null, then the member ID is used instead.All authorisation, cookies, and form-logins, are passed through this function.
*
* @param object $this_ref Link to the real forum driver
* @param ?SHORT_TEXT $username The member username (null: use $member_id)
* @param ?MEMBER $member_id The member ID (null: use $username)
* @param string $password_mixed If $cookie_login is true then this is the value of the password cookie, otherwise it's the password the user tried to log in with
* @param boolean $cookie_login Whether this is a cookie login, determines how the hashed password is treated for the value passed in
* @return array A map of 'id' (?MEMBER; member logged in), 'error' (?string; failed login), 'reasoned_ban' (?string; a ban message if banned with a reason), and 'failed_login' (boolean; whether the login should be logged as failed)
*/
function cns_authorise_login(object $this_ref, ?string $username, ?int $member_id, string $password_mixed, bool $cookie_login = false) : array
* Find if the given member ID and password is valid. If username is null, then the member ID is used instead.All authorisation, cookies, and form-logins, are passed through this function.
*
* @param object $this_ref Link to the real forum driver
* @param ?SHORT_TEXT $username The member username (null: use $member_id)
* @param ?MEMBER $member_id The member ID (null: use $username)
* @param string $password_mixed If $cookie_login is true then this is the value of the password cookie, otherwise it's the password the user tried to log in with
* @param boolean $cookie_login Whether this is a cookie login, determines how the hashed password is treated for the value passed in
* @return array A map of 'id' (?MEMBER; member logged in), 'error' (?string; failed login), 'reasoned_ban' (?string; a ban message if banned with a reason), and 'failed_login' (boolean; whether the login should be logged as failed)
*/
function cns_authorise_login(object $this_ref, ?string $username, ?int $member_id, string $password_mixed, bool $cookie_login = false) : array

