|
19 | 19 | use Laravel\Fortify\Http\Controllers\TwoFactorQrCodeController;
|
20 | 20 | use Laravel\Fortify\Http\Controllers\TwoFactorSecretKeyController;
|
21 | 21 | use Laravel\Fortify\Http\Controllers\VerifyEmailController;
|
| 22 | +use Laravel\Fortify\RoutePath; |
22 | 23 |
|
23 | 24 | Route::group(['middleware' => config('fortify.middleware', ['web'])], function () {
|
24 | 25 | $enableViews = config('fortify.views', true);
|
25 | 26 |
|
26 | 27 | // Authentication...
|
27 | 28 | if ($enableViews) {
|
28 |
| - Route::get('/login', [AuthenticatedSessionController::class, 'create']) |
| 29 | + Route::get(RoutePath::for('login', '/login'), [AuthenticatedSessionController::class, 'create']) |
29 | 30 | ->middleware(['guest:'.config('fortify.guard')])
|
30 | 31 | ->name('login');
|
31 | 32 | }
|
|
34 | 35 | $twoFactorLimiter = config('fortify.limiters.two-factor');
|
35 | 36 | $verificationLimiter = config('fortify.limiters.verification', '6,1');
|
36 | 37 |
|
37 |
| - Route::post('/login', [AuthenticatedSessionController::class, 'store']) |
| 38 | + Route::post(RoutePath::for('login', '/login'), [AuthenticatedSessionController::class, 'store']) |
38 | 39 | ->middleware(array_filter([
|
39 | 40 | 'guest:'.config('fortify.guard'),
|
40 | 41 | $limiter ? 'throttle:'.$limiter : null,
|
41 | 42 | ]));
|
42 | 43 |
|
43 |
| - Route::post('/logout', [AuthenticatedSessionController::class, 'destroy']) |
| 44 | + Route::post(RoutePath::for('logout', '/logout'), [AuthenticatedSessionController::class, 'destroy']) |
44 | 45 | ->name('logout');
|
45 | 46 |
|
46 | 47 | // Password Reset...
|
47 | 48 | if (Features::enabled(Features::resetPasswords())) {
|
48 | 49 | if ($enableViews) {
|
49 |
| - Route::get('/forgot-password', [PasswordResetLinkController::class, 'create']) |
| 50 | + Route::get(RoutePath::for('password.request', '/forgot-password'), [PasswordResetLinkController::class, 'create']) |
50 | 51 | ->middleware(['guest:'.config('fortify.guard')])
|
51 | 52 | ->name('password.request');
|
52 | 53 |
|
53 |
| - Route::get('/reset-password/{token}', [NewPasswordController::class, 'create']) |
| 54 | + Route::get(RoutePath::for('password.reset', '/reset-password/{token}'), [NewPasswordController::class, 'create']) |
54 | 55 | ->middleware(['guest:'.config('fortify.guard')])
|
55 | 56 | ->name('password.reset');
|
56 | 57 | }
|
57 | 58 |
|
58 |
| - Route::post('/forgot-password', [PasswordResetLinkController::class, 'store']) |
| 59 | + Route::post(RoutePath::for('password.email', '/forgot-password'), [PasswordResetLinkController::class, 'store']) |
59 | 60 | ->middleware(['guest:'.config('fortify.guard')])
|
60 | 61 | ->name('password.email');
|
61 | 62 |
|
62 |
| - Route::post('/reset-password', [NewPasswordController::class, 'store']) |
| 63 | + Route::post(RoutePath::for('password.update', '/reset-password'), [NewPasswordController::class, 'store']) |
63 | 64 | ->middleware(['guest:'.config('fortify.guard')])
|
64 | 65 | ->name('password.update');
|
65 | 66 | }
|
66 | 67 |
|
67 | 68 | // Registration...
|
68 | 69 | if (Features::enabled(Features::registration())) {
|
69 | 70 | if ($enableViews) {
|
70 |
| - Route::get('/register', [RegisteredUserController::class, 'create']) |
| 71 | + Route::get(RoutePath::for('register', '/register'), [RegisteredUserController::class, 'create']) |
71 | 72 | ->middleware(['guest:'.config('fortify.guard')])
|
72 | 73 | ->name('register');
|
73 | 74 | }
|
74 | 75 |
|
75 |
| - Route::post('/register', [RegisteredUserController::class, 'store']) |
| 76 | + Route::post(RoutePath::for('register', '/register'), [RegisteredUserController::class, 'store']) |
76 | 77 | ->middleware(['guest:'.config('fortify.guard')]);
|
77 | 78 | }
|
78 | 79 |
|
79 | 80 | // Email Verification...
|
80 | 81 | if (Features::enabled(Features::emailVerification())) {
|
81 | 82 | if ($enableViews) {
|
82 |
| - Route::get('/email/verify', [EmailVerificationPromptController::class, '__invoke']) |
| 83 | + Route::get(RoutePath::for('verification.notice', '/email/verify'), [EmailVerificationPromptController::class, '__invoke']) |
83 | 84 | ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')])
|
84 | 85 | ->name('verification.notice');
|
85 | 86 | }
|
86 | 87 |
|
87 |
| - Route::get('/email/verify/{id}/{hash}', [VerifyEmailController::class, '__invoke']) |
| 88 | + Route::get(RoutePath::for('verification.verify', '/email/verify/{id}/{hash}'), [VerifyEmailController::class, '__invoke']) |
88 | 89 | ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard'), 'signed', 'throttle:'.$verificationLimiter])
|
89 | 90 | ->name('verification.verify');
|
90 | 91 |
|
91 |
| - Route::post('/email/verification-notification', [EmailVerificationNotificationController::class, 'store']) |
| 92 | + Route::post(RoutePath::for('verification.send', '/email/verification-notification'), [EmailVerificationNotificationController::class, 'store']) |
92 | 93 | ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard'), 'throttle:'.$verificationLimiter])
|
93 | 94 | ->name('verification.send');
|
94 | 95 | }
|
95 | 96 |
|
96 | 97 | // Profile Information...
|
97 | 98 | if (Features::enabled(Features::updateProfileInformation())) {
|
98 |
| - Route::put('/user/profile-information', [ProfileInformationController::class, 'update']) |
| 99 | + Route::put(RoutePath::for('user-profile-information.update', '/user/profile-information'), [ProfileInformationController::class, 'update']) |
99 | 100 | ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')])
|
100 | 101 | ->name('user-profile-information.update');
|
101 | 102 | }
|
102 | 103 |
|
103 | 104 | // Passwords...
|
104 | 105 | if (Features::enabled(Features::updatePasswords())) {
|
105 |
| - Route::put('/user/password', [PasswordController::class, 'update']) |
| 106 | + Route::put(RoutePath::for('user-password.update', '/user/password'), [PasswordController::class, 'update']) |
106 | 107 | ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')])
|
107 | 108 | ->name('user-password.update');
|
108 | 109 | }
|
109 | 110 |
|
110 | 111 | // Password Confirmation...
|
111 | 112 | if ($enableViews) {
|
112 |
| - Route::get('/user/confirm-password', [ConfirmablePasswordController::class, 'show']) |
| 113 | + Route::get(RoutePath::for('password.confirm', '/user/confirm-password'), [ConfirmablePasswordController::class, 'show']) |
113 | 114 | ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')]);
|
114 | 115 | }
|
115 | 116 |
|
116 |
| - Route::get('/user/confirmed-password-status', [ConfirmedPasswordStatusController::class, 'show']) |
| 117 | + Route::get(RoutePath::for('password.confirmation', '/user/confirmed-password-status'), [ConfirmedPasswordStatusController::class, 'show']) |
117 | 118 | ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')])
|
118 | 119 | ->name('password.confirmation');
|
119 | 120 |
|
120 |
| - Route::post('/user/confirm-password', [ConfirmablePasswordController::class, 'store']) |
| 121 | + Route::post(RoutePath::for('password.confirm', '/user/confirm-password'), [ConfirmablePasswordController::class, 'store']) |
121 | 122 | ->middleware([config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')])
|
122 | 123 | ->name('password.confirm');
|
123 | 124 |
|
124 | 125 | // Two Factor Authentication...
|
125 | 126 | if (Features::enabled(Features::twoFactorAuthentication())) {
|
126 | 127 | if ($enableViews) {
|
127 |
| - Route::get('/two-factor-challenge', [TwoFactorAuthenticatedSessionController::class, 'create']) |
| 128 | + Route::get(RoutePath::for('two-factor.login', '/two-factor-challenge'), [TwoFactorAuthenticatedSessionController::class, 'create']) |
128 | 129 | ->middleware(['guest:'.config('fortify.guard')])
|
129 | 130 | ->name('two-factor.login');
|
130 | 131 | }
|
131 | 132 |
|
132 |
| - Route::post('/two-factor-challenge', [TwoFactorAuthenticatedSessionController::class, 'store']) |
| 133 | + Route::post(RoutePath::for('two-factor.login', '/two-factor-challenge'), [TwoFactorAuthenticatedSessionController::class, 'store']) |
133 | 134 | ->middleware(array_filter([
|
134 | 135 | 'guest:'.config('fortify.guard'),
|
135 | 136 | $twoFactorLimiter ? 'throttle:'.$twoFactorLimiter : null,
|
|
139 | 140 | ? [config('fortify.auth_middleware', 'auth').':'.config('fortify.guard'), 'password.confirm']
|
140 | 141 | : [config('fortify.auth_middleware', 'auth').':'.config('fortify.guard')];
|
141 | 142 |
|
142 |
| - Route::post('/user/two-factor-authentication', [TwoFactorAuthenticationController::class, 'store']) |
| 143 | + Route::post(RoutePath::for('two-factor.enable', '/user/two-factor-authentication'), [TwoFactorAuthenticationController::class, 'store']) |
143 | 144 | ->middleware($twoFactorMiddleware)
|
144 | 145 | ->name('two-factor.enable');
|
145 | 146 |
|
146 |
| - Route::post('/user/confirmed-two-factor-authentication', [ConfirmedTwoFactorAuthenticationController::class, 'store']) |
| 147 | + Route::post(RoutePath::for('two-factor.confirm', '/user/confirmed-two-factor-authentication'), [ConfirmedTwoFactorAuthenticationController::class, 'store']) |
147 | 148 | ->middleware($twoFactorMiddleware)
|
148 | 149 | ->name('two-factor.confirm');
|
149 | 150 |
|
150 |
| - Route::delete('/user/two-factor-authentication', [TwoFactorAuthenticationController::class, 'destroy']) |
| 151 | + Route::delete(RoutePath::for('two-factor.disable', '/user/two-factor-authentication'), [TwoFactorAuthenticationController::class, 'destroy']) |
151 | 152 | ->middleware($twoFactorMiddleware)
|
152 | 153 | ->name('two-factor.disable');
|
153 | 154 |
|
154 |
| - Route::get('/user/two-factor-qr-code', [TwoFactorQrCodeController::class, 'show']) |
| 155 | + Route::get(RoutePath::for('two-factor.qr-code', '/user/two-factor-qr-code'), [TwoFactorQrCodeController::class, 'show']) |
155 | 156 | ->middleware($twoFactorMiddleware)
|
156 | 157 | ->name('two-factor.qr-code');
|
157 | 158 |
|
158 |
| - Route::get('/user/two-factor-secret-key', [TwoFactorSecretKeyController::class, 'show']) |
| 159 | + Route::get(RoutePath::for('two-factor.secret-key', '/user/two-factor-secret-key'), [TwoFactorSecretKeyController::class, 'show']) |
159 | 160 | ->middleware($twoFactorMiddleware)
|
160 | 161 | ->name('two-factor.secret-key');
|
161 | 162 |
|
162 |
| - Route::get('/user/two-factor-recovery-codes', [RecoveryCodeController::class, 'index']) |
| 163 | + Route::get(RoutePath::for('two-factor.recovery-codes', '/user/two-factor-recovery-codes'), [RecoveryCodeController::class, 'index']) |
163 | 164 | ->middleware($twoFactorMiddleware)
|
164 | 165 | ->name('two-factor.recovery-codes');
|
165 | 166 |
|
166 |
| - Route::post('/user/two-factor-recovery-codes', [RecoveryCodeController::class, 'store']) |
| 167 | + Route::post(RoutePath::for('two-factor.recovery-codes', '/user/two-factor-recovery-codes'), [RecoveryCodeController::class, 'store']) |
167 | 168 | ->middleware($twoFactorMiddleware);
|
168 | 169 | }
|
169 | 170 | });
|
0 commit comments