/** * Check user credentials * @param array $credentials */ public function check($credentials) { $user = User::findFirstByUserEmail(strtolower($credentials['email'])); if ($user == false) { $this->registerUserThrottling(null); //Use login throttling to counter brute force attacks throw new \Exception('Wrong email/password'); } if (!$this->security->checkHash($credentials['password'], $user->getUserPassword())) { $this->registerUserThrottling(null); //Use login throttling to counter brute force attacks throw new \Exception('Wrong email/password'); } $this->checkUserFlags($user); $this->saveSuccessLogin($user); //Set cookies and tokens for the Remember Me environment if (isset($credentials['remember'])) { $this->createRememberEnvironment($user); } $this->setIdentity($user); //Set user info in session }