/** * @param Form $form * @param ArrayHash $values */ public function successSignIn(Form $form, $values) { if ($values->remember) { $this->user->setExpiration('14 days', FALSE); } else { $this->user->setExpiration('20 minutes', TRUE); } try { $this->user->login($values->email, $values->password); } catch (BadPasswordException $e) { $form->addError($form->getTranslator()->translate($e->getMessage())); } catch (UserNotFoundException $e) { $form->addError($form->getTranslator()->translate($e->getMessage())); } }