/** * @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'); }
public function renderDefault() { if ($this->user->isLoggedIn()) { $this->flashMessage($this->translator->translate('You are already logged in.'), 'info'); } $this->template->loginProviders = $this->securityManager->getLoginProviders(); }
/** * @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); }
private function getUserTypes() { $ret = array(); foreach ($this->securityManager->getUserTypes() as $class => $type) { $ret[$class] = $type->getName(); } return $ret; }
/** * @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); } }
/** * @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'); }
/** * @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'); }
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; }
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; }
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'); }
/** * @return \CmsModule\Pages\Users\UserType */ private function getUserType() { return $this->securityManager->getUserTypeByClass($this->type); }
protected function createComponentForm() { $form = $this->securityManager->getUserTypeByClass($this->user->identity->class)->getFrontFormFactory()->invoke($this->extendedUser); $form->onSuccess[] = $this->formSuccess; return $form; }