private function authenticate() { if ($this->secureAsHash) { if (strlen($this->hash) == 0) { $this->exitWithError("EMPTY HASH"); } if (!$this->model->authenticateHash($this->hash)) { $this->exitWithError("WRONG HASH"); } } else { if (!$this->model->authenticateLogin($this->login, $this->password)) { $this->exitWithError("NOT USER FOUND"); } } }