-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
226 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
app/Http/Controllers/Auth/UserVerificationPromptController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Providers\RouteServiceProvider; | ||
use Illuminate\Http\Request; | ||
|
||
class UserVerificationPromptController extends Controller | ||
{ | ||
/** | ||
* Display the user verification prompt. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return mixed | ||
*/ | ||
public function __invoke(Request $request) | ||
{ | ||
return $request->user()->hasVerifiedUser() | ||
? redirect()->intended(RouteServiceProvider::HOME) | ||
: view('auth.verify-user'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use Closure; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
|
||
class RedirectIfUnverified | ||
{ | ||
/** | ||
* Handle an incoming request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Closure $next | ||
* @param array ...$guards | ||
* @return mixed | ||
*/ | ||
public function handle(Request $request, Closure $next, ...$guards) | ||
{ | ||
$guards = empty($guards) ? [null] : $guards; | ||
|
||
foreach ($guards as $guard) { | ||
if (Auth::guard($guard)->check() && !Auth::user()->hasVerifiedUser()) { | ||
return redirect()->intended(route('verification-user.notice')); | ||
} | ||
} | ||
|
||
return $next($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace App\Infrastructure\Contracts\Auth; | ||
|
||
interface MustVerifyUser | ||
{ | ||
/** | ||
* Determine if the user has verified their account. | ||
* | ||
* @return bool | ||
*/ | ||
public function hasVerifiedUser(): bool; | ||
|
||
/** | ||
* Mark the given user's email as verified. | ||
* | ||
* @return bool | ||
*/ | ||
public function markUserAsVerified(): bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@extends('layouts.master') | ||
|
||
@section('title', __('Verify User')) | ||
|
||
@section('content') | ||
<section class="section"> | ||
<div class="container mt-5"> | ||
<div class="row"> | ||
<div class="col-12 col-sm-8 offset-sm-2 col-md-6 offset-md-3 col-lg-6 offset-lg-3 col-xl-4 offset-xl-4"> | ||
<div class="login-brand"> | ||
<img src="{{ asset('img/logo.png') }}" alt="logo" width="100" class="shadow-light rounded-circle"> | ||
</div> | ||
|
||
<div class="card card-primary"> | ||
<div class="card-header"> | ||
<h4>@lang('Verify User')</h4> | ||
</div> | ||
|
||
<div class="card-body"> | ||
<p class="text-muted"> | ||
@lang('Thanks for signing up! Our administrator will verify your email address before you can start using the application. If your account is still unverified, please contact the administrator.') | ||
</p> | ||
|
||
<form method="post"> | ||
@csrf | ||
|
||
<div class="form-group"> | ||
<button type="submit" formaction="{{ route('logout') }}" class="btn btn-danger btn-lg btn-block"> | ||
@lang('Logout') | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
|
||
@include('components.footer') | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.