telekommander
5/18/2015 - 7:14 AM

Cockpit Login Module // Frontend

Cockpit Login Module // Frontend

// Init CockPit

include_once('cockpit/bootstrap.php');
$app = cockpit();

// Retrieve current user
$user = $app -> module("auth") -> getUser();

// Login an user
$account = ["user" => "login_username", "password" => "login_password"];
$check = $app -> module("auth") -> authenticate( $account );
$app -> module("auth") -> setUser( $check );

// Logout current user
$app -> module("auth") -> logout();