Skip to content

Commit b164c3e

Browse files
Merge pull request #189 from laravel/replace_email_verification_with_fortify
Replace email verification with fortify
2 parents f16a6f7 + 247d03a commit b164c3e

File tree

7 files changed

+9
-95
lines changed

7 files changed

+9
-95
lines changed

app/Http/Controllers/Auth/EmailVerificationNotificationController.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

app/Http/Controllers/Auth/EmailVerificationPromptController.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

app/Http/Controllers/Auth/VerifyEmailController.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

app/Providers/FortifyServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ private function configureViews(): void
4040
'status' => $request->session()->get('status'),
4141
]));
4242

43+
Fortify::verifyEmailView(fn (Request $request) => Inertia::render('auth/verify-email', [
44+
'status' => $request->session()->get('status'),
45+
]));
46+
4347
Fortify::twoFactorChallengeView(fn () => Inertia::render('auth/two-factor-challenge'));
4448

4549
Fortify::confirmPasswordView(fn () => Inertia::render('auth/confirm-password'));

config/fortify.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
'features' => [
147147
// Features::registration(),
148148
// Features::resetPasswords(),
149-
// Features::emailVerification(),
149+
Features::emailVerification(),
150150
// Features::updateProfileInformation(),
151151
// Features::updatePasswords(),
152152
Features::twoFactorAuthentication([

resources/js/pages/auth/verify-email.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
// Components
2-
import EmailVerificationNotificationController from '@/actions/App/Http/Controllers/Auth/EmailVerificationNotificationController';
3-
import { logout } from '@/routes';
4-
import { Form, Head } from '@inertiajs/react';
5-
62
import TextLink from '@/components/text-link';
73
import { Button } from '@/components/ui/button';
84
import { Spinner } from '@/components/ui/spinner';
95
import AuthLayout from '@/layouts/auth-layout';
6+
import { logout } from '@/routes';
7+
import { send } from '@/routes/verification';
8+
import { Form, Head } from '@inertiajs/react';
109

1110
export default function VerifyEmail({ status }: { status?: string }) {
1211
return (
@@ -23,10 +22,7 @@ export default function VerifyEmail({ status }: { status?: string }) {
2322
</div>
2423
)}
2524

26-
<Form
27-
{...EmailVerificationNotificationController.store.form()}
28-
className="space-y-6 text-center"
29-
>
25+
<Form {...send.form()} className="space-y-6 text-center">
3026
{({ processing }) => (
3127
<>
3228
<Button disabled={processing} variant="secondary">

routes/auth.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
<?php
22

3-
use App\Http\Controllers\Auth\EmailVerificationNotificationController;
4-
use App\Http\Controllers\Auth\EmailVerificationPromptController;
53
use App\Http\Controllers\Auth\NewPasswordController;
64
use App\Http\Controllers\Auth\PasswordResetLinkController;
75
use App\Http\Controllers\Auth\RegisteredUserController;
8-
use App\Http\Controllers\Auth\VerifyEmailController;
96
use Illuminate\Support\Facades\Route;
107

118
Route::middleware('guest')->group(function () {
@@ -27,16 +24,3 @@
2724
Route::post('reset-password', [NewPasswordController::class, 'store'])
2825
->name('password.store');
2926
});
30-
31-
Route::middleware('auth')->group(function () {
32-
Route::get('verify-email', EmailVerificationPromptController::class)
33-
->name('verification.notice');
34-
35-
Route::get('verify-email/{id}/{hash}', VerifyEmailController::class)
36-
->middleware(['signed', 'throttle:6,1'])
37-
->name('verification.verify');
38-
39-
Route::post('email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
40-
->middleware('throttle:6,1')
41-
->name('verification.send');
42-
});

0 commit comments

Comments
 (0)