Exemple #1
0
 public function test_encrypted_login()
 {
     $this->model->update_attributes($this->get_fixture("encrypteduser"));
     $auth = new WaxAuthDb(array("encrypt" => true, "db_table" => "test_auth_user"));
     $auth->verify("encrypted", "password");
     $this->assertTrue($auth->is_logged_in());
 }
 /**
  * protected function that handles the actual db authentication check on first login
  * now also logs data regarding who has logged in
  * @return String url to redirect to
  **/
 protected function process_login()
 {
     $auth = new WaxAuthDb(array("db_table" => $this->model_name, "session_key" => "wildfire_user_cookie"));
     if ($auth->verify($_POST['username'], $_POST['password'])) {
         $log = new WildfireLog();
         $log->action = "login";
         $log->user = $auth->get_user();
         $log->time = date("Y-m-d H:i:s");
         $log->save();
         if ($this->authorised_redirect) {
             return $this->authorised_redirect;
         } else {
             return 'index';
         }
     } else {
         Session::add_message("Sorry, we can't find that username and password. Try again.");
         return $this->unauthorised_redirect;
     }
 }