/** * Handle the validation. * * @param UserRepositoryInterface $users * @param LoginFormBuilder $builder * @return bool */ public function handle(UserRepositoryInterface $users, LoginFormBuilder $builder) { $values = $builder->getFormValues(); if (!($user = $users->findByCredentials($values->all()))) { return false; } $builder->setUser($user); return true; }
/** * Handle the command. * * @param UserRepositoryInterface $users * @return \Anomaly\UsersModule\User\Contract\UserInterface|null */ public function handle(UserRepositoryInterface $users) { if (!isset($this->credentials['email'])) { return null; } if (!isset($this->credentials['password'])) { return null; } return $users->findByCredentials($this->credentials); }