mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 13:57:41 -08:00
Fake sending the test email if the app is in demo mode
This commit is contained in:
parent
2b826c3adc
commit
7153013fb0
|
@ -170,16 +170,19 @@ class SettingsController extends Controller
|
|||
*/
|
||||
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);
|
||||
if (!config('app.lock_passwords')) {
|
||||
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 to '.config('mail.from.address')], 200);
|
||||
} catch (Exception $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
return response()->json(['message' => 'Mail would have been sent, but this application is in demo mode! '], 200);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -250,12 +250,17 @@
|
|||
dataType: 'json',
|
||||
|
||||
success: function (data) {
|
||||
console.dir(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!');
|
||||
if (data.message) {
|
||||
$("#mailteststatus").html('<i class="fa fa-check text-success"></i> ' + data.message);
|
||||
} else {
|
||||
$("#mailteststatus").html('<i class="fa fa-check text-success"></i> Mail sent!');
|
||||
}
|
||||
},
|
||||
|
||||
error: function (data) {
|
||||
|
|
Loading…
Reference in a new issue