Merge pull request #4426 from beganovich/v5-setup-fixes-4415

(v5) Improve setup experience with SMTP testing
This commit is contained in:
Benjamin Beganović 2020-12-03 14:14:23 +01:00 committed by GitHub
commit 17e3c82f40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 10 deletions

View File

@ -176,7 +176,7 @@ class SetupController extends Controller
if (count($response_array) == 0) {
return response([], 200);
} else {
return response()->json($response_array, 200);
return response()->json(['message' => $response_array[0]], 400);
}
} catch (Exception $e) {
info(['message' => $e->getMessage(), 'action' => 'SetupController::checkMail()']);

View File

@ -221,10 +221,9 @@ class SystemHealth
}
try {
Mail::to(config('mail.from.address'))
->send(new TestMailServer('Email Server Works!', config('mail.from.address')));
Mail::to(config('mail.from.address'))->send(new TestMailServer('Email Server Works!', config('mail.from.address')));
} catch (Exception $e) {
return $e->getMessage();
return [$e->getMessage()];
}
/*

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,6 @@
"/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=85bcae0a646882e56b12",
"/js/clients/shared/multiple-downloads.js": "/js/clients/shared/multiple-downloads.js?id=5c35d28cf0a3286e7c45",
"/js/clients/shared/pdf.js": "/js/clients/shared/pdf.js?id=fa54bb4229aba6b0817c",
"/js/setup/setup.js": "/js/setup/setup.js?id=f42b2dee6575623822c2",
"/js/setup/setup.js": "/js/setup/setup.js?id=34b53878aeaca14a2b33",
"/css/card-js.min.css": "/css/card-js.min.css?id=62afeb675235451543ad"
}

View File

@ -32,7 +32,9 @@ class Setup {
Axios.post('/setup/check_db', data)
.then((response) => this.handleSuccess(this.checkDbAlert))
.catch((e) => this.handleFailure(this.checkDbAlert, e.response.data.message));
.catch((e) =>
this.handleFailure(this.checkDbAlert, e.response.data.message)
);
}
handleSmtpCheck() {
@ -51,9 +53,14 @@ class Setup {
.value,
};
this.checkSmtpButton.disabled = true;
Axios.post('/setup/check_mail', data)
.then((response) => this.handleSuccess(this.checkSmtpAlert))
.catch((e) => this.handleFailure(this.checkSmtpAlert));
.catch((e) =>
this.handleFailure(this.checkSmtpAlert, e.response.data.message)
)
.finally(() => (this.checkSmtpButton.disabled = false));
}
handleTestPdfCheck() {
@ -71,7 +78,7 @@ class Setup {
})
.catch((error) => {
console.log(error);
this.handleFailure(this.checkPdfAlert)
this.handleFailure(this.checkPdfAlert);
});
}
@ -83,7 +90,9 @@ class Setup {
handleFailure(element, message = null) {
element.classList.remove('alert-success');
element.innerText = message ? message : "Oops, looks like something isn't correct!";
element.innerText = message
? message
: "Oops, looks like something isn't correct!";
element.classList.add('alert-failure');
}