Fix auth controllers for laravel 11
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 30s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m31s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s

This commit is contained in:
Deon George 2024-11-06 18:43:35 +11:00
parent c2197ecf7c
commit 1075cc0de4
9 changed files with 46 additions and 59 deletions

View File

@ -2,10 +2,9 @@
namespace App\Http\Controllers\Auth; namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ConfirmsPasswords; use Illuminate\Foundation\Auth\ConfirmsPasswords;
use App\Http\Controllers\Controller;
class ConfirmPasswordController extends Controller class ConfirmPasswordController extends Controller
{ {
/* /*
@ -26,7 +25,7 @@ class ConfirmPasswordController extends Controller
* *
* @var string * @var string
*/ */
protected $redirectTo = RouteServiceProvider::HOME; protected $redirectTo = '/';
/** /**
* Create a new controller instance. * Create a new controller instance.

View File

@ -2,11 +2,12 @@
namespace App\Http\Controllers\Auth; namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails; use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password; use Illuminate\Support\Facades\Password;
use App\Http\Controllers\Controller;
class ForgotPasswordController extends Controller class ForgotPasswordController extends Controller
{ {
/* /*

View File

@ -8,7 +8,6 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
class LoginController extends Controller class LoginController extends Controller
{ {
@ -30,7 +29,7 @@ class LoginController extends Controller
* *
* @var string * @var string
*/ */
protected $redirectTo = RouteServiceProvider::HOME; protected $redirectTo = '/';
/** /**
* Create a new controller instance. * Create a new controller instance.
@ -39,8 +38,8 @@ class LoginController extends Controller
*/ */
public function __construct() public function __construct()
{ {
$this->middleware('guest') $this->middleware('guest')->except('logout');
->except('logout'); $this->middleware('auth')->only('logout');
} }
public function login(Request $request) public function login(Request $request)
@ -56,6 +55,7 @@ class LoginController extends Controller
return $this->sendFailedLoginResponse($request); return $this->sendFailedLoginResponse($request);
} }
// Record our last logged in time
protected function authenticated(Request $request, $user) protected function authenticated(Request $request, $user)
{ {
$user->last_on = Carbon::now(); $user->last_on = Carbon::now();

View File

@ -7,7 +7,6 @@ use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use App\Models\User; use App\Models\User;
class RegisterController extends Controller class RegisterController extends Controller
@ -30,7 +29,7 @@ class RegisterController extends Controller
* *
* @var string * @var string
*/ */
protected $redirectTo = RouteServiceProvider::HOME; protected $redirectTo = '/';
/** /**
* Create a new controller instance. * Create a new controller instance.

View File

@ -2,10 +2,10 @@
namespace App\Http\Controllers\Auth; namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\ResetsPasswords; use Illuminate\Foundation\Auth\ResetsPasswords;
use App\Http\Controllers\Controller;
class ResetPasswordController extends Controller class ResetPasswordController extends Controller
{ {
/* /*
@ -26,15 +26,5 @@ class ResetPasswordController extends Controller
* *
* @var string * @var string
*/ */
protected $redirectTo = RouteServiceProvider::HOME; protected $redirectTo = '/';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
} }

View File

@ -2,10 +2,10 @@
namespace App\Http\Controllers\Auth; namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\VerifiesEmails; use Illuminate\Foundation\Auth\VerifiesEmails;
use App\Http\Controllers\Controller;
class VerificationController extends Controller class VerificationController extends Controller
{ {
/* /*
@ -26,7 +26,7 @@ class VerificationController extends Controller
* *
* @var string * @var string
*/ */
protected $redirectTo = RouteServiceProvider::HOME; protected $redirectTo = '/';
/** /**
* Create a new controller instance. * Create a new controller instance.

View File

@ -2,12 +2,10 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
class Controller extends BaseController abstract class Controller extends \Illuminate\Routing\Controller
{ {
use AuthorizesRequests, DispatchesJobs, ValidatesRequests; use AuthorizesRequests,ValidatesRequests;
} }

View File

@ -5,7 +5,7 @@
@endsection @endsection
@section('content') @section('content')
@includeWhen(session()->has('success'),'widgets.success-row',['msg'=>session()->get('success')]) @includeWhen(session()->has('status'),'widgets.success-row',['msg'=>session()->pull('status')])
<form class="needs-validation" method="post" action="{{ route('password.email') }}" novalidate> <form class="needs-validation" method="post" action="{{ route('password.email') }}" novalidate>
@csrf @csrf

View File

@ -5,7 +5,7 @@
@endsection @endsection
@section('content') @section('content')
@includeWhen(session()->has('status') || true,'widgets.success-row',['msg'=>session()->get('status')]) @includeWhen(session()->has('status'),'widgets.success-row',['msg'=>session()->pull('status')])
<form class="needs-validation" method="post" action="{{ route('password.update') }}" novalidate> <form class="needs-validation" method="post" action="{{ route('password.update') }}" novalidate>
@csrf @csrf