Remind to verify email #30

This commit is contained in:
AVMG20 2021-06-12 13:59:48 +02:00
parent def2b2b94e
commit 662135451e
4 changed files with 24 additions and 104 deletions

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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 -->

View file

@ -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);