/** * Process the login, create the user session and then redirect to * the appropriate page */ public function Login() { $user = new ExampleUser(); if ($user->Login(RequestUtil::Get('username'), RequestUtil::Get('password'))) { // login success $this->SetCurrentUser($user); $this->Redirect('SecureExample.UserPage'); } else { // login failed $this->Redirect('SecureExample.LoginForm', 'Unknown username/password combination'); } }
/** * Process the login, create the user session and then redirect to * the appropriate page */ public function Login() { $user = new ExampleUser(); if ($user->Login(RequestUtil::Get('username'), RequestUtil::Get('password'))) { // login success $this->SetCurrentUser($user); $this->Redirect('SecureExample.UserPage'); } else { // login failed $this->Redirect('SecureExample.LoginForm', 'Combinaçãoo de usuário ou senha incorretos'); } }
/** * Initialize the array of users. Note, this is only done this way because the * users are hard-coded for this example. In your own code you would most likely * do a single lookup inside the Login method */ public function __construct() { if (!self::$USERS) { self::$USERS = array("demo" => password_hash("pass", PASSWORD_BCRYPT), "admin" => password_hash("pass", PASSWORD_BCRYPT)); } }
public static function model($className = __CLASS__) { return parent::model($className); }