public function authenticate()
 {
     try {
         $this->user = Model_User::authenticate($this->username, $this->password);
     } catch (Exception $e) {
         if ($e->getMessage() == Model_User::WRONG_PW) {
             return $this->result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, self::BAD_PW_MSG);
         }
         if ($e->getMessage() == Model_User::NOT_FOUND) {
             return $this->result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, self::NOT_FOUND_MSG);
         }
     }
     return $this->result(Zend_Auth_Result::SUCCESS);
 }
Esempio n. 2
0
 protected function _login($user, $password, $remember)
 {
     if (!is_object($user)) {
         $username = $user;
         $user = Model_User::authenticate($username, $password);
         if ($user) {
             return $this->complete_login($user);
         }
         return FALSE;
     }
     if ($user) {
         return TRUE;
     }
     return FALSE;
 }
Esempio n. 3
0
 /**
  * Forces a user to be logged in, without specifying a password.
  *
  * @param mixed $username_or_email_or_id
  *
  * @return bool
  */
 public function force_login($username_or_email_or_id)
 {
     $user = \Model_User::authenticate($username_or_email_or_id, true);
     return $user && $this->complete_login($user);
 }
Esempio n. 4
0
 /**
 Handles the login action - initializes the session verifying the credentials
 */
 public function action_login()
 {
     $error = null;
     if (isset($_POST['submit'])) {
         if (Model_User::authenticate($_POST, $this)) {
             $this->request->redirect(SIGNED_IN_HOME);
         } else {
             $error = "Oops! Email and Password do not match.";
         }
     }
     $this->add_to_header(new View("user/login", array('error_message' => $error)));
     $this->_view = new View("pages/home");
     $this->_enable_sidebar = false;
 }
Esempio n. 5
0
 /**
  * Forces a user to be logged in, without specifying a password.
  *
  * @param mixed $username_or_email_or_id
  *
  * @return bool
  */
 public function force_login($username_or_email_or_id, $check_confirmation = false)
 {
     $user = \Model_User::authenticate($username_or_email_or_id, !$check_confirmation);
     return $user && $this->complete_login($user);
 }