From 662135451e3a6bebaed7bb3ed7cd52251b81e1b9 Mon Sep 17 00:00:00 2001 From: AVMG20 Date: Sat, 12 Jun 2021 13:59:48 +0200 Subject: [PATCH] Remind to verify email #30 --- app/Console/Commands/createUsefulLink.php | 53 ------------------- .../Commands/sendEmailVerification.php | 45 ---------------- resources/views/layouts/main.blade.php | 16 +++++- routes/web.php | 14 +++-- 4 files changed, 24 insertions(+), 104 deletions(-) delete mode 100644 app/Console/Commands/createUsefulLink.php delete mode 100644 app/Console/Commands/sendEmailVerification.php diff --git a/app/Console/Commands/createUsefulLink.php b/app/Console/Commands/createUsefulLink.php deleted file mode 100644 index e65c57a5..00000000 --- a/app/Console/Commands/createUsefulLink.php +++ /dev/null @@ -1,53 +0,0 @@ -alert('You can add Icons to your useful links. Go to https://fontawesome.com/v5.15/icons?d=gallery&p=2 and copy an Icon name.'); - - $icon = $this->ask('Specify the class(es) of the font-awesome icon you want to use as the icon. (e.x: ad, fa fa-briefcase, fab fa-discord)', ''); - $title = $this->ask('What do you want the title to be of this message?', 'Default Useful Link Title'); - $message= $this->ask('Now please type the message you want to show. Tip: You can use HTML to format!'); - $link = $this->ask('Please fill in a valid Link. Users can click the title to go to the link', 'https://bitsec.dev'); - - $usefulLink = UsefulLink::create([ - 'icon' => $icon, - 'title' => $title, - 'link' => $link, - 'message' => $message - ]); - - $this->alert('Command ran successful inserted useful link into database'); - - $this->table(['Icon', 'Title', 'Link', 'Message'], [ - [$icon, $title, $link, $message] - ]); - - return 1; - } -} diff --git a/app/Console/Commands/sendEmailVerification.php b/app/Console/Commands/sendEmailVerification.php deleted file mode 100644 index 546d09b3..00000000 --- a/app/Console/Commands/sendEmailVerification.php +++ /dev/null @@ -1,45 +0,0 @@ -argument('user'); - User::find($this->argument('user'))->get()[0]->sendEmailVerificationNotification(); - return 0; - } -} diff --git a/resources/views/layouts/main.blade.php b/resources/views/layouts/main.blade.php index f0bdd03a..5cfa4957 100644 --- a/resources/views/layouts/main.blade.php +++ b/resources/views/layouts/main.blade.php @@ -109,7 +109,6 @@ - +
+ + @if(!Auth::user()->hasVerifiedEmail()) + @if(Auth::user()->created_at->diffInHours(now(), false) > 2) +
+
Warning!
+ You have not yet verified your email address Click here to + resend + verification email
+ Please contact support If you didn't receive your verification email. +
+ @endif + @endif + @yield('content')
diff --git a/routes/web.php b/routes/web.php index d6c0d42e..ae9ce345 100644 --- a/routes/web.php +++ b/routes/web.php @@ -18,7 +18,9 @@ use App\Http\Controllers\NotificationController; use App\Http\Controllers\ProfileController; use App\Http\Controllers\ServerController; use App\Http\Controllers\StoreController; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Route; +use Illuminate\Http\Request; /* |-------------------------------------------------------------------------- @@ -35,14 +37,16 @@ Route::middleware('guest')->get('/', function () { return redirect('login'); })->name('welcome'); -Route::get('/terms', function () { - return view('terms'); -})->name('terms'); - - Auth::routes(['verify' => true]); Route::middleware('auth')->group(function () { + #resend verification email + Route::get('/email/verification-notification', function (Request $request) { + $request->user()->sendEmailVerificationNotification(); + + return back()->with('success', 'Verification link sent!'); + })->middleware(['auth', 'throttle:3,1'])->name('verification.send'); + #normal routes Route::resource('notifications', NotificationController::class); Route::resource('servers', ServerController::class);