-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from sbine/laravel-11
Upgrade to Laravel 11
- Loading branch information
Showing
78 changed files
with
4,898 additions
and
5,463 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,6 @@ indent_size = 2 | |
|
||
[*.{js,vue}] | ||
indent_size = 2 | ||
|
||
[*.{css}] | ||
indent_size = 2 |
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
47 changes: 47 additions & 0 deletions
47
app/Http/Controllers/Auth/AuthenticatedSessionController.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,47 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Http\Requests\Auth\LoginRequest; | ||
use Illuminate\Http\RedirectResponse; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
use Illuminate\View\View; | ||
|
||
class AuthenticatedSessionController extends Controller | ||
{ | ||
/** | ||
* Display the login view. | ||
*/ | ||
public function create(): View | ||
{ | ||
return view('auth.login'); | ||
} | ||
|
||
/** | ||
* Handle an incoming authentication request. | ||
*/ | ||
public function store(LoginRequest $request): RedirectResponse | ||
{ | ||
$request->authenticate(); | ||
|
||
$request->session()->regenerate(); | ||
|
||
return redirect()->intended(route('dashboard', absolute: false)); | ||
} | ||
|
||
/** | ||
* Destroy an authenticated session. | ||
*/ | ||
public function destroy(Request $request): RedirectResponse | ||
{ | ||
Auth::guard('web')->logout(); | ||
|
||
$request->session()->invalidate(); | ||
|
||
$request->session()->regenerateToken(); | ||
|
||
return redirect('/'); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
app/Http/Controllers/Auth/ConfirmablePasswordController.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,40 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\RedirectResponse; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
use Illuminate\Validation\ValidationException; | ||
use Illuminate\View\View; | ||
|
||
class ConfirmablePasswordController extends Controller | ||
{ | ||
/** | ||
* Show the confirm password view. | ||
*/ | ||
public function show(): View | ||
{ | ||
return view('auth.confirm-password'); | ||
} | ||
|
||
/** | ||
* Confirm the user's password. | ||
*/ | ||
public function store(Request $request): RedirectResponse | ||
{ | ||
if (! Auth::guard('web')->validate([ | ||
'email' => $request->user()->email, | ||
'password' => $request->password, | ||
])) { | ||
throw ValidationException::withMessages([ | ||
'password' => __('auth.password'), | ||
]); | ||
} | ||
|
||
$request->session()->put('auth.password_confirmed_at', time()); | ||
|
||
return redirect()->intended(route('dashboard', absolute: false)); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
app/Http/Controllers/Auth/EmailVerificationNotificationController.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,24 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\RedirectResponse; | ||
use Illuminate\Http\Request; | ||
|
||
class EmailVerificationNotificationController extends Controller | ||
{ | ||
/** | ||
* Send a new email verification notification. | ||
*/ | ||
public function store(Request $request): RedirectResponse | ||
{ | ||
if ($request->user()->hasVerifiedEmail()) { | ||
return redirect()->intended(route('dashboard', absolute: false)); | ||
} | ||
|
||
$request->user()->sendEmailVerificationNotification(); | ||
|
||
return back()->with('status', 'verification-link-sent'); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
app/Http/Controllers/Auth/EmailVerificationPromptController.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,21 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\RedirectResponse; | ||
use Illuminate\Http\Request; | ||
use Illuminate\View\View; | ||
|
||
class EmailVerificationPromptController extends Controller | ||
{ | ||
/** | ||
* Display the email verification prompt. | ||
*/ | ||
public function __invoke(Request $request): RedirectResponse|View | ||
{ | ||
return $request->user()->hasVerifiedEmail() | ||
? redirect()->intended(route('dashboard', absolute: false)) | ||
: view('auth.verify-email'); | ||
} | ||
} |
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,61 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Auth\Events\PasswordReset; | ||
use Illuminate\Http\RedirectResponse; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Hash; | ||
use Illuminate\Support\Facades\Password; | ||
use Illuminate\Support\Str; | ||
use Illuminate\Validation\Rules; | ||
use Illuminate\View\View; | ||
|
||
class NewPasswordController extends Controller | ||
{ | ||
/** | ||
* Display the password reset view. | ||
*/ | ||
public function create(Request $request): View | ||
{ | ||
return view('auth.reset-password', ['request' => $request]); | ||
} | ||
|
||
/** | ||
* Handle an incoming new password request. | ||
* | ||
* @throws \Illuminate\Validation\ValidationException | ||
*/ | ||
public function store(Request $request): RedirectResponse | ||
{ | ||
$request->validate([ | ||
'token' => ['required'], | ||
'email' => ['required', 'email'], | ||
'password' => ['required', 'confirmed', Rules\Password::defaults()], | ||
]); | ||
|
||
// Here we will attempt to reset the user's password. If it is successful we | ||
// will update the password on an actual user model and persist it to the | ||
// database. Otherwise we will parse the error and return the response. | ||
$status = Password::reset( | ||
$request->only('email', 'password', 'password_confirmation', 'token'), | ||
function ($user) use ($request) { | ||
$user->forceFill([ | ||
'password' => Hash::make($request->password), | ||
'remember_token' => Str::random(60), | ||
])->save(); | ||
|
||
event(new PasswordReset($user)); | ||
} | ||
); | ||
|
||
// If the password was successfully reset, we will redirect the user back to | ||
// the application's home authenticated view. If there is an error we can | ||
// redirect them back to where they came from with their error message. | ||
return $status == Password::PASSWORD_RESET | ||
? redirect()->route('login')->with('status', __($status)) | ||
: back()->withInput($request->only('email')) | ||
->withErrors(['email' => __($status)]); | ||
} | ||
} |
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,29 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\RedirectResponse; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Hash; | ||
use Illuminate\Validation\Rules\Password; | ||
|
||
class PasswordController extends Controller | ||
{ | ||
/** | ||
* Update the user's password. | ||
*/ | ||
public function update(Request $request): RedirectResponse | ||
{ | ||
$validated = $request->validateWithBag('updatePassword', [ | ||
'current_password' => ['required', 'current_password'], | ||
'password' => ['required', Password::defaults(), 'confirmed'], | ||
]); | ||
|
||
$request->user()->update([ | ||
'password' => Hash::make($validated['password']), | ||
]); | ||
|
||
return back()->with('status', 'password-updated'); | ||
} | ||
} |
Oops, something went wrong.