From a5ba9eb3f87890bdfdc78dbb6738959db1f04225 Mon Sep 17 00:00:00 2001 From: Leonid Nikitin Date: Sat, 9 Dec 2023 00:54:12 +0600 Subject: [PATCH 1/2] I added (int) to the configuration in the parameters, where we get the numbers through the env function. --- config/captcha.php | 8 ++++---- config/rate_limiting.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/captcha.php b/config/captcha.php index c06af38..dfe9069 100644 --- a/config/captcha.php +++ b/config/captcha.php @@ -1,10 +1,10 @@ env('WAITING_FOR_CAPTCHA_VERIFICATION_IN_SECONDS', 900), - 'validate_max_count_errors' => env('CAPTCHA_VALIDATE_MAX_COUNT_ERRORS', 3), - 'max_info_display_count' => env('CAPTCHA_MAX_INFO_DISPLAY_COUNT', 1), - 'verification_data_view_limit_in_minutes' => env('CAPTCHA_VERIFICATION_DATA_VIEW_LIMIT_IN_MINUTES', 60), + 'waiting_for_captcha_verification_in_seconds' => (int) env('WAITING_FOR_CAPTCHA_VERIFICATION_IN_SECONDS', 900), + 'validate_max_count_errors' => (int) env('CAPTCHA_VALIDATE_MAX_COUNT_ERRORS', 3), + 'max_info_display_count' => (int) env('CAPTCHA_MAX_INFO_DISPLAY_COUNT', 1), + 'verification_data_view_limit_in_minutes' => (int) env('CAPTCHA_VERIFICATION_DATA_VIEW_LIMIT_IN_MINUTES', 60), 'imageClass' => \App\Captcha\Images\Image::class, 'types' => [ 'string' => [ diff --git a/config/rate_limiting.php b/config/rate_limiting.php index b5fc841..1546686 100644 --- a/config/rate_limiting.php +++ b/config/rate_limiting.php @@ -3,6 +3,6 @@ return [ /** * Max limit of the hour. */ - 'login_max_request' => env('LOGIN_MAX_REQUEST', 50), - 'login_max_email_request' => env('LOGIN_MAX_EMAIL_REQUEST', 10), + 'login_max_request' => (int) env('LOGIN_MAX_REQUEST', 50), + 'login_max_email_request' => (int) env('LOGIN_MAX_EMAIL_REQUEST', 10), ]; From 172a9460dfe059abda3eb95653d4c6b48c8f8d68 Mon Sep 17 00:00:00 2001 From: Leonid Nikitin Date: Sat, 9 Dec 2023 00:55:56 +0600 Subject: [PATCH 2/2] Fix https on prod. Added the force_https parameter to env APP_FORCE_HTTPS. This will force https to be enabled. --- .env.example | 2 ++ app/Providers/AppServiceProvider.php | 5 +++++ config/app.php | 2 ++ 3 files changed, 9 insertions(+) diff --git a/.env.example b/.env.example index b4cc4a0..4499f8a 100644 --- a/.env.example +++ b/.env.example @@ -4,6 +4,8 @@ APP_KEY= APP_DEBUG=true APP_URL=http://localhost +APP_FORCE_HTTPS=false + APP_DEMO_MODE=false APP_DEMO_EMAIL= APP_DEMO_PASSWORD= diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index cf4eb71..2294623 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -22,6 +22,7 @@ use App\Services\Search\Search; use Illuminate\Contracts\Foundation\Application; use Illuminate\Pagination\Paginator; use Illuminate\Support\Facades\Blade; +use Illuminate\Support\Facades\URL; use Illuminate\Support\ServiceProvider; use Illuminate\Validation\Rules\Password; @@ -70,6 +71,10 @@ final class AppServiceProvider extends ServiceProvider return Helpers::isDemoMode(); }); + if (config('app.force_https') === true) { + URL::forceScheme('https'); + } + Password::defaults(function () { $rule = Password::min(8); diff --git a/config/app.php b/config/app.php index 9fd6d96..6235015 100644 --- a/config/app.php +++ b/config/app.php @@ -70,6 +70,8 @@ return [ 'asset_url' => env('ASSET_URL'), + 'force_https' => (bool) env('APP_FORCE_HTTPS', false), + /* |-------------------------------------------------------------------------- | Application Timezone