From c9bc2f52d429fb57a4bbc657066ce7f913c4470d Mon Sep 17 00:00:00 2001 From: Anthony Bocci Date: Sat, 20 Oct 2018 18:39:38 +0200 Subject: [PATCH 1/2] Set the mail username optional in setup During the setup process email informations were asked: - Driver - Host - Username - Password In some situations the username is not useful because the Cachet's host may be configured to forward email to a server. The problem is the username was required, so we had to set a username and then update the .env file to remove it. To fix this problem, the mail username has been set to optional in the setup. So if someone needs a username it still can use this field, and otherwise people can let it empty. See: #3244 --- app/Http/Controllers/SetupController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index 0edf88feb4db..6a789c831025 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -194,7 +194,7 @@ public function postStep1() return $input->env['mail_driver'] === 'smtp'; }); - $v->sometimes(['env.mail_address', 'env.mail_username', 'env.mail_password'], 'required', function ($input) { + $v->sometimes(['env.mail_address', 'env.mail_password'], 'required', function ($input) { return !in_array($input->env['mail_driver'], ['log', 'smtp']); }); From cecf8949116a103430db33e757b9ef8bf6a2b6ac Mon Sep 17 00:00:00 2001 From: Anthony Bocci Date: Fri, 28 Dec 2018 19:42:42 +0100 Subject: [PATCH 2/2] Let the mail_username required except for sendmail During the setup the "mail_username" was required and it was then undone, so using the sendmail driver we can let the username empty. It would be bad to let the username optional for every drivers, because in some configurations, like SMTP, the username is required for the SMTP server so if the user let it empty its mail configuration will be bad. The mail_username is now optional only if the mail driver is sendmail. See: #3244 --- app/Http/Controllers/SetupController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index 6a789c831025..6c978e790343 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -198,6 +198,10 @@ public function postStep1() return !in_array($input->env['mail_driver'], ['log', 'smtp']); }); + $v->sometimes(['env.mail_username'], 'required', function($input) { + return !in_array($input->env['mail_username'], ['sendmail']); + }); + if ($v->passes()) { return Response::json(['status' => 1]); }