mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Update @thakilla as a contributor
This commit is contained in:
parent
81aaed92ce
commit
cb50142ba3
|
@ -136,28 +136,6 @@ class SettingsController extends Controller
|
||||||
->with('section', 'Pre-Flight Check');
|
->with('section', 'Pre-Flight Check');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test the email configuration
|
|
||||||
*
|
|
||||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
|
||||||
* @since [v3.0]
|
|
||||||
* @return Redirect
|
|
||||||
*/
|
|
||||||
public function ajaxTestEmail()
|
|
||||||
{
|
|
||||||
|
|
||||||
try {
|
|
||||||
Mail::send('emails.test', [], function ($m) {
|
|
||||||
$m->to(config('mail.from.address'), config('mail.from.name'));
|
|
||||||
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
|
||||||
$m->subject(trans('mail.test_email'));
|
|
||||||
});
|
|
||||||
return 'success';
|
|
||||||
} catch (Exception $e) {
|
|
||||||
return 'error';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the first admin user from Setup.
|
* Save the first admin user from Setup.
|
||||||
|
@ -1024,4 +1002,28 @@ class SettingsController extends Controller
|
||||||
public function api() {
|
public function api() {
|
||||||
return view('settings.api');
|
return view('settings.api');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the email configuration
|
||||||
|
*
|
||||||
|
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||||
|
* @since [v3.0]
|
||||||
|
* @return Redirect
|
||||||
|
*/
|
||||||
|
public function ajaxTestEmail()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Mail::send('emails.test', [], function ($m) {
|
||||||
|
$m->to(config('mail.from.address'), config('mail.from.name'));
|
||||||
|
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
|
||||||
|
$m->subject(trans('mail.test_email'));
|
||||||
|
});
|
||||||
|
return response()->json(['message' => 'Mail sent! '], 200);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return response()->json(['message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,6 +178,27 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Mail test -->
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-3">
|
||||||
|
{{ Form::label('login_note', 'Test Mail') }}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9" id="mailtestrow">
|
||||||
|
<a class="btn btn-default btn-sm pull-left" id="mailtest" style="margin-right: 10px;">
|
||||||
|
Send Test</a>
|
||||||
|
<span id="mailtesticon"></span>
|
||||||
|
<span id="mailtestresult"></span>
|
||||||
|
<span id="mailteststatus"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9 col-md-offset-3">
|
||||||
|
<div id="mailteststatus-error" class="text-danger"></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9 col-md-offset-3">
|
||||||
|
<p class="help-block">This will attempt to send a test mail to {{ config('mail.reply_to.address') }}.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div> <!--/.box-body-->
|
</div> <!--/.box-body-->
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<div class="text-left col-md-6">
|
<div class="text-left col-md-6">
|
||||||
|
@ -193,7 +214,7 @@
|
||||||
</div> <!-- /.col-md-8-->
|
</div> <!-- /.col-md-8-->
|
||||||
</div> <!-- /.row-->
|
</div> <!-- /.row-->
|
||||||
|
|
||||||
{{Form::close()}}
|
{{ Form::close() }}
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
|
@ -208,5 +229,50 @@
|
||||||
}).on('ifUnchecked', function(){
|
}).on('ifUnchecked', function(){
|
||||||
$('#auto_increment_prefix').prop('disabled', true);
|
$('#auto_increment_prefix').prop('disabled', true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Test Mail
|
||||||
|
$("#mailtest").click(function(){
|
||||||
|
$("#mailtestrow").removeClass('text-success');
|
||||||
|
$("#mailtestrow").removeClass('text-danger');
|
||||||
|
$("#mailteststatus").html('');
|
||||||
|
$("#mailtesticon").html('<i class="fa fa-spinner spin"></i> Sending Test Email...');
|
||||||
|
$.ajax({
|
||||||
|
url: '{{ route('settings.mailtest') }}',
|
||||||
|
type: 'POST',
|
||||||
|
headers: {
|
||||||
|
"X-Requested-With": 'XMLHttpRequest',
|
||||||
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
|
||||||
|
},
|
||||||
|
data: {},
|
||||||
|
dataType: 'json',
|
||||||
|
|
||||||
|
success: function (data) {
|
||||||
|
$("#mailtesticon").html('');
|
||||||
|
$("#mailteststatus").html('');
|
||||||
|
$('#mailteststatus-error').html('');
|
||||||
|
$("#mailteststatus").removeClass('text-danger');
|
||||||
|
$("#mailteststatus").addClass('text-success');
|
||||||
|
$("#mailteststatus").html('<i class="fa fa-check text-success"></i> Mail sent!');
|
||||||
|
},
|
||||||
|
|
||||||
|
error: function (data) {
|
||||||
|
|
||||||
|
$("#mailtesticon").html('');
|
||||||
|
$("#mailteststatus").html('');
|
||||||
|
$('#mailteststatus-error').html('');
|
||||||
|
$("#mailteststatus").removeClass('text-success');
|
||||||
|
$("#mailteststatus").addClass('text-danger');
|
||||||
|
$("#mailtesticon").html('<i class="fa fa-exclamation-triangle text-danger"></i>');
|
||||||
|
$('#mailteststatus').html('Mail could not be sent.');
|
||||||
|
$('#mailteststatus-error').html('Error: ' + data.responseJSON.messages);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@stop
|
@stop
|
||||||
|
|
Loading…
Reference in a new issue