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
This commit is contained in:
Anthony Bocci
2018-12-28 19:42:42 +01:00
parent c9bc2f52d4
commit cecf894911

View File

@@ -198,6 +198,10 @@ class SetupController extends Controller
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]);
}