mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
Valdiate custom field keys
Summary: Validates the keys on page load, alerts if there is a problem. Fixes T3432 Test Plan: Use some good and bad keys, ensure we get the error at the right time. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T3432 Differential Revision: https://secure.phabricator.com/D6284
This commit is contained in:
parent
b26549b5fa
commit
ff14d7d71c
1 changed files with 13 additions and 0 deletions
|
@ -174,6 +174,19 @@ class ManiphestAuxiliaryFieldDefaultSpecification
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$stripped_auxiliary_key = preg_replace(
|
||||||
|
'/[\w\d\.\-\:]+/', '', $this->getAuxiliaryKey());
|
||||||
|
|
||||||
|
if (strlen($stripped_auxiliary_key)) {
|
||||||
|
$unique_key_chars = array_unique(str_split($stripped_auxiliary_key));
|
||||||
|
$unique_key_chars = implode(" ,", $unique_key_chars);
|
||||||
|
$control->setDisabled(true);
|
||||||
|
$control->setCaption(
|
||||||
|
"This control is not configured correctly, the key must only contain
|
||||||
|
( a-z, A-Z, 0-9, ., -, : ) but has ( {$unique_key_chars} ), so it can
|
||||||
|
not be rendered, go fix your config.");
|
||||||
|
}
|
||||||
|
|
||||||
return $control;
|
return $control;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue