Comments (3)
How Fortify::ignoreRoutes() works. I placed Fortify::ignoreRoutes() in the boot method of FortifyServiceProvider but it still showing the default auth routes when I hit php artisan route:list -c.
Why boot? Must be in register.
from fortify.
You can disable the routes via Fortify::ignoreRoutes() and then copy the routes into a file in your own application.
from fortify.
How Fortify::ignoreRoutes() works. I placed Fortify::ignoreRoutes() in the boot method of FortifyServiceProvider but it still showing the default auth routes when I hit php artisan route:list -c.
| POST | login | Laravel\Fortify\Http\Controllers\AuthenticatedSessionController@store |
| GET|HEAD | login | Laravel\Fortify\Http\Controllers\AuthenticatedSessionController@create |
| POST | logout | Laravel\Fortify\Http\Controllers\AuthenticatedSessionController@destroy |
| POST | register | Laravel\Fortify\Http\Controllers\RegisteredUserController@store |
| GET|HEAD | register | Laravel\Fortify\Http\Controllers\RegisteredUserController@create |
| POST | reset-password | Laravel\Fortify\Http\Controllers\NewPasswordController@store |
| GET|HEAD | reset-password/{token} | Laravel\Fortify\Http\Controllers\NewPasswordController@create |
| GET|HEAD | two-factor-challenge | Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController@create |
| POST | two-factor-challenge | Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController@store |
| GET|HEAD | user/confirm-password | Laravel\Fortify\Http\Controllers\ConfirmablePasswordController@show |
| POST | user/confirm-password | Laravel\Fortify\Http\Controllers\ConfirmablePasswordController@store |
| GET|HEAD | user/confirmed-password-status | Laravel\Fortify\Http\Controllers\ConfirmedPasswordStatusController@show |
| PUT | user/password | Laravel\Fortify\Http\Controllers\PasswordController@update |
| PUT | user/profile-information | Laravel\Fortify\Http\Controllers\ProfileInformationController@update |
| DELETE | user/two-factor-authentication | Laravel\Fortify\Http\Controllers\TwoFactorAuthenticationController@destroy |
| POST | user/two-factor-authentication | Laravel\Fortify\Http\Controllers\TwoFactorAuthenticationController@store |
| GET|HEAD | user/two-factor-qr-code | Laravel\Fortify\Http\Controllers\TwoFactorQrCodeController@show |
| POST | user/two-factor-recovery-codes | Laravel\Fortify\Http\Controllers\RecoveryCodeController@store |
| GET|HEAD | user/two-factor-recovery-codes | Laravel\Fortify\Http\Controllers\RecoveryCodeController@index
I want to create a multi auth for frontend and backend. so for frontend, i used default fortify routes and for backend i used routes/admin.php just copying the fortify routes and modify the prefix and name like this. Is this a good way?
<?php
use Illuminate\Support\Facades\Route;
use Laravel\Fortify\Features;
use Laravel\Fortify\Http\Controllers\AuthenticatedSessionController;
use Laravel\Fortify\Http\Controllers\ConfirmablePasswordController;
use Laravel\Fortify\Http\Controllers\ConfirmedPasswordStatusController;
use Laravel\Fortify\Http\Controllers\EmailVerificationNotificationController;
use Laravel\Fortify\Http\Controllers\EmailVerificationPromptController;
use Laravel\Fortify\Http\Controllers\NewPasswordController;
use Laravel\Fortify\Http\Controllers\PasswordController;
use Laravel\Fortify\Http\Controllers\PasswordResetLinkController;
use Laravel\Fortify\Http\Controllers\ProfileInformationController;
use Laravel\Fortify\Http\Controllers\RecoveryCodeController;
use Laravel\Fortify\Http\Controllers\RegisteredUserController;
use Laravel\Fortify\Http\Controllers\TwoFactorAuthenticatedSessionController;
use Laravel\Fortify\Http\Controllers\TwoFactorAuthenticationController;
use Laravel\Fortify\Http\Controllers\TwoFactorQrCodeController;
use Laravel\Fortify\Http\Controllers\VerifyEmailController;
Route::group(['middleware' => config('fortify.middleware', ['web']), 'prefix' => 'admin', 'as' => 'admin.'], function () {
// Authentication...
Route::get('/login', function () {
return view('auth.login');
})->name('login');
$limiter = config('fortify.limiters.login');
Route::post('/login', [AuthenticatedSessionController::class, 'store'])
->middleware(array_filter([
'guest',
$limiter ? 'throttle:'.$limiter : null,
]));
Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])
->name('logout');
// Password Reset...
if (Features::enabled(Features::resetPasswords())) {
Route::get('/forgot-password', [PasswordResetLinkController::class, 'create'])
->middleware(['guest'])
->name('password.request');
Route::post('/forgot-password', [PasswordResetLinkController::class, 'store'])
->middleware(['guest'])
->name('password.email');
Route::get('/reset-password/{token}', [NewPasswordController::class, 'create'])
->middleware(['guest'])
->name('password.reset');
Route::post('/reset-password', [NewPasswordController::class, 'store'])
->middleware(['guest'])
->name('password.update');
}
// Registration...
if (Features::enabled(Features::registration())) {
Route::get('/register', [RegisteredUserController::class, 'create'])
->middleware(['guest'])
->name('register');
Route::post('/register', [RegisteredUserController::class, 'store'])
->middleware(['guest']);
}
// Email Verification...
if (Features::enabled(Features::emailVerification())) {
Route::get('/email/verify', [EmailVerificationPromptController::class, '__invoke'])
->middleware(['auth'])
->name('verification.notice');
Route::get('/email/verify/{id}/{hash}', [VerifyEmailController::class, '__invoke'])
->middleware(['auth', 'signed', 'throttle:6,1'])
->name('verification.verify');
Route::post('/email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
->middleware(['auth', 'throttle:6,1'])
->name('verification.send');
}
// Profile Information...
if (Features::enabled(Features::updateProfileInformation())) {
Route::put('/user/profile-information', [ProfileInformationController::class, 'update'])
->middleware(['auth']);
}
// Passwords...
if (Features::enabled(Features::updatePasswords())) {
Route::put('/user/password', [PasswordController::class, 'update'])
->middleware(['auth']);
}
// Password Confirmation...
Route::get('/user/confirm-password', [ConfirmablePasswordController::class, 'show'])
->middleware(['auth'])
->name('password.confirm');
Route::post('/user/confirm-password', [ConfirmablePasswordController::class, 'store'])
->middleware(['auth']);
Route::get('/user/confirmed-password-status', [ConfirmedPasswordStatusController::class, 'show'])
->middleware(['auth'])
->name('password.confirmation');
// Two Factor Authentication...
if (Features::enabled(Features::twoFactorAuthentication())) {
Route::get('/two-factor-challenge', [TwoFactorAuthenticatedSessionController::class, 'create'])
->middleware(['guest'])
->name('two-factor.login');
Route::post('/two-factor-challenge', [TwoFactorAuthenticatedSessionController::class, 'store'])
->middleware(['guest']);
$twoFactorMiddleware = Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')
? ['auth', 'password.confirm']
: ['auth'];
Route::post('/user/two-factor-authentication', [TwoFactorAuthenticationController::class, 'store'])
->middleware($twoFactorMiddleware);
Route::delete('/user/two-factor-authentication', [TwoFactorAuthenticationController::class, 'destroy'])
->middleware($twoFactorMiddleware);
Route::get('/user/two-factor-qr-code', [TwoFactorQrCodeController::class, 'show'])
->middleware($twoFactorMiddleware);
Route::get('/user/two-factor-recovery-codes', [RecoveryCodeController::class, 'index'])
->middleware($twoFactorMiddleware);
Route::post('/user/two-factor-recovery-codes', [RecoveryCodeController::class, 'store'])
->middleware($twoFactorMiddleware);
}
});
from fortify.
Related Issues (20)
- When Session based Guard is not used Logout fails HOT 3
- Integrate Precognition Into Fortify Route HOT 1
- Route [logout] not defined after changing the app_env from local to production
- Without override the PasswordResetLinkController@store we cannot add reCAPTCHA HOT 1
- Name all routes for Ziggy support when enableViews is false HOT 2
- Paths override with dot in route name does not work HOT 3
- Fortify http request methods for routes requiring multipart/form-data HOT 1
- Support for laravel passport HOT 2
- Provide "Don't ask me again on this computer" feature HOT 3
- Implementation for ActivityLogs HOT 1
- Custom Rate Limiter HOT 1
- Confusion between the username/email field in the database and the username/email field in the request (form) HOT 4
- No error message on expired token HOT 4
- Can we get a way to add additional validation rules to LoginRequest?
- A proposal for Fortify 2.0 HOT 4
- Used password reset link still valid to change password again HOT 1
- RegisterViewResponse is not instantiable. HOT 3
- How to disable setting up Google Authenticator for a certain user HOT 1
- void
- authenticateUsing called twice HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fortify.