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
parent
commit
a4eb3ee508
No known key found for this signature in database GPG Key ID: F941078878347C0C
  1. 4
      core/Command/Maintenance/Install.php
  2. 7
      lib/private/Setup.php

4
core/Command/Maintenance/Install.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,

7
lib/private/Setup.php

@ -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…
Cancel
Save