Add mail data to wizard

This commit is contained in:
Joseph Cohen
2016-06-03 01:26:28 -05:00
committed by James Brooks
parent ca3f516457
commit 958c9eadc7
4 changed files with 48 additions and 7 deletions

View File

@@ -53,7 +53,7 @@ class SetupController extends Controller
'sendmail' => 'Sendmail',
'mailgun' => 'Mailgun',
'mandrill' => 'Mandrill',
'ses' => 'Amazon SES',
// 'ses' => 'Amazon SES', this will be available only if aws/aws-sdk-php is installed
'sparkpost' => 'SparkPost',
];
@@ -88,6 +88,7 @@ class SetupController extends Controller
$this->rulesStep1 = [
'env.cache_driver' => 'required|in:'.implode(',', array_keys($this->cacheDrivers)),
'env.session_driver' => 'required|in:'.implode(',', array_keys($this->cacheDrivers)),
'env.mail_driver' => 'required|in:'.implode(',', array_keys($this->mailDrivers)),
];
$this->rulesStep2 = [
@@ -143,6 +144,14 @@ class SetupController extends Controller
$v = Validator::make($postData, $this->rulesStep1);
$v->sometimes('env.mail_host', 'required', function ($input) {
return $input->mail_driver === 'smtp';
});
$v->sometimes(['env.mail_from', 'env.mail_username', 'env.mail_password'], 'required', function ($input) {
return $input->mail_driver !== 'log';
});
if ($v->passes()) {
return Response::json(['status' => 1]);
}

View File

@@ -28,22 +28,22 @@ return [
],
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'domain' => env('MAIL_USERNAME'),
'secret' => env('MAIL_PASSWORD'),
],
'mandrill' => [
'secret' => env('MANDRILL_SECRET'),
'secret' => env('MAIL_PASSWORD'),
],
'ses' => [
'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'key' => env('MAIL_USERNAME'),
'secret' => env('MAIL_PASSWORD'),
'region' => 'us-east-1',
],
'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
'secret' => env('MAIL_PASSWORD'),
],
];

View File

@@ -24,6 +24,10 @@ return [
'cache_driver' => 'Cache Driver',
'session_driver' => 'Session Driver',
'mail_driver' => 'Mail Driver',
'mail_host' => 'Mail Host',
'mail_from' => 'Mail From',
'mail_username' => 'Mail Client User',
'mail_password' => 'Mail Client Password',
],
// Login form fields

View File

@@ -68,6 +68,34 @@
<span class="text-danger">{{ $errors->first('env.mail_driver') }}</span>
@endif
</div>
<div class="form-group">
<label>{{ trans('forms.setup.mail_host') }} (optional)</label>
<input type="text" class="form-control" name="env[mail_host]" value="{{ Binput::old('env.mail_host') }}">
@if($errors->has('env.mail_host'))
<span class="text-danger">{{ $errors->first('env.mail_host') }}</span>
@endif
</div>
<div class="form-group">
<label>{{ trans('forms.setup.mail_from') }}</label>
<input type="text" class="form-control" name="env[mail_from]" value="{{ Binput::old('env.mail_from') }}" placeholder="notifications@alt-three.com">
@if($errors->has('env.mail_from'))
<span class="text-danger">{{ $errors->first('env.mail_from') }}</span>
@endif
</div>
<div class="form-group">
<label>{{ trans('forms.setup.mail_username') }}</label>
<input type="text" class="form-control" name="env[mail_username]" value="{{ Binput::old('env.mail_username') }}">
@if($errors->has('env.mail_username'))
<span class="text-danger">{{ $errors->first('env.mail_username') }}</span>
@endif
</div>
<div class="form-group">
<label>{{ trans('forms.setup.mail_password') }}</label>
<input type="text" class="form-control" name="env[mail_password]" value="{{ Binput::old('env.mail_password') }}" autocomplete="off">
@if($errors->has('env.mail_password'))
<span class="text-danger">{{ $errors->first('env.mail_password') }}</span>
@endif
</div>
</fieldset>
<hr>
<div class="form-group text-center">