コード例 #1
0
 /**
  * @param Form $form
  */
 protected function configure(Form $form)
 {
     $group = $form->addGroup('Registration');
     $userTypes = array();
     foreach ($this->securityManager->getUserTypes() as $name => $val) {
         $userTypes[$name] = $val->getName();
     }
     $registrations = $form->addDynamic('registrations', function (Container $registration) use($form, $group, $userTypes) {
         $group = $form->addGroup('Registration');
         $registration->setCurrentGroup($group);
         $registration->addCheckbox('enabled', 'Enabled')->addCondition($form::EQUAL, TRUE)->toggle('reg-' . $registration->name);
         $registration->setCurrentGroup($registration->form->addGroup()->setOption('id', 'reg-' . $registration->name));
         $registration->addText('name', 'Name');
         $registration->addSelect('userType', 'Type', $userTypes);
         $registration->addSelect('mode', 'Mode', PageEntity::getModes())->addCondition($form::IS_IN, array(PageEntity::MODE_MAIL, PageEntity::MODE_MAIL_CHECKUP))->toggle('email-' . $registration->name);
         $registration->addSelect('loginProviderMode', 'Login provider mode', PageEntity::getSocialModes());
         $registration->addMultiSelect('roles', 'Roles', $this->getRoles());
         $email = $registration->addContainer('email');
         $email->setCurrentGroup($form->addGroup()->setOption('id', 'email-' . $registration->name));
         $email->addText('subject', 'Subject');
         $email->addText('sender', 'Sender');
         $email->addText('from', 'From');
         $email->addTextArea('text', 'Text');
         $registration->addSubmit('_remove', 'Remove')->addRemoveOnClick();
     }, 1);
     $registrations->setCurrentGroup($group);
     $registrations->addSubmit('_add', 'Add')->addCreateOnClick();
     $form->setCurrentGroup();
     $form->addSaveButton('Save');
 }
コード例 #2
0
ファイル: RoutePresenter.php プロジェクト: svobodni/web
 public function renderDefault()
 {
     if ($this->user->isLoggedIn()) {
         $this->flashMessage($this->translator->translate('You are already logged in.'), 'info');
     }
     $this->template->loginProviders = $this->securityManager->getLoginProviders();
 }
コード例 #3
0
ファイル: ProviderFormFactory.php プロジェクト: svobodni/web
 /**
  * @param Form $form
  */
 public function configure(Form $form)
 {
     $form->addHidden('provider')->setValue($this->provider);
     $form['parameters'] = $this->securityManager->getLoginProviderByName($this->provider)->getFormContainer();
     $form->addSaveButton('Sign in')->getControlPrototype()->class[] = 'btn-primary';
     $form->addSubmit('cancel', 'Cancel')->setValidationScope(FALSE);
 }
コード例 #4
0
 private function getUserTypes()
 {
     $ret = array();
     foreach ($this->securityManager->getUserTypes() as $class => $type) {
         $ret[$class] = $type->getName();
     }
     return $ret;
 }
コード例 #5
0
ファイル: LoginFormFactory.php プロジェクト: svobodni/web
 /**
  * @param Form $form
  */
 public function configure(Form $form)
 {
     $form->addText('username', 'E-mail')->setRequired('Please provide a e-mail.');
     $form->addPassword('password', 'Password')->setRequired('Please provide a password.');
     $form->addCheckbox('remember', 'Remember me on this computer');
     $form->addSaveButton('Sign in')->getControlPrototype()->class[] = 'btn-primary';
     $socialButtons = $form->addContainer('socialButtons');
     foreach ($this->securityManager->getLoginProviders() as $loginProvider) {
         $socialButtons->addSubmit(str_replace(' ', '_', $loginProvider), $loginProvider)->setValidationScope(FALSE);
     }
 }
コード例 #6
0
 /**
  * @param Form $form
  */
 protected function configure(Form $form)
 {
     $form->addGroup();
     $user = $form->addOne('user');
     $user->addMany('loginProviders', function (\Venne\Forms\Container $container) use($form) {
         $container->setCurrentGroup($form->addGroup($container->data->type));
         $container->addSelect('type', 'Type')->setItems($this->securityManager->getLoginProviders(), false);
         $container->addText('uid', 'UID');
         $container->addSubmit('remove', 'Remove')->addRemoveOnClick();
     });
     $form->setCurrentGroup();
     $form->addSaveButton('Save');
 }
コード例 #7
0
 /**
  * @param Form $form
  */
 protected function configure(Form $form)
 {
     $form->addGroup('Authentication');
     $form->addSelect('autologin', 'Auto login')->setItems($this->securityManager->getLoginProviders(), FALSE)->setPrompt('Deactivated')->addCondition($form::EQUAL, '')->elseCondition()->toggle('form-autoregistration');
     $form->addGroup()->setOption('id', 'form-autoregistration');
     $form->addSelect('autoregistration', 'Auto registration')->setPrompt('Deactivated')->setItems(array_keys($this->registrations), FALSE);
     $forgotPassword = $form->addContainer('forgotPassword');
     $forgotPassword->setCurrentGroup($form->addGroup('Forgot password'));
     $enabled = $forgotPassword->addCheckbox('enabled', 'Enabled');
     $enabled->addCondition($form::EQUAL, TRUE)->toggle('form-reset');
     $forgotPassword->setCurrentGroup($form->addGroup()->setOption('id', 'form-reset'));
     $forgotPassword->addText('emailSubject', 'Subject')->addConditionOn($enabled, $form::EQUAL, TRUE)->addRule($form::FILLED);
     $forgotPassword->addText('emailSender', 'Sender')->addConditionOn($enabled, $form::EQUAL, TRUE)->addRule($form::FILLED);
     $forgotPassword->addText('emailFrom', 'From')->addConditionOn($enabled, $form::EQUAL, TRUE)->addRule($form::FILLED)->addRule($form::EMAIL);
     $forgotPassword->addTextArea('emailText', 'Text')->addConditionOn($enabled, $form::EQUAL, TRUE)->addRule($form::FILLED);
     $form->setCurrentGroup();
     $form->addSaveButton('Save');
 }
コード例 #8
0
ファイル: AccountPresenter.php プロジェクト: svobodni/web
 protected function createComponentAccountForm()
 {
     if ($this->user->identity instanceof UserEntity) {
         $form = $this->securityManager->getUserTypeByClass($this->user->identity->class)->getFrontFormFactory()->invoke($this->extendedUser);
     } else {
         $form = $this->accountFormFactory->invoke();
     }
     $form->onSuccess[] = $this->accountFormSuccess;
     return $form;
 }
コード例 #9
0
ファイル: RegistrationControl.php プロジェクト: svobodni/web
 public function createComponentForm()
 {
     $_this = $this;
     $userType = $this->securityManager->getUserTypeByClass($this->userType);
     $form = $userType->getRegistrationFormFactory()->invoke($this->createNewUser());
     foreach ($this->securityManager->getLoginProviders() as $loginProvider) {
         $form->addSubmit('_submit_' . str_replace(' ', '_', $loginProvider), $loginProvider)->setValidationScope(FALSE)->onClick[] = function () use($_this, $loginProvider) {
             $_this->redirect('load!', array($loginProvider));
         };
     }
     $form->onSuccess[] = $this->formSuccess;
     return $form;
 }
コード例 #10
0
ファイル: LoginControl.php プロジェクト: svobodni/web
 private function authenticate($provider, $parameters = NULL)
 {
     $login = $this->securityManager->getLoginProviderByName($provider);
     try {
         if ($parameters) {
             $login->setAuthenticationParameters($parameters);
         }
         $identity = $login->authenticate(array());
         $this->presenter->user->login($identity);
     } catch (AuthenticationException $e) {
         $this->onError($this, $e->getMessage());
     }
     $this->redirect('this');
 }
コード例 #11
0
ファイル: UsersPresenter.php プロジェクト: svobodni/web
 /**
  * @return \CmsModule\Pages\Users\UserType
  */
 private function getUserType()
 {
     return $this->securityManager->getUserTypeByClass($this->type);
 }
コード例 #12
0
ファイル: RoutePresenter.php プロジェクト: svobodni/web
 protected function createComponentForm()
 {
     $form = $this->securityManager->getUserTypeByClass($this->user->identity->class)->getFrontFormFactory()->invoke($this->extendedUser);
     $form->onSuccess[] = $this->formSuccess;
     return $form;
 }