Skip to content

Commit

Permalink
Let the mail_username required except for sendmail
Browse files Browse the repository at this point in the history
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: cachethq#3244
  • Loading branch information
nalysius committed Dec 28, 2018
1 parent c9bc2f5 commit cecf894
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/Http/Controllers/SetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down

0 comments on commit cecf894

Please sign in to comment.