From 55fcfa2e4a19e77a4887e88fa49d2bacd7e30aa6 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 13 Jun 2021 23:00:26 +1000 Subject: [PATCH] Enabled password resets --- .../Auth/ConfirmPasswordController.php | 40 ++++ .../Controllers/Auth/RegisterController.php | 2 +- app/Models/User.php | 2 +- resources/views/auth/login.blade.php | 63 ++----- .../views/auth/passwords/email.blade.php | 61 ++++++ .../views/auth/passwords/reset.blade.php | 89 +++++++++ resources/views/auth/register.blade.php | 178 ++++++++---------- resources/views/auth/verify.blade.php | 37 ++++ routes/web.php | 22 ++- 9 files changed, 335 insertions(+), 159 deletions(-) create mode 100644 app/Http/Controllers/Auth/ConfirmPasswordController.php create mode 100644 resources/views/auth/passwords/email.blade.php create mode 100644 resources/views/auth/passwords/reset.blade.php create mode 100644 resources/views/auth/verify.blade.php diff --git a/app/Http/Controllers/Auth/ConfirmPasswordController.php b/app/Http/Controllers/Auth/ConfirmPasswordController.php new file mode 100644 index 0000000..138c1f0 --- /dev/null +++ b/app/Http/Controllers/Auth/ConfirmPasswordController.php @@ -0,0 +1,40 @@ +middleware('auth'); + } +} diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index ed1a5e0..0c29c65 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -50,7 +50,7 @@ class RegisterController extends Controller protected function validator(array $data) { return Validator::make($data, [ - 'name' => ['required', 'string', 'max:255'], + 'name' => ['required', 'string', 'min:3', 'max:255'], 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 'password' => ['required', 'string', 'min:8', 'confirmed'], ]); diff --git a/app/Models/User.php b/app/Models/User.php index 804799b..a481d17 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; -class User extends Authenticatable +class User extends Authenticatable implements MustVerifyEmail { use HasFactory, Notifiable; diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index f98a6d6..8b48b6d 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -5,18 +5,6 @@ @endsection @section('content') - - - - - - - - - - - - @if(isset($login_note) AND $login_note)
@@ -32,39 +20,6 @@
@endisset - @if (Session::has('error')) -
-
- -
-
- @endif - - @if (count($errors) > 0) -
-
- -
-
- @endif -
@@ -78,10 +33,16 @@
- -
- Your email is required. -
+ + @error('email') + + {{ $message }} + + @else + + Your email is required. + + @enderror
@@ -92,9 +53,9 @@
-
+ Your password is required. -
+
diff --git a/resources/views/auth/passwords/email.blade.php b/resources/views/auth/passwords/email.blade.php new file mode 100644 index 0000000..7774da7 --- /dev/null +++ b/resources/views/auth/passwords/email.blade.php @@ -0,0 +1,61 @@ +@extends('layouts.auth') + +@section('htmlheader_title') + Forgot Password +@endsection + +@section('content') + @if (Session('status')) +
+
+ +
+
+ @endif + +
+
+
+

Forgot Password

+ +
+ @csrf + +
+
+ +
+ + + @error('email') + + {{ $message }} + + @else + + Your email is required. + + @enderror +
+
+
+ +
+
+ Cancel + +
+
+ +
+
+ Login +
+
+
+
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/auth/passwords/reset.blade.php b/resources/views/auth/passwords/reset.blade.php new file mode 100644 index 0000000..7ada010 --- /dev/null +++ b/resources/views/auth/passwords/reset.blade.php @@ -0,0 +1,89 @@ +@extends('layouts.auth') + +@section('htmlheader_title') + Reset Password +@endsection + +@section('content') + @if (Session('status')) +
+
+ +
+
+ @endif + +
+
+
+

Reset Password

+ +
+ @csrf + + +
+
+ +
+ + + @error('email') + + {{ $message }} + + @else + + Your email is required. + + @enderror +
+
+
+ +
+
+ +
+ + + @error('password') + + {{ $message }} + + @else + + Your password is required. + + @enderror +
+
+
+ +
+
+ +
+ + +
+ Please re-enter your password. +
+
+
+
+ +
+
+ Cancel + +
+
+
+ +
+
+
+@endsection diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 26105ba..ed9e4d9 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -5,112 +5,98 @@ @endsection @section('content') -
- +
+
+
+

Register

- @if (count($errors) > 0) -
- Whoops! {{ trans('message.someproblems') }}

-
    - @foreach ($errors->all() as $error) -
  • {{ $error }}
  • - @endforeach -
-
- @endif - - @if (Session::has('error')) -
- Whoops! {{ trans('message.someproblems') }}

-
    -
  • {{ Session::get('error') }}
  • -
-
- @endif - - -
-
-

Register

- -
+ {{ csrf_field() }}
-
- Name: -
- -
-
- -
-
-
- -
-
- Email: -
- -
-
- -
- -
-
-
-
- -
-
- Password: -
- -
-
- -
- -
-
-
-
- -
-
- Password Again: -
- -
-
- -
- -
-
-
-
- -
-
- - Cancel + +
+ + + @error('name') + + {{ $message }} + + @else + + Your name is required. + + @enderror +
+
+
+ +
+
+ +
+ + + @error('email') + + {{ $message }} + + @else + + Your email is required. + + @enderror +
+
+
+ +
+
+ +
+ + + @error('password') + + {{ $message }} + + @else +
+ Your password is required. +
+ @enderror +
+
+
+ +
+
+ +
+ + +
+ Please re-enter your password. +
+
+
+
+ +
+
+ Cancel +
-
-

- Login -

+
+
+ Login +
+
-
- @endsection \ No newline at end of file diff --git a/resources/views/auth/verify.blade.php b/resources/views/auth/verify.blade.php new file mode 100644 index 0000000..c817e37 --- /dev/null +++ b/resources/views/auth/verify.blade.php @@ -0,0 +1,37 @@ +@extends('layouts.auth') + +@section('htmlheader_title') + Verify your Email +@endsection + +@section('content') + @if (Session('resent')) +
+
+ +
+
+ @endif + +
+
+
+

Verify

+ +
+ @csrf + +
+
+ {{ __('Before proceeding, please check your email for a verification link.') }} + {{ __('If you did not receive the email') }}, + . +
+
+
+
+
+
+@endsection diff --git a/routes/web.php b/routes/web.php index 17bb59e..1999692 100644 --- a/routes/web.php +++ b/routes/web.php @@ -30,16 +30,18 @@ Route::get('logout',[LoginController::class,'logout']); Route::redirect('/','about'); Route::view('about','about'); -Route::get('ftn/domain',[DomainController::class,'home']); -Route::match(['get','post'],'ftn/domain/addedit/{o?}',[DomainController::class,'add_edit']) - ->where('o','[0-9]+'); +Route::middleware(['verified'])->group(function () { + Route::get('ftn/domain',[DomainController::class,'home']); + Route::match(['get','post'],'ftn/domain/addedit/{o?}',[DomainController::class,'add_edit']) + ->where('o','[0-9]+'); -Route::get('ftn/node',[NodeController::class,'home']); -Route::match(['get','post'],'ftn/node/addedit/{o?}',[NodeController::class,'add_edit']) - ->where('o','[0-9]+'); + Route::get('ftn/node',[NodeController::class,'home']); + Route::match(['get','post'],'ftn/node/addedit/{o?}',[NodeController::class,'add_edit']) + ->where('o','[0-9]+'); -Route::get('ftn/zone',[ZoneController::class,'home']); -Route::match(['get','post'],'ftn/zone/addedit/{o?}',[ZoneController::class,'add_edit']) - ->where('o','[0-9]+'); + Route::get('ftn/zone',[ZoneController::class,'home']); + Route::match(['get','post'],'ftn/zone/addedit/{o?}',[ZoneController::class,'add_edit']) + ->where('o','[0-9]+'); -Route::get('ftn/network/{name}',[HomeController::class,'network']); \ No newline at end of file + Route::get('ftn/network/{name}',[HomeController::class,'network']); +}); \ No newline at end of file