/** * Check whether the provided password matches the password hash. If so, return true. * * @param string $passwordProvided * @param string $passwordHash * @return bool */ public function authenticate($passwordProvided, $passwordHash) { if (password_verify($passwordProvided, $passwordHash)) { $this->setAuthenticated(true); $this->session->set('auth', ['authenticated' => true, 'data' => $this->authenticationData]); } else { $this->revokeAuthentication(); } return $this->isAuthenticated(); }
/** * Write messages stored on ourself to the session * * @return $this */ protected function writeToSession() { $this->session->set('messages', $this->messages); return $this; }