forked from evolix/evoadmin-web
Refactor the domain and alias checks done at account creation
This commit is contained in:
parent
b3ec773c64
commit
29b92647a7
|
@ -388,20 +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());
|
||||
$errors_check = array();
|
||||
|
||||
if (!$is_domain_present && !$is_alias_present) {
|
||||
if(check_occurence_name($form->getField('domain')->getValue())){
|
||||
array_push($errors_check, "Domaine déjà présent dans d'autres vhosts.");
|
||||
}
|
||||
if(check_occurence_name($form->getField('domain_alias')->getValue())){
|
||||
array_push($errors_check, "Alias déjà présent(s) dans d'autres vhosts.");
|
||||
}
|
||||
|
||||
if (count($errors_check) === 0) {
|
||||
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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
if(!empty($exec_info)) {
|
||||
print '<pre>';
|
||||
if ($conf['debug'] == TRUE)
|
||||
|
@ -23,7 +21,7 @@
|
|||
|
||||
if ($exec_info[1]) {
|
||||
print "La commande a <strong>échoué</strong>\n";
|
||||
print_r($exec_info);
|
||||
print_r($exec_info);
|
||||
}
|
||||
else print "Le compte a été créé avec succès\n";
|
||||
|
||||
|
@ -35,18 +33,20 @@
|
|||
print '</pre>';
|
||||
} else {
|
||||
|
||||
// If there is validation errors, display them
|
||||
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>';
|
||||
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>
|
||||
<?php print $form; ?>
|
||||
<?= $form ?>
|
||||
<p><input type="submit" value="Créer"/></p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue