瀏覽代碼

Merge pull request #54 from ControlPanel-gg/verify_email

Remind to verify email #30
AVMG 4 年之前
父節點
當前提交
580dc223f8

+ 0 - 53
app/Console/Commands/createUsefulLink.php

@@ -1,53 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Models\UsefulLink;
-use Illuminate\Console\Command;
-
-class createUsefulLink extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'create:usefullink';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'Create a useful link that user can see on the Dashboard';
-
-    /**
-     * Execute the console command.
-     *
-     * @return int
-     */
-    public function handle()
-    {
-        $this->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;
-    }
-}

+ 0 - 45
app/Console/Commands/sendEmailVerification.php

@@ -1,45 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Models\User;
-use Illuminate\Console\Command;
-
-class sendEmailVerification extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-    protected $signature = 'email:send {user}';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = 'Command description';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return int
-     */
-    public function handle()
-    {
-        echo $this->argument('user');
-        User::find($this->argument('user'))->get()[0]->sendEmailVerificationNotification();
-        return 0;
-    }
-}

+ 15 - 1
resources/views/layouts/main.blade.php

@@ -109,7 +109,6 @@
         </ul>
     </nav>
     <!-- /.navbar -->
-
     <!-- Main Sidebar Container -->
     <aside class="main-sidebar sidebar-open sidebar-dark-primary elevation-4">
         <!-- Brand Logo -->
@@ -273,7 +272,22 @@
     </aside>
 
     <!-- Content Wrapper. Contains page content -->
+
     <div class="content-wrapper">
+
+        @if(!Auth::user()->hasVerifiedEmail())
+            @if(Auth::user()->created_at->diffInHours(now(), false) > 2)
+                <div class="alert alert-warning p-2 m-2">
+                    <h5><i class="icon fas fa-exclamation-circle"></i> Warning!</h5>
+                    You have not yet verified your email address <a class="text-primary"
+                                                                    href="{{route('verification.send')}}">Click here to
+                        resend
+                        verification email</a> <br>
+                    Please contact support If you didn't receive your verification email.
+                </div>
+            @endif
+        @endif
+
         @yield('content')
     </div>
     <!-- /.content-wrapper -->

+ 9 - 5
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);