From 34b9877868bb2e1ae0530f215fd8bd196c358281 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 19 Mar 2021 23:37:57 +1100 Subject: [PATCH] Minor fixes --- app/Console/Kernel.php | 15 ++++----------- app/Factory/CompanyFactory.php | 2 +- app/Http/Middleware/PasswordProtection.php | 4 ++-- app/Utils/SystemHealth.php | 6 ++++++ 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 8e9cb84cddc6..61c3f3f7ece4 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -57,24 +57,17 @@ class Kernel extends ConsoleKernel $schedule->job(new BillingSubscriptionCron)->daily()->withoutOverlapping(); $schedule->job(new RecurringInvoicesCron)->hourly()->withoutOverlapping(); + + $schedule->job(new SchedulerCheck)->everyFiveMinutes(); /* Run hosted specific jobs */ if (Ninja::isHosted()) { - $schedule->job(new AdjustEmailQuota())->daily()->withoutOverlapping(); - $schedule->job(new SendFailedEmails())->daily()->withoutOverlapping(); + $schedule->job(new AdjustEmailQuota)->daily()->withoutOverlapping(); + $schedule->job(new SendFailedEmails)->daily()->withoutOverlapping(); } - /* Run queue's with this*/ - if (Ninja::isSelfHost()) { - $schedule->command('queue:work --daemon')->everyMinute()->withoutOverlapping(); - - //we need to add this as we are seeing cached queues mess up the system on first load. - $schedule->command('queue:restart')->everyFiveMinutes()->withoutOverlapping(); - $schedule->job(new SchedulerCheck)->everyFiveMinutes()->withoutOverlapping(); - - } } /** diff --git a/app/Factory/CompanyFactory.php b/app/Factory/CompanyFactory.php index 6eb846084dc7..928fd871f37f 100644 --- a/app/Factory/CompanyFactory.php +++ b/app/Factory/CompanyFactory.php @@ -35,7 +35,7 @@ class CompanyFactory $company->custom_fields = (object) []; $company->subdomain = ''; $company->enabled_modules = config('ninja.enabled_modules'); //32767;//8191; //4095 - $company->default_password_timeout = 30; + $company->default_password_timeout = 30 * 60000; return $company; } diff --git a/app/Http/Middleware/PasswordProtection.php b/app/Http/Middleware/PasswordProtection.php index 6b7532c69ac8..f4f7f0660bae 100644 --- a/app/Http/Middleware/PasswordProtection.php +++ b/app/Http/Middleware/PasswordProtection.php @@ -42,7 +42,7 @@ class PasswordProtection if($timeout == 0) $timeout = null; else - $timeout = now()->addMinutes($timeout); + $timeout = now()->addMinutes($timeout/60000); if (Cache::get(auth()->user()->hashed_id.'_logged_in')) { @@ -67,7 +67,7 @@ class PasswordProtection ]; //If OAuth and user also has a password set - check both - if ($existing_user = MultiDB::hasUser($query) && auth()->user()->has_password && Hash::check(auth()->user()->password, $request->header('X-API-PASSWORD'))) { + if ($existing_user = MultiDB::hasUser($query) && auth()->user()->has_password && Hash::check(auth()->user()->password, $request->header('X-API-PASSWORD'))) { Cache::add(auth()->user()->hashed_id.'_logged_in', Str::random(64), $timeout); return $next($request); diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php index 12726aedb7cf..3ffee1fd4638 100644 --- a/app/Utils/SystemHealth.php +++ b/app/Utils/SystemHealth.php @@ -78,9 +78,15 @@ class SystemHealth 'phantom_enabled' => (bool)config('ninja.phantomjs_pdf_generation'), 'exec' => (bool)self::checkExecWorks(), 'open_basedir' => (bool)self::checkOpenBaseDir(), + 'mail_mailer' => (string)self::checkMailMailer(), ]; } + public static function checkMailMailer() + { + return config('mail.default'); + } + public static function checkOpenBaseDir() { if (strlen(ini_get('open_basedir') == 0)) {