mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
Test postmark connection before storing credentials into the app
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
## Version 2.0.16
|
||||
#### Release date: 8. April 2022
|
||||
- Test mailgun connection before storing your credentials into the app
|
||||
- Test mailgun and postmark connection before storing your credentials into the app
|
||||
- UI enhancements & fixes
|
||||
|
||||
## Version 2.0.15
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"/chunks/status-check.js": "/chunks/status-check.js?id=f82f9939c1326fe2",
|
||||
"/chunks/purchase-code.js": "/chunks/purchase-code.js?id=df5bd89528649783",
|
||||
"/chunks/database.js": "/chunks/database.js?id=15cc488117dccf7b",
|
||||
"/chunks/environment.js": "/chunks/environment.js?id=dfc24aa910b0c667",
|
||||
"/chunks/environment.js": "/chunks/environment.js?id=4812fa7819b6b000",
|
||||
"/chunks/app-setup.js": "/chunks/app-setup.js?id=15938ff1ad2d6ed2",
|
||||
"/chunks/admin-account.js": "/chunks/admin-account.js?id=916450217130f3b8",
|
||||
"/chunks/shared.js": "/chunks/shared.js?id=ec06bf0d3ada0f65",
|
||||
@@ -42,7 +42,7 @@
|
||||
"/chunks/app-settings.js": "/chunks/app-settings.js?id=55da23af2b076069",
|
||||
"/chunks/app-appearance.js": "/chunks/app-appearance.js?id=a694a01f3641712c",
|
||||
"/chunks/app-index.js": "/chunks/app-index.js?id=efdbfa062749ca00",
|
||||
"/chunks/app-environment.js": "/chunks/app-environment.js?id=85670492c4e9fe78",
|
||||
"/chunks/app-environment.js": "/chunks/app-environment.js?id=831c66051bcd43db",
|
||||
"/chunks/app-others.js": "/chunks/app-others.js?id=abb8d96cd7c3a576",
|
||||
"/chunks/app-sign-in-out.js": "/chunks/app-sign-in-out.js?id=1cfffc99465b9a7a",
|
||||
"/chunks/app-adsense.js": "/chunks/app-adsense.js?id=a5dc9e715f8561bd",
|
||||
|
||||
2
resources/js/store/modules/lists.js
vendored
2
resources/js/store/modules/lists.js
vendored
@@ -31,7 +31,7 @@ const defaultState = {
|
||||
value: 'postmark',
|
||||
},
|
||||
{
|
||||
label: 'None (Log)',
|
||||
label: 'None',
|
||||
value: 'log',
|
||||
},
|
||||
],
|
||||
|
||||
@@ -381,6 +381,18 @@
|
||||
:isError="errors[0]"
|
||||
/>
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
|
||||
<ValidationProvider tag="div" mode="passive" name="Sender" rules="required|email" v-slot="{ errors }">
|
||||
<AppInputText title="Sender (Email)" :error="errors[0]">
|
||||
<input
|
||||
class="focus-border-theme input-dark"
|
||||
v-model="mailgun.sender"
|
||||
placeholder="Type your sender email..."
|
||||
type="text"
|
||||
:class="{ '!border-rose-600': errors[0] }"
|
||||
/>
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
|
||||
@@ -396,6 +408,18 @@
|
||||
/>
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
|
||||
<ValidationProvider tag="div" mode="passive" name="Sender" rules="required|email" v-slot="{ errors }">
|
||||
<AppInputText title="Sender Signature (Email)" :error="errors[0]">
|
||||
<input
|
||||
class="focus-border-theme input-dark"
|
||||
v-model="postmark.sender"
|
||||
placeholder="Type your sender signature..."
|
||||
type="text"
|
||||
:class="{ '!border-rose-600': errors[0] }"
|
||||
/>
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
|
||||
<div v-if="mailDriver === 'ses'">
|
||||
@@ -902,9 +926,11 @@ export default {
|
||||
domain: undefined,
|
||||
secret: undefined,
|
||||
endpoint: undefined,
|
||||
sender: undefined,
|
||||
},
|
||||
postmark: {
|
||||
token: undefined,
|
||||
sender: undefined,
|
||||
},
|
||||
broadcast: {
|
||||
driver: undefined,
|
||||
|
||||
@@ -298,6 +298,18 @@
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
|
||||
<ValidationProvider tag="div" mode="passive" name="Sender" rules="required|email" v-slot="{ errors }">
|
||||
<AppInputText title="Sender (Email)" :error="errors[0]">
|
||||
<input
|
||||
class="focus-border-theme input-dark"
|
||||
v-model="mailgun.sender"
|
||||
placeholder="Type your sender email..."
|
||||
type="text"
|
||||
:class="{ '!border-rose-600': errors[0] }"
|
||||
/>
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
|
||||
<ValidationProvider
|
||||
tag="div"
|
||||
mode="passive"
|
||||
@@ -318,7 +330,7 @@
|
||||
|
||||
<div v-if="mailDriver === 'postmark'">
|
||||
<ValidationProvider tag="div" mode="passive" name="Token" rules="required" v-slot="{ errors }">
|
||||
<AppInputText title="Token" :error="errors[0]" :is-last="true">
|
||||
<AppInputText title="Token" :error="errors[0]">
|
||||
<input
|
||||
class="focus-border-theme input-dark"
|
||||
v-model="postmark.token"
|
||||
@@ -328,6 +340,18 @@
|
||||
/>
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
|
||||
<ValidationProvider tag="div" mode="passive" name="Sender" rules="required|email" v-slot="{ errors }">
|
||||
<AppInputText title="Sender Signature (Email)" :is-last="true" :error="errors[0]">
|
||||
<input
|
||||
class="focus-border-theme input-dark"
|
||||
v-model="postmark.sender"
|
||||
placeholder="Type your sender signature..."
|
||||
type="text"
|
||||
:class="{ '!border-rose-600': errors[0] }"
|
||||
/>
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
|
||||
<div v-if="mailDriver === 'ses'">
|
||||
@@ -911,10 +935,12 @@ export default {
|
||||
domain: undefined,
|
||||
secret: undefined,
|
||||
endpoint: undefined,
|
||||
sender: undefined,
|
||||
},
|
||||
postmark: {
|
||||
token: undefined,
|
||||
},
|
||||
sender: undefined,
|
||||
},
|
||||
broadcast: {
|
||||
driver: undefined,
|
||||
id: undefined,
|
||||
|
||||
@@ -19,7 +19,9 @@ class TestMailgunConnectionAction
|
||||
// Set temporary mail connection
|
||||
config([
|
||||
'mail' => [
|
||||
'driver' => 'mailgun',
|
||||
'driver' => 'mailgun',
|
||||
'from.address' => $credentials['sender'],
|
||||
'from.name' => $credentials['sender'],
|
||||
],
|
||||
'services' => [
|
||||
'mailgun' => [
|
||||
@@ -31,7 +33,7 @@ class TestMailgunConnectionAction
|
||||
]);
|
||||
|
||||
// Send test email
|
||||
Mail::to('test@hi5ve.digital')->send(new TestMail('example@domain.com'));
|
||||
Mail::to($credentials['sender'])->send(new TestMail($credentials['sender']));
|
||||
} catch (TransportException | LogicException $error) {
|
||||
abort(
|
||||
response()->json([
|
||||
|
||||
34
src/Domain/Settings/Actions/TestPostmarkConnectionAction.php
Normal file
34
src/Domain/Settings/Actions/TestPostmarkConnectionAction.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace Domain\Settings\Actions;
|
||||
|
||||
use Mail;
|
||||
use Domain\Settings\Mail\TestMail;
|
||||
use Symfony\Component\Mailer\Exception\LogicException;
|
||||
use Symfony\Component\Mailer\Exception\TransportException;
|
||||
|
||||
class TestPostmarkConnectionAction
|
||||
{
|
||||
public function __invoke(array $credentials)
|
||||
{
|
||||
try {
|
||||
// Set temporary mail connection
|
||||
config([
|
||||
'mail.driver' => 'postmark',
|
||||
'mail.from.address' => $credentials['sender'],
|
||||
'mail.from.name' => $credentials['sender'],
|
||||
'services.postmark.token' => $credentials['token'],
|
||||
]);
|
||||
|
||||
// Send test email
|
||||
Mail::to($credentials['sender'])->send(new TestMail($credentials['sender']));
|
||||
} catch (TransportException | LogicException $error) {
|
||||
abort(
|
||||
response()->json([
|
||||
'type' => 'mailer-connection-error',
|
||||
'title' => 'Mail Connection Error',
|
||||
'message' => $error->getMessage(),
|
||||
], 401)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,10 +30,11 @@ class TestSMTPConnectionAction
|
||||
],
|
||||
]]);
|
||||
|
||||
// Get sender
|
||||
$sender = $credentials['email'] ?? $credentials['username'];
|
||||
|
||||
// Send test email
|
||||
Mail::to('test@hi5ve.digital')->send(new TestMail($sender));
|
||||
Mail::to($sender)->send(new TestMail($sender));
|
||||
} catch (TransportException | LogicException $error) {
|
||||
abort(
|
||||
response()->json([
|
||||
|
||||
@@ -5,11 +5,13 @@ use Artisan;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Domain\Settings\Actions\TestSMTPConnectionAction;
|
||||
use Domain\Settings\Actions\TestMailgunConnectionAction;
|
||||
use Domain\Settings\Actions\TestPostmarkConnectionAction;
|
||||
use Domain\Settings\Requests\StoreEmailCredentialsRequest;
|
||||
|
||||
class StoreEmailCredentialsController
|
||||
{
|
||||
public function __construct(
|
||||
private TestPostmarkConnectionAction $testPostmarkConnection,
|
||||
private TestMailgunConnectionAction $testMailgunConnection,
|
||||
private TestSMTPConnectionAction $testSMTPConnection,
|
||||
) {
|
||||
@@ -38,16 +40,23 @@ class StoreEmailCredentialsController
|
||||
'domain' => $request->input('mailgun.domain'),
|
||||
'secret' => $request->input('mailgun.secret'),
|
||||
'endpoint' => $request->input('mailgun.endpoint'),
|
||||
'sender' => $request->input('mailgun.sender'),
|
||||
]),
|
||||
'postmark' => ($this->testPostmarkConnection)([
|
||||
'token' => $request->input('postmark.token'),
|
||||
'sender' => $request->input('postmark.sender'),
|
||||
]),
|
||||
};
|
||||
|
||||
$mail = [
|
||||
'log' => [
|
||||
'MAIL_DRIVER' => 'log',
|
||||
'MAIL_DRIVER' => 'log',
|
||||
],
|
||||
'postmark' => [
|
||||
'MAIL_DRIVER' => 'postmark',
|
||||
'POSTMARK_TOKEN' => $request->input('postmark.token'),
|
||||
'MAIL_DRIVER' => 'postmark',
|
||||
'POSTMARK_TOKEN' => $request->input('postmark.token'),
|
||||
'MAIL_FROM_ADDRESS' => $request->input('postmark.sender'),
|
||||
'MAIL_FROM_NAME' => $request->input('postmark.sender'),
|
||||
],
|
||||
'smtp' => [
|
||||
'MAIL_DRIVER' => 'smtp',
|
||||
@@ -56,8 +65,8 @@ class StoreEmailCredentialsController
|
||||
'MAIL_USERNAME' => $request->input('smtp.username'),
|
||||
'MAIL_PASSWORD' => $request->input('smtp.password'),
|
||||
'MAIL_ENCRYPTION' => $request->input('smtp.encryption') ?? '',
|
||||
'MAIL_FROM_ADDRESS' => $request->input('smtp.email') ?? '"${MAIL_USERNAME}"',
|
||||
'MAIL_FROM_NAME' => $request->input('smtp.email') ?? '"${MAIL_USERNAME}"',
|
||||
'MAIL_FROM_ADDRESS' => $request->input('smtp.email') ?? $request->input('smtp.username'),
|
||||
'MAIL_FROM_NAME' => $request->input('smtp.email') ?? $request->input('smtp.username'),
|
||||
],
|
||||
'ses' => [
|
||||
'MAIL_DRIVER' => 'ses',
|
||||
@@ -67,10 +76,12 @@ class StoreEmailCredentialsController
|
||||
'AWS_SESSION_TOKEN' => $request->input('ses.session_token'),
|
||||
],
|
||||
'mailgun' => [
|
||||
'MAIL_DRIVER' => 'mailgun',
|
||||
'MAILGUN_DOMAIN' => $request->input('mailgun.domain'),
|
||||
'MAILGUN_SECRET' => $request->input('mailgun.secret'),
|
||||
'MAILGUN_ENDPOINT' => $request->input('mailgun.endpoint'),
|
||||
'MAIL_DRIVER' => 'mailgun',
|
||||
'MAILGUN_DOMAIN' => $request->input('mailgun.domain'),
|
||||
'MAILGUN_SECRET' => $request->input('mailgun.secret'),
|
||||
'MAILGUN_ENDPOINT' => $request->input('mailgun.endpoint'),
|
||||
'MAIL_FROM_ADDRESS' => $request->input('mailgun.sender'),
|
||||
'MAIL_FROM_NAME' => $request->input('mailgun.sender'),
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use Domain\Settings\DTO\S3CredentialsData;
|
||||
use Domain\Settings\Actions\TestS3ConnectionAction;
|
||||
use Domain\Settings\Actions\TestSMTPConnectionAction;
|
||||
use Domain\Settings\Actions\TestMailgunConnectionAction;
|
||||
use Domain\Settings\Actions\TestPostmarkConnectionAction;
|
||||
use Domain\SetupWizard\Requests\StoreEnvironmentSetupRequest;
|
||||
|
||||
class StoreEnvironmentSettingsController extends Controller
|
||||
@@ -16,6 +17,7 @@ class StoreEnvironmentSettingsController extends Controller
|
||||
private TestS3ConnectionAction $testS3Connection,
|
||||
private TestSMTPConnectionAction $testSMTPConnection,
|
||||
private TestMailgunConnectionAction $testMailgunConnection,
|
||||
private TestPostmarkConnectionAction $testPostmarkConnection,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -45,6 +47,11 @@ class StoreEnvironmentSettingsController extends Controller
|
||||
'domain' => $request->input('mailgun.domain'),
|
||||
'secret' => $request->input('mailgun.secret'),
|
||||
'endpoint' => $request->input('mailgun.endpoint'),
|
||||
'sender' => $request->input('mailgun.sender'),
|
||||
]),
|
||||
'postmark' => ($this->testPostmarkConnection)([
|
||||
'token' => $request->input('postmark.token'),
|
||||
'sender' => $request->input('postmark.sender'),
|
||||
]),
|
||||
};
|
||||
|
||||
@@ -85,11 +92,13 @@ class StoreEnvironmentSettingsController extends Controller
|
||||
],
|
||||
'mail' => [
|
||||
'log' => [
|
||||
'MAIL_DRIVER' => 'log',
|
||||
'MAIL_DRIVER' => 'log',
|
||||
],
|
||||
'postmark' => [
|
||||
'MAIL_DRIVER' => 'postmark',
|
||||
'POSTMARK_TOKEN' => $request->input('postmark.token'),
|
||||
'MAIL_DRIVER' => 'postmark',
|
||||
'POSTMARK_TOKEN' => $request->input('postmark.token'),
|
||||
'MAIL_FROM_ADDRESS' => $request->input('postmark.sender'),
|
||||
'MAIL_FROM_NAME' => $request->input('postmark.sender'),
|
||||
],
|
||||
'smtp' => [
|
||||
'MAIL_DRIVER' => 'smtp',
|
||||
@@ -98,8 +107,8 @@ class StoreEnvironmentSettingsController extends Controller
|
||||
'MAIL_USERNAME' => $request->input('smtp.username'),
|
||||
'MAIL_PASSWORD' => $request->input('smtp.password'),
|
||||
'MAIL_ENCRYPTION' => $request->input('smtp.encryption') ?? '',
|
||||
'MAIL_FROM_ADDRESS' => $request->input('smtp.email') ?? '"${MAIL_USERNAME}"',
|
||||
'MAIL_FROM_NAME' => $request->input('smtp.email') ?? '"${MAIL_USERNAME}"',
|
||||
'MAIL_FROM_ADDRESS' => $request->input('smtp.email') ?? $request->input('smtp.username'),
|
||||
'MAIL_FROM_NAME' => $request->input('smtp.email') ?? $request->input('smtp.username'),
|
||||
],
|
||||
'ses' => [
|
||||
'MAIL_DRIVER' => 'ses',
|
||||
@@ -109,10 +118,12 @@ class StoreEnvironmentSettingsController extends Controller
|
||||
'AWS_SESSION_TOKEN' => $request->input('ses.session_token'),
|
||||
],
|
||||
'mailgun' => [
|
||||
'MAIL_DRIVER' => 'mailgun',
|
||||
'MAILGUN_DOMAIN' => $request->input('mailgun.domain'),
|
||||
'MAILGUN_SECRET' => $request->input('mailgun.secret'),
|
||||
'MAILGUN_ENDPOINT' => $request->input('mailgun.endpoint'),
|
||||
'MAIL_DRIVER' => 'mailgun',
|
||||
'MAILGUN_DOMAIN' => $request->input('mailgun.domain'),
|
||||
'MAILGUN_SECRET' => $request->input('mailgun.secret'),
|
||||
'MAILGUN_ENDPOINT' => $request->input('mailgun.endpoint'),
|
||||
'MAIL_FROM_ADDRESS' => $request->input('mailgun.sender'),
|
||||
'MAIL_FROM_NAME' => $request->input('mailgun.sender'),
|
||||
],
|
||||
],
|
||||
'environment' => [
|
||||
|
||||
Reference in New Issue
Block a user