diff --git a/CHANGELOG.md b/CHANGELOG.md index d7ee1304e..17f621e09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Added - Added ```BANNED_USERNAMES``` .env var, an optional comma separated string to ban specific usernames from being used ([6cdd64c6](https://github.com/pixelfed/pixelfed/commit/6cdd64c6)) - Added RestrictedAccess middleware for Restricted Mode ([17c1a83d](https://github.com/pixelfed/pixelfed/commit/17c1a83d)) +- Added FailedJob garbage collection ([5d424f12](https://github.com/pixelfed/pixelfed/commit/5d424f12)) +- Added Password Reset garbage collection ([829c41e1](https://github.com/pixelfed/pixelfed/commit/829c41e1)) ### Fixed - Fixed Story Compose bug affecting postgres instances ([#1918](https://github.com/pixelfed/pixelfed/pull/1918)) @@ -22,6 +24,9 @@ - Updated StoryCompose component, added upload progress page ([2de3c56f](https://github.com/pixelfed/pixelfed/commit/2de3c56f)) - Updated instance config, cleanup and add restricted mode ([3be32597](https://github.com/pixelfed/pixelfed/commit/3be32597)) - Update RelationshipSettings Controller, fixes #1605 ([4d2da2f1](https://github.com/pixelfed/pixelfed/commit/4d2da2f1)) +- Updated password reset, now expires after 24 hours ([829c41e1](https://github.com/pixelfed/pixelfed/commit/829c41e1)) +- Updated nav layout ([73249dc2](https://github.com/pixelfed/pixelfed/commit/73249dc2)) +- Updated views with noscript warnings ([eaca43a6](https://github.com/pixelfed/pixelfed/commit/eaca43a6)) ### Changed diff --git a/app/Console/Commands/FailedJobGC.php b/app/Console/Commands/FailedJobGC.php new file mode 100644 index 000000000..f48d49b84 --- /dev/null +++ b/app/Console/Commands/FailedJobGC.php @@ -0,0 +1,49 @@ +failed_at->lt(now()->subMonth())) { + $job->delete(); + } + } + }); + } +} diff --git a/app/Console/Commands/PasswordResetGC.php b/app/Console/Commands/PasswordResetGC.php new file mode 100644 index 000000000..2dbcc35e6 --- /dev/null +++ b/app/Console/Commands/PasswordResetGC.php @@ -0,0 +1,48 @@ +subMinutes(1441)) + ->chunk(50, function($emails) { + foreach($emails as $em) { + $em->delete(); + } + }); + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 1e3364afc..a29ace355 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -31,6 +31,8 @@ class Kernel extends ConsoleKernel ->hourly(); $schedule->command('horizon:snapshot')->everyFiveMinutes(); $schedule->command('story:gc')->everyFiveMinutes(); + $schedule->command('gc:failedjobs')->dailyAt(3); + $schedule->command('gc:passwordreset')->dailyAt('09:41'); } /** diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 57301a8b1..37ccbba3f 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -6,6 +6,7 @@ use Auth; use Cache; use Mail; use Illuminate\Support\Facades\Redis; +use Illuminate\Support\Str; use Carbon\Carbon; use App\Mail\ConfirmEmail; use Illuminate\Http\Request; @@ -80,8 +81,8 @@ class AccountController extends Controller EmailVerification::whereUserId(Auth::id())->delete(); $user = User::whereNull('email_verified_at')->find(Auth::id()); - $utoken = str_random(64); - $rtoken = str_random(128); + $utoken = Str::uuid() . Str::random(mt_rand(5,9)); + $rtoken = Str::random(mt_rand(64, 70)); $verify = new EmailVerification(); $verify->user_id = $user->id; @@ -98,7 +99,7 @@ class AccountController extends Controller public function confirmVerifyEmail(Request $request, $userToken, $randomToken) { $verify = EmailVerification::where('user_token', $userToken) - ->where('created_at', '>', now()->subWeeks(2)) + ->where('created_at', '>', now()->subHours(24)) ->where('random_token', $randomToken) ->firstOrFail(); diff --git a/resources/views/emails/confirm_email.blade.php b/resources/views/emails/confirm_email.blade.php index cb521c9b9..2fc98a751 100644 --- a/resources/views/emails/confirm_email.blade.php +++ b/resources/views/emails/confirm_email.blade.php @@ -1,12 +1,17 @@ @component('mail::message') # Email Confirmation -Please confirm your email address. +Hello @{{$verify->user->username}}, please confirm your email address. + +If you did not create this account, please disregard this email. @component('mail::button', ['url' => $verify->url()]) Confirm Email @endcomponent +

This link expires after 24 hours.

+
+ Thanks,
-{{ config('pixelfed.domain.app') }} +{{ config('pixelfed.domain.app') }} @endcomponent diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 46b01ba82..c46cc59b4 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -41,6 +41,12 @@ @include('layouts.partial.nav')
@yield('content') +