Skip to content

Commit

Permalink
Merge branch 'bugfix/rebuild-form-builder-5525' into bugfix/commands-…
Browse files Browse the repository at this point in the history
…6593
  • Loading branch information
lippserd committed Sep 3, 2014
2 parents 5d1f2ad + 54a8342 commit a4da3b6
Show file tree
Hide file tree
Showing 15 changed files with 337 additions and 337 deletions.
54 changes: 27 additions & 27 deletions application/forms/Authentication/LoginForm.php
Expand Up @@ -26,34 +26,34 @@ public function init()
*/
public function createElements($formData)
{
return array(
$this->createElement(
'text',
'username',
array(
'required' => true,
'label' => t('Username'),
'placeholder' => t('Please enter your username...'),
'class' => false === isset($formData['username']) ? 'autofocus' : ''
)
),
$this->createElement(
'password',
'password',
array(
'required' => true,
'label' => t('Password'),
'placeholder' => t('...and your password'),
'class' => isset($formData['username']) ? 'autofocus' : ''
)
),
$this->createElement(
'hidden',
'redirect',
array(
'value' => Url::fromRequest()->getParam('redirect')
)
$this->addElement(
'text',
'username',
array(
'required' => true,
'label' => t('Username'),
'placeholder' => t('Please enter your username...'),
'class' => false === isset($formData['username']) ? 'autofocus' : ''
)
);
$this->addElement(
'password',
'password',
array(
'required' => true,
'label' => t('Password'),
'placeholder' => t('...and your password'),
'class' => isset($formData['username']) ? 'autofocus' : ''
)
);
$this->addElement(
'hidden',
'redirect',
array(
'value' => Url::fromRequest()->getParam('redirect')
)
);

return $this;
}
}
76 changes: 38 additions & 38 deletions application/forms/Config/Authentication/AutologinBackendForm.php
Expand Up @@ -25,52 +25,52 @@ public function init()
*/
public function createElements(array $formData)
{
return array(
$this->createElement(
'text',
'name',
array(
'required' => true,
'label' => t('Backend Name'),
'description' => t('The name of this authentication backend'),
'validators' => array(
$this->addElement(
'text',
'name',
array(
'required' => true,
'label' => t('Backend Name'),
'description' => t('The name of this authentication backend'),
'validators' => array(
array(
'Regex',
false,
array(
'Regex',
false,
array(
'pattern' => '/^[^\\[\\]:]+$/',
'messages' => array(
'regexNotMatch' => 'The backend name cannot contain \'[\', \']\' or \':\'.'
)
'pattern' => '/^[^\\[\\]:]+$/',
'messages' => array(
'regexNotMatch' => 'The backend name cannot contain \'[\', \']\' or \':\'.'
)
)
)
)
),
$this->createElement(
'text',
'strip_username_regexp',
array(
'required' => true,
'label' => t('Backend Domain Pattern'),
'description' => t('The domain pattern of this authentication backend'),
'value' => '/\@[^$]+$/',
'validators' => array(
new Zend_Validate_Callback(function ($value) {
return @preg_match($value, '') !== false;
})
)
)
),
$this->createElement(
'hidden',
'backend',
array(
'required' => true,
'value' => 'autologin'
)
);
$this->addElement(
'text',
'strip_username_regexp',
array(
'required' => true,
'label' => t('Backend Domain Pattern'),
'description' => t('The domain pattern of this authentication backend'),
'value' => '/\@[^$]+$/',
'validators' => array(
new Zend_Validate_Callback(function ($value) {
return @preg_match($value, '') !== false;
})
)
)
);
$this->addElement(
'hidden',
'backend',
array(
'required' => true,
'value' => 'autologin'
)
);

return $this;
}

/**
Expand Down
58 changes: 29 additions & 29 deletions application/forms/Config/Authentication/DbBackendForm.php
Expand Up @@ -48,37 +48,37 @@ public function setResources(array $resources)
*/
public function createElements(array $formData)
{
return array(
$this->createElement(
'text',
'name',
array(
'required' => true,
'label' => t('Backend Name'),
'description' => t('The name of this authentication provider'),
)
),
$this->createElement(
'select',
'resource',
array(
'required' => true,
'label' => t('Database Connection'),
'description' => t('The database connection to use for authenticating with this provider'),
'multiOptions' => false === empty($this->resources)
? array_combine($this->resources, $this->resources)
: array()
)
),
$this->createElement(
'hidden',
'backend',
array(
'required' => true,
'value' => 'db'
)
$this->addElement(
'text',
'name',
array(
'required' => true,
'label' => t('Backend Name'),
'description' => t('The name of this authentication provider'),
)
);
$this->addElement(
'select',
'resource',
array(
'required' => true,
'label' => t('Database Connection'),
'description' => t('The database connection to use for authenticating with this provider'),
'multiOptions' => false === empty($this->resources)
? array_combine($this->resources, $this->resources)
: array()
)
);
$this->addElement(
'hidden',
'backend',
array(
'required' => true,
'value' => 'db'
)
);

return $this;
}

/**
Expand Down
98 changes: 49 additions & 49 deletions application/forms/Config/Authentication/LdapBackendForm.php
Expand Up @@ -47,57 +47,57 @@ public function setResources(array $resources)
*/
public function createElements(array $formData)
{
return array(
$this->createElement(
'text',
'name',
array(
'required' => true,
'label' => t('Backend Name'),
'description' => t('The name of this authentication backend')
)
),
$this->createElement(
'select',
'resource',
array(
'required' => true,
'label' => t('LDAP Resource'),
'description' => t('The resource to use for authenticating with this provider'),
'multiOptions' => false === empty($this->resources)
? array_combine($this->resources, $this->resources)
: array()
)
),
$this->createElement(
'text',
'user_class',
array(
'required' => true,
'label' => t('LDAP User Object Class'),
'description' => t('The object class used for storing users on the ldap server'),
'value' => 'inetOrgPerson'
)
),
$this->createElement(
'text',
'user_name_attribute',
array(
'required' => true,
'label' => t('LDAP User Name Attribute'),
'description' => t('The attribute name used for storing the user name on the ldap server'),
'value' => 'uid'
)
),
$this->createElement(
'hidden',
'backend',
array(
'required' => true,
'value' => 'ldap'
)
$this->addElement(
'text',
'name',
array(
'required' => true,
'label' => t('Backend Name'),
'description' => t('The name of this authentication backend')
)
);
$this->addElement(
'select',
'resource',
array(
'required' => true,
'label' => t('LDAP Resource'),
'description' => t('The resource to use for authenticating with this provider'),
'multiOptions' => false === empty($this->resources)
? array_combine($this->resources, $this->resources)
: array()
)
);
$this->addElement(
'text',
'user_class',
array(
'required' => true,
'label' => t('LDAP User Object Class'),
'description' => t('The object class used for storing users on the ldap server'),
'value' => 'inetOrgPerson'
)
);
$this->addElement(
'text',
'user_name_attribute',
array(
'required' => true,
'label' => t('LDAP User Name Attribute'),
'description' => t('The attribute name used for storing the user name on the ldap server'),
'value' => 'uid'
)
);
$this->addElement(
'hidden',
'backend',
array(
'required' => true,
'value' => 'ldap'
)
);

return $this;
}

/**
Expand Down
9 changes: 5 additions & 4 deletions application/forms/Config/AuthenticationBackendConfigForm.php
Expand Up @@ -299,8 +299,7 @@ function ($authBackendCfg) {
$backendTypes['autologin'] = t('Autologin');
}

$elements = array();
$elements[] = $this->createElement(
$this->addElement(
'select',
'type',
array(
Expand All @@ -315,9 +314,11 @@ function ($authBackendCfg) {

if (isset($formData['force_creation']) && $formData['force_creation']) {
// In case another error occured and the checkbox was displayed before
$elements[] = $this->getForceCreationCheckbox();
$this->addElement($this->getForceCreationCheckbox());
}

return array_merge($elements, $this->getBackendForm($backendType)->createElements($formData));
$this->addElements($this->getBackendForm($backendType)->createElements($formData)->getElements());

return $this;
}
}

0 comments on commit a4da3b6

Please sign in to comment.