Exemplo n.º 1
0
 public function getServiceConfig()
 {
     return array('invokables' => array('zfcuser_user_service' => 'User\\Service\\User'), 'factories' => array('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');
         $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;
     }));
 }
Exemplo n.º 2
0
 public function getServiceConfig()
 {
     return array('aliases' => array('user_doctrine_em' => 'doctrine.documentmanager.odm_default'), 'invokables' => array('User\\Authentication\\Adapter\\Db' => 'User\\Authentication\\Adapter\\Db', 'User\\Authentication\\Storage\\Db' => 'User\\Authentication\\Storage\\Db', 'User\\Form\\Login' => 'User\\Form\\Login', 'user_user_service' => 'User\\Service\\User', 'user_register_form_hydrator' => 'Zend\\Stdlib\\Hydrator\\ClassMethods'), 'factories' => array('user_remember' => function ($sm) {
         return new \User\Authentication\Adapter\RememberMe('user_remember');
     }, 'user_module_options' => function ($sm) {
         $config = $sm->get('Config');
         return new Options\ModuleOptions(isset($config['user']) ? $config['user'] : array());
     }, 'user_auth_service' => function ($sm) {
         return new \Zend\Authentication\AuthenticationService($sm->get('User\\Authentication\\Storage\\Db'), $sm->get('User\\Authentication\\Adapter\\AdapterChain'));
     }, 'User\\Authentication\\Adapter\\AdapterChain' => 'User\\Authentication\\Adapter\\AdapterChainServiceFactory', 'user_login_form' => function ($sm) {
         $options = $sm->get('user_module_options');
         $form = new Form\Login(null, $options);
         $form->setInputFilter(new Form\LoginFilter($options));
         return $form;
     }, 'user_register_form' => function ($sm) {
         $options = $sm->get('user_module_options');
         $form = new Form\Register(null, $options);
         $form->setInputFilter(new Form\RegisterFilter(new Validator\NoRecordExists(array('mapper' => $sm->get('user_user_mapper'), 'key' => 'email')), new Validator\NoRecordExists(array('mapper' => $sm->get('user_user_mapper'), 'key' => 'username')), $options));
         return $form;
     }, 'user_change_password_form' => function ($sm) {
         $options = $sm->get('user_module_options');
         $form = new Form\ChangePassword(null, $sm->get('user_module_options'));
         $form->setInputFilter(new Form\ChangePasswordFilter($options));
         return $form;
     }, 'user_change_email_form' => function ($sm) {
         $options = $sm->get('user_module_options');
         $form = new Form\ChangeEmail(null, $sm->get('user_module_options'));
         $form->setInputFilter(new Form\ChangeEmailFilter($options, new Validator\NoRecordExists(array('mapper' => $sm->get('user_user_mapper'), 'key' => 'email'))));
         return $form;
     }, 'user_user_hydrator' => function ($sm) {
         $hydrator = new \Zend\Stdlib\Hydrator\ClassMethods();
         return $hydrator;
     }, 'user_user_mapper' => function ($sm) {
         return new \User\Mapper\UserMongoDB($sm->get('user_doctrine_em'), $sm->get('user_module_options'));
     }));
 }