/**
  * {@inheritDoc}
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $options = $serviceLocator->get('zfcuser_module_options');
     $form = new Login(null, $options);
     $form->setInputFilter(new LoginFilter($options));
     return $form;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function createService(ServiceLocatorInterface $serviceManager)
 {
     /* @var $options Options\ModuleOptions */
     $options = $serviceManager->get('zfcuser_module_options');
     $inputFilter = new LoginFilter($options);
     $form = new Login(null, $options);
     $form->setInputFilter($inputFilter);
     return $form;
 }
Ejemplo n.º 3
0
 public function getServiceConfig()
 {
     return array('invokables' => array('ZfcUser\\Authentication\\Adapter\\Db' => 'ZfcUser\\Authentication\\Adapter\\Db', 'ZfcUser\\Authentication\\Storage\\Db' => 'ZfcUser\\Authentication\\Storage\\Db', 'ZfcUser\\Form\\Login' => 'ZfcUser\\Form\\Login', 'zfcuser_user_service' => 'ZfcUser\\Service\\User', 'zfcuser_register_form_hydrator' => 'Zend\\Stdlib\\Hydrator\\ClassMethods'), 'factories' => array('zfcuser_redirect_callback' => function ($sm) {
         /* @var RouteInterface $router */
         $router = $sm->get('Router');
         /* @var Application $application */
         $application = $sm->get('Application');
         /* @var ModuleOptions $options */
         $options = $sm->get('zfcuser_module_options');
         return new RedirectCallback($application, $router, $options);
     }, 'zfcuser_module_options' => function ($sm) {
         $config = $sm->get('Config');
         return new Options\ModuleOptions(isset($config['zfcuser']) ? $config['zfcuser'] : array());
     }, 'zfcuser_auth_service' => function ($sm) {
         return new \Zend\Authentication\AuthenticationService($sm->get('ZfcUser\\Authentication\\Storage\\Db'), $sm->get('ZfcUser\\Authentication\\Adapter\\AdapterChain'));
     }, 'ZfcUser\\Authentication\\Adapter\\AdapterChain' => 'ZfcUser\\Authentication\\Adapter\\AdapterChainServiceFactory', 'zfcuser_login_form' => function ($sm) {
         $options = $sm->get('zfcuser_module_options');
         $form = new Form\Login(null, $options);
         $form->setInputFilter(new Form\LoginFilter($options));
         return $form;
     }, 'zfcuser_register_form' => function ($sm) {
         $options = $sm->get('zfcuser_module_options');
         var_dump($options);
         dia;
         $form = new Form\Register(null, $options);
         $form->setCaptchaElement($sm->get('zfcuser_captcha_element'));
         $form->setInputFilter(new Form\RegisterFilter(new Validator\NoRecordExists(array('mapper' => $sm->get('zfcuser_user_mapper'), 'key' => 'email')), new Validator\NoRecordExists(array('mapper' => $sm->get('zfcuser_user_mapper'), 'key' => 'username')), $options));
         return $form;
     }, 'zfcuser_change_password_form' => function ($sm) {
         $options = $sm->get('zfcuser_module_options');
         $form = new Form\ChangePassword(null, $sm->get('zfcuser_module_options'));
         $form->setInputFilter(new Form\ChangePasswordFilter($options));
         return $form;
     }, 'zfcuser_change_email_form' => function ($sm) {
         $options = $sm->get('zfcuser_module_options');
         $form = new Form\ChangeEmail(null, $options);
         $form->setInputFilter(new Form\ChangeEmailFilter($options, new Validator\NoRecordExists(array('mapper' => $sm->get('zfcuser_user_mapper'), 'key' => 'email'))));
         return $form;
     }, 'zfcuser_user_hydrator' => function ($sm) {
         $hydrator = new \Zend\Stdlib\Hydrator\ClassMethods();
         return $hydrator;
     }, 'zfcuser_user_mapper' => function ($sm) {
         $options = $sm->get('zfcuser_module_options');
         $mapper = new Mapper\User();
         $mapper->setDbAdapter($sm->get('zfcuser_zend_db_adapter'));
         $entityClass = $options->getUserEntityClass();
         $mapper->setEntityPrototype(new $entityClass());
         $mapper->setHydrator(new Mapper\UserHydrator());
         $mapper->setTableName($options->getTableName());
         return $mapper;
     }));
 }
 public function createService(ServiceLocatorInterface $formElementManager)
 {
     if ($formElementManager instanceof FormElementManager) {
         $sm = $formElementManager->getServiceLocator();
         $fem = $formElementManager;
     } else {
         $sm = $formElementManager;
         $fem = $sm->get('FormElementManager');
     }
     /** @var FormElementManager $formElementManager */
     $options = $sm->get('zfcuser_module_options');
     $form = new Form\Login(null, $options);
     // Inject the FormElementManager to support custom FormElements
     $form->getFormFactory()->setFormElementManager($fem);
     $form->setInputFilter(new Form\LoginFilter($options));
     return $form;
 }