Support resending of verification mail
ADD
app/Http/Controllers/ResendVerificationMailController.php
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Actions\SendVerificationMailAction;
+use App\Exceptions\UserAlreadyVerifiedException;
+use App\Exceptions\VerificationMailRateLimitException;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+
+class ResendVerificationMailController extends Controller
+{
+ public function __invoke(Request $request)
+ {
+ try {
+ (new SendVerificationMailAction())->execute(Auth::user()->id);
+
+ $request->session()->flash('verification_mail_status', 'success');
+ } catch (UserAlreadyVerifiedException $e) {
+ $request->session()->flash('verification_mail_status', 'already_verified');
+ } catch (VerificationMailRateLimitException $e) {
+ $request->session()->flash('verification_mail_status', 'rate_limited');
+ }
+
+ return redirect()->route('dashboard');
+ }
+}

MODIFY
resources/views/layout.blade.php
resources/views/layout.blade.php
padding: 15px;
color: #FFF;
background: #F86380;
- ">{!! __('general.verify_account') !!}</div>
+ ">{!! __('general.verify_account') !!} (or <form method="POST" action="{{ route('resend_verification_mail') }}" style="display: inline-block;">{{ csrf_field() }}<button class="button link">resend</button></form>)</div>
+ @endif
+ @if (session('verification_mail_status'))
+ <div class="wrapper mt-3">
+ @switch(session('verification_mail_status'))
+ @case('success')
+ @include('partials.alerts.success', ['payload' => ['classes' => '', 'message' => 'An e-mail has been sent your way']])
+ @break
+
+ @case('already_verified')
+ @include('partials.alerts.danger', ['payload' => ['classes' => '', 'message' => 'You\'ve already been verified']])
+ @break
+
+ @case('rate_limited')
+ @include('partials.alerts.danger', ['payload' => ['classes' => '', 'message' => 'Please wait a few minutes before requesting another e-mail']])
+ @break
+ @endswitch
+ </div>
@endif
@yield('body')
@if (auth()->check())

MODIFY
routes/web.php
routes/web.php
@@ -13,6 +13,7 @@ use App\Http\Controllers\LogoutController;
use App\Http\Controllers\RecurringController;
use App\Http\Controllers\RegisterController;
use App\Http\Controllers\ReportController;
+use App\Http\Controllers\ResendVerificationMailController;
use App\Http\Controllers\ResetPasswordController;
use App\Http\Controllers\SettingsController;
use App\Http\Controllers\SpaceController;
@@ -41,6 +42,8 @@ Route::group(['middleware' => ['guest']], function () {
Route::group(['middleware' => ['auth']], function () {
Route::get('/dashboard', DashboardController::class)->name('dashboard');
+ Route::post('/resend-verification-mail', ResendVerificationMailController::class)->name('resend_verification_mail');
+
Route::post('/attachments', [AttachmentController::class, 'store']);
Route::get('/attachments/{attachment}/download', [AttachmentController::class, 'download']);
Route::post('/attachments/{id}/delete', [AttachmentController::class, 'delete']);

Support resending of verification mail