1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Fix request validation for preconfigured installs

This commit is contained in:
Joshua Dwire 2021-03-12 18:46:56 -05:00
parent a844afd128
commit 941132133c

View File

@ -27,31 +27,38 @@ class StoreSetupRequest extends Request
public function rules()
{
return [
/*System*/
'url' => 'required',
/*Database*/
'db_host' => 'required',
'db_database' => 'required',
'db_username' => 'required',
'db_password' => '',
/*Mail driver*/
'mail_driver' => 'required',
'encryption' => 'required_unless:mail_driver,log',
'mail_host' => 'required_unless:mail_driver,log',
'mail_username' => 'required_unless:mail_driver,log',
'mail_name' => 'required_unless:mail_driver,log',
'mail_address' => 'required_unless:mail_driver,log',
'mail_password' => 'required_unless:mail_driver,log',
/*user registration*/
'privacy_policy' => 'required',
'terms_of_service' => 'required',
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required|email:rfc,dns',
'password' => 'required',
];
}
$rules = [
/*System*/
'url' => 'required',
/*Mail driver*/
'mail_driver' => 'required',
'encryption' => 'required_unless:mail_driver,log',
'mail_host' => 'required_unless:mail_driver,log',
'mail_username' => 'required_unless:mail_driver,log',
'mail_name' => 'required_unless:mail_driver,log',
'mail_address' => 'required_unless:mail_driver,log',
'mail_password' => 'required_unless:mail_driver,log',
/*user registration*/
'privacy_policy' => 'required',
'terms_of_service' => 'required',
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required|email:rfc,dns',
'password' => 'required',
];
if ( ! config( 'ninja.preconfigured_install' ) ) {
$rules = array_merge( $rules, [
/*Database*/
'db_host' => 'required',
'db_database' => 'required',
'db_username' => 'required',
'db_password' => '',
] );
}
return $rules;
}
protected function prepareForValidation()
{