Validate email in occ command
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
parent
13877c2d20
commit
a4eb3ee508
2 changed files with 5 additions and 6 deletions
|
@ -171,6 +171,10 @@ class Install extends Command {
|
|||
$adminPassword = $helper->ask($input, $output, $question);
|
||||
}
|
||||
|
||||
if ($adminEmail !== null && !filter_var($adminEmail, FILTER_VALIDATE_EMAIL)) {
|
||||
throw new InvalidArgumentException('Invalid e-mail-address <' . $adminEmail . '> for <' . $adminLogin . '>.');
|
||||
}
|
||||
|
||||
$options = [
|
||||
'dbtype' => $db,
|
||||
'dbuser' => $dbUser,
|
||||
|
|
|
@ -416,12 +416,7 @@ class Setup {
|
|||
|
||||
// Set email for admin
|
||||
if (!empty($options['adminemail'])) {
|
||||
$adminEmail = htmlspecialchars_decode($options['adminemail']);
|
||||
if (filter_var($adminEmail, FILTER_VALIDATE_EMAIL)) {
|
||||
$config->setUserValue($user->getUID(), 'settings', 'email', $adminEmail);
|
||||
} else {
|
||||
$error[] = "Invalid e-mail-address <$adminEmail> for <$username>.";
|
||||
}
|
||||
$config->setUserValue($user->getUID(), 'settings', 'email', $options['adminemail']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue