Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

api_login()

Description

API login function

Parameters

ColumnTypeDefaultDescription
$username string Username
$password string Password to validate

Return

string|false FALSE if invalid, session API key if valid

Location

include/api_functions.php lines 215 to 227

Definition

 
function api_login($username,$password)
    {
    global 
$session_hash$scramble_key;
    
$user=get_user_by_username($username); if ($user===false) {return false;}
    
$result perform_login($username,$password);
    
$private_key get_api_key($user);
    if ((bool)
$result['valid'])
        {
        return 
hash_hmac("sha256""{$session_hash}{$private_key}"$scramble_key);
        }

    return 
false;
    }

This article was last updated 19th March 2024 09:05 Europe/London time based on the source file dated 6th March 2024 14:45 Europe/London time.