mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 16:24:04 +02:00
NavigationItemForm: Validate that urls with credentials contain a protocol
refs #12890
This commit is contained in:
parent
366064e21f
commit
6492f3c105
@ -56,6 +56,24 @@ class NavigationItemForm extends Form
|
|||||||
'The url of this navigation item. Leave blank if only the name should be displayed.'
|
'The url of this navigation item. Leave blank if only the name should be displayed.'
|
||||||
. ' For urls with username and password and for all external urls,'
|
. ' For urls with username and password and for all external urls,'
|
||||||
. ' make sure to prepend an appropriate protocol identifier (e.g. http://example.tld)'
|
. ' make sure to prepend an appropriate protocol identifier (e.g. http://example.tld)'
|
||||||
|
),
|
||||||
|
'validators' => array(
|
||||||
|
array(
|
||||||
|
'Callback',
|
||||||
|
false,
|
||||||
|
array(
|
||||||
|
'callback' => function($url) {
|
||||||
|
// Matches if the given url contains obviously
|
||||||
|
// a username but not any protocol identifier
|
||||||
|
return !preg_match('#^((?=[^/@]).)+@.*$#', $url);
|
||||||
|
},
|
||||||
|
'messages' => array(
|
||||||
|
'callbackValue' => $this->translate(
|
||||||
|
'Missing protocol identifier'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user