Browse Source
Validate email in occ command
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
pull/11204/head
Daniel Kesselberg
7 years ago
committed by
Roeland Jago Douma
No known key found for this signature in database
GPG Key ID: F941078878347C0C
2 changed files with
5 additions and
6 deletions
-
core/Command/Maintenance/Install.php
-
lib/private/Setup.php
|
|
|
@ -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']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|