Authentication
Intro
Every portal needs authentication.
This package provides some livewire components to add the features of: login, registration, email verification and logout.
More will need to be added later.
See generic doc for using livewire components
Components
Routing
This snippet is copied from the routes/portal.php, and might not be up to date with the latest version.
php
// GUEST ONLY
Route::group(['middleware' => array_filter([
'qore-portal-guest',
])],
function (): void {
Route::get('/', fn () => view('application.portal.pages.home'))->name('home');
Route::get('/login', LoginCard::class)->name('login');
Route::get('/register', RegisterCard::class)->name('register');
Route::get('/welcome/{user}', WelcomeCard::class)->middleware(WelcomesNewUser::class)->name('welcome');
});
// LOGGED IN
Route::group(['middleware' => array_filter([
'qore-portal-auth',
])],
function (): void {
Route::get('/email/verify', VerifyEmailCard::class)->name('verification.notice');
Route::get('/email/verified', VerifiedEmailCard::class)->name('verification.verified');
Route::get('/email/verify/{id}/{hash}', EmailVerificationVerify::class)
->middleware(['signed', 'throttle:6,1'])
->name('verification.verify');
Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])->name('logout');
});Login
Will show the forgot password button if the password.request route is available. This behaviour can be altered by changing the login-card view.
php
use QoreWorksBusiness\QoreFrontend\Integrations\Portal\Livewire\auth\LoginCardRegistration
php
use QoreWorksBusiness\QoreFrontend\Integrations\Portal\Livewire\auth\RegisterCardEmail Verification
php
use QoreWorksBusiness\QoreFrontend\Integrations\Portal\Livewire\auth\VerifyEmailCard;
use QoreWorksBusiness\QoreFrontend\Integrations\Portal\Livewire\auth\VerifiedEmailCard;Welcome set password
php
use QoreWorksBusiness\QoreFrontend\Integrations\Portal\Livewire\auth\WelcomeCardForgot password + reset
php
use QoreWorksBusiness\QoreFrontend\Integrations\Portal\Livewire\auth\ForgotPasswordCardConfiguration
| Key | Type | Default | Description |
|---|---|---|---|
| features.registration | bool | true | Enable registration feature |
| feature_config.registration.email_verification_route | string | application.portal.verification.notice | Route name for email verification page. Used in a redirect after registration. |
| feature_config.registration.registration_response_route | string | application.portal.dashboard | Route name for dashboard page. Used in a redirect after registration |
| features.login.redirect_if_authenticated_route | string | application.portal.dashboard | Route for redirect if authenticated on guest route. |
| features.login.logout_route | string | application.portal.home | Route for redirect after logout. |