1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +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:
Gareth Evans 2013-06-24 09:28:36 -07:00 committed by epriestley
parent b26549b5fa
commit ff14d7d71c

View file

@ -174,6 +174,19 @@ class ManiphestAuxiliaryFieldDefaultSpecification
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;
}