implement check_occurence_name on account creation

This commit is contained in:
Nicolas Roman 2019-03-25 14:37:44 +01:00 committed by Ludovic Poujol
parent 0bfe7a2aac
commit 6f0106d4d0
2 changed files with 19 additions and 2 deletions

View File

@ -388,11 +388,21 @@ if(!empty($_POST)) {
/* Test de validation du formulaire */
if($form->verify(TRUE)) {
$is_domain_present = check_occurence_name($form->getField('domain')->getValue());
$is_alias_present = check_occurence_name($form->getField('domain_alias')->getValue());
if (!$is_domain_present && !$is_alias_present) {
if ($conf['cluster'])
$exec_info = web_add_cluster($form, $conf['admin']['mail']);
else
$exec_info = web_add($form, $conf['admin']['mail']);
}
}
else {
$errors_check = array();
if ($is_domain_present) array_push($errors_check, "Domaine déjà présent dans d'autres vhosts.");
if ($is_alias_present) array_push($errors_check, "Alias déjà présent(s) dans d'autres vhosts.");
}
}
}
include_once EVOADMIN_BASE . '../tpl/header.tpl.php';

View File

@ -34,8 +34,15 @@
print '</pre>';
} else {
?>
if (isset($errors_check)) {
print '<p class="form-error"><strong>Erreur(s) : </strong><br>';
foreach ($errors_check as $error) {
printf('%s<br>', $error);
}
print '</p>';
}
?>
<form name="form-add" id="form-add" action="" method="POST">
<fieldset>
<legend>Ajout d'un compte</legend>