diff --git a/resources/views/setup.blade.php b/resources/views/setup.blade.php index 0b4af7a9122f..c240a5257265 100644 --- a/resources/views/setup.blade.php +++ b/resources/views/setup.blade.php @@ -101,7 +101,7 @@ FLUSH PRIVILEGES; {!! Former::checkbox('terms_checkbox')->label(' ')->text(trans('texts.agree_to_terms', ['terms' => ''.trans('texts.terms_of_service').''])) !!} - {!! Former::actions( Button::primary('Submit')->withAttributes(['onclick' => 'validate()']) ) !!} + {!! Former::actions( Button::primary('Submit')->submit() ) !!} {!! Former::close() !!} @@ -160,14 +160,25 @@ FLUSH PRIVILEGES; return mail_valid; } - function validate() + // Validate Settings + $('form button[type="submit"]').click( function(e) { - // First check if they have already validated the setting if not check them - if( ( db_valid && mail_valid ) || (testDatabase() && testMail()) ) { - $("form").submit(); + // Check DB Settings + if( !db_valid || !testDatabase() ) { + alert('Please check your Database Settings.'); + return false; } - alert('Please double check your settings.'); - } + + // If Mail Settings are incorrect, prompt for continue + if( !mail_valid || !testMail() ) { + var check = confirm("The mail settings are incomplete.\nAre you sure you want to continue?"); + if (!check) { + return false; + } + } + + return true; + }); // Prevent the Enter Button from working $("form").bind("keypress", function (e) {