diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2018-09-13 14:37:06 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-10-02 22:24:30 +0200 |
commit | 6c805ec9baf4aa875cfcbffe5fa5384caff7b7e7 (patch) | |
tree | 54538ef6b6aec142423dfc71c945c4dda57c2553 /lib/private | |
parent | 6b730b4c478bc4f55a89fd7d6a7c2715e2e5b829 (diff) | |
download | nextcloud-server-6c805ec9baf4aa875cfcbffe5fa5384caff7b7e7.tar.gz nextcloud-server-6c805ec9baf4aa875cfcbffe5fa5384caff7b7e7.zip |
Add --admin-email to cli installer
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Setup.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/private/Setup.php b/lib/private/Setup.php index d5ccde6bba3..1d7ea5e0e53 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -52,6 +52,7 @@ use OC\Preview\BackgroundCleanupJob; use OCP\Defaults; use OCP\IL10N; use OCP\ILogger; +use OCP\IUser; use OCP\Security\ISecureRandom; class Setup { @@ -368,6 +369,14 @@ class Setup { if (!$user) { $error[] = "User <$username> could not be created."; } + if ($user instanceof IUser && !empty($options['adminemail'])) { + $adminEmail = htmlspecialchars_decode($options['adminemail']); + if (filter_var($adminEmail, FILTER_VALIDATE_EMAIL)) { + $user->setEMailAddress($adminEmail); + } else { + $error[] = "Invalid e-mail-address <$adminEmail> for <$username>."; + } + } } catch(Exception $exception) { $error[] = $exception->getMessage(); } |