Make regular expression pattern in autologin backend being fully optional
This commit is contained in:
parent
09945994b8
commit
8c62c66a4e
|
@ -50,7 +50,6 @@ class AutologinBackendForm extends Form
|
|||
'text',
|
||||
'strip_username_regexp',
|
||||
array(
|
||||
'required' => true,
|
||||
'label' => t('Backend Domain Pattern'),
|
||||
'description' => t('The domain pattern of this authentication backend'),
|
||||
'value' => '/\@[^$]+$/',
|
||||
|
|
|
@ -220,7 +220,7 @@ class AdminAccountPage extends Form
|
|||
}
|
||||
|
||||
$name = $_SERVER['REMOTE_USER'];
|
||||
if (isset($this->backendConfig['strip_username_regexp'])) {
|
||||
if (isset($this->backendConfig['strip_username_regexp']) && $this->backendConfig['strip_username_regexp']) {
|
||||
// No need to silence or log anything here because the pattern has
|
||||
// already been successfully compiled during backend configuration
|
||||
$name = preg_replace($this->backendConfig['strip_username_regexp'], '', $name);
|
||||
|
|
|
@ -54,7 +54,7 @@ class AutoLoginBackend extends UserBackend
|
|||
if (isset($_SERVER['REMOTE_USER'])) {
|
||||
$username = $_SERVER['REMOTE_USER'];
|
||||
$user->setRemoteUserInformation($username, 'REMOTE_USER');
|
||||
if ($this->stripUsernameRegexp !== null) {
|
||||
if ($this->stripUsernameRegexp) {
|
||||
$stripped = preg_replace($this->stripUsernameRegexp, '', $username);
|
||||
if ($stripped !== false) {
|
||||
// TODO(el): PHP issues a warning when PHP cannot compile the regular expression. Should we log an
|
||||
|
|
Loading…
Reference in New Issue