Revert "Disabled request lifecycle middleware on public routes"
This reverts commit 658617c8bb
.
This commit is contained in:
parent
4588ef9768
commit
c5970309b4
|
@ -29,15 +29,13 @@ class Kernel extends HttpKernel
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $middlewareGroups = [
|
protected $middlewareGroups = [
|
||||||
'AuthSession' => [
|
'web' => [
|
||||||
\App\Http\Middleware\EncryptCookies::class,
|
\App\Http\Middleware\EncryptCookies::class,
|
||||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||||
\Illuminate\Session\Middleware\StartSession::class,
|
\Illuminate\Session\Middleware\StartSession::class,
|
||||||
|
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
],
|
|
||||||
|
|
||||||
'web' => [
|
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -45,7 +43,6 @@ class Kernel extends HttpKernel
|
||||||
'throttle:api',
|
'throttle:api',
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,30 +8,27 @@ use App\Http\Controllers\Auth\NewPasswordController;
|
||||||
use App\Http\Controllers\Auth\PasswordResetLinkController;
|
use App\Http\Controllers\Auth\PasswordResetLinkController;
|
||||||
use App\Http\Controllers\Auth\RegisteredUserController;
|
use App\Http\Controllers\Auth\RegisteredUserController;
|
||||||
use App\Http\Controllers\Auth\VerifyEmailController;
|
use App\Http\Controllers\Auth\VerifyEmailController;
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
if (config('advanced-config.register_url') != '') {
|
if(config('advanced-config.register_url') != '') {
|
||||||
$register = config('advanced-config.register_url');
|
$register = config('advanced-config.register_url');
|
||||||
} else {
|
} else {
|
||||||
$register = "/register";
|
$register = "/register";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config('advanced-config.login_url') != '') {
|
if(config('advanced-config.login_url') != '') {
|
||||||
$login = config('advanced-config.login_url');
|
$login = config('advanced-config.login_url');
|
||||||
} else {
|
} else {
|
||||||
$login = "/login";
|
$login = "/login";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config('advanced-config.forgot_password_url') != '') {
|
if(config('advanced-config.forgot_password_url') != '') {
|
||||||
$forgot_password = config('advanced-config.forgot_password_url');
|
$forgot_password = config('advanced-config.forgot_password_url');
|
||||||
} else {
|
} else {
|
||||||
$forgot_password = "/forgot-password";
|
$forgot_password = "/forgot-password";
|
||||||
}
|
}
|
||||||
|
|
||||||
Route::middleware(['web', 'AuthSession'])->group(function () use ($register, $login, $forgot_password) {
|
if(env('ALLOW_REGISTRATION') or $register !== '/register') {
|
||||||
|
|
||||||
if (env('ALLOW_REGISTRATION') || $register !== '/register') {
|
|
||||||
Route::get($register, [RegisteredUserController::class, 'create'])
|
Route::get($register, [RegisteredUserController::class, 'create'])
|
||||||
->middleware('guest')
|
->middleware('guest')
|
||||||
->middleware('max.users')
|
->middleware('max.users')
|
||||||
|
@ -50,58 +47,58 @@ Route::middleware(['web', 'AuthSession'])->group(function () use ($register, $lo
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Route::get($login, [AuthenticatedSessionController::class, 'create'])
|
Route::get($login, [AuthenticatedSessionController::class, 'create'])
|
||||||
->middleware('guest')
|
->middleware('guest')
|
||||||
->name('login');
|
->name('login');
|
||||||
|
|
||||||
Route::post($login, [AuthenticatedSessionController::class, 'store'])
|
Route::post($login, [AuthenticatedSessionController::class, 'store'])
|
||||||
->middleware('guest');
|
->middleware('guest');
|
||||||
|
|
||||||
Route::get($forgot_password, [PasswordResetLinkController::class, 'create'])
|
Route::get( $forgot_password, [PasswordResetLinkController::class, 'create'])
|
||||||
->middleware('guest')
|
->middleware('guest')
|
||||||
->name('password.request');
|
->name('password.request');
|
||||||
|
|
||||||
Route::post($forgot_password, [PasswordResetLinkController::class, 'store'])
|
Route::post( $forgot_password, [PasswordResetLinkController::class, 'store'])
|
||||||
->middleware('guest')
|
->middleware('guest')
|
||||||
->name('password.email');
|
->name('password.email');
|
||||||
|
|
||||||
Route::get('/reset-password/{token}', [NewPasswordController::class, 'create'])
|
Route::get('/reset-password/{token}', [NewPasswordController::class, 'create'])
|
||||||
->middleware('guest')
|
->middleware('guest')
|
||||||
->name('password.reset');
|
->name('password.reset');
|
||||||
|
|
||||||
Route::post('/reset-password', [NewPasswordController::class, 'store'])
|
Route::post('/reset-password', [NewPasswordController::class, 'store'])
|
||||||
->middleware('guest')
|
->middleware('guest')
|
||||||
->name('password.update');
|
->name('password.update');
|
||||||
|
|
||||||
Route::get('/verify-email', [EmailVerificationPromptController::class, '__invoke'])
|
Route::get('/verify-email', [EmailVerificationPromptController::class, '__invoke'])
|
||||||
->middleware('auth')
|
->middleware('auth')
|
||||||
->name('verification.notice');
|
->name('verification.notice');
|
||||||
|
|
||||||
Route::get('/verify-email/{id}/{hash}', [VerifyEmailController::class, '__invoke'])
|
Route::get('/verify-email/{id}/{hash}', [VerifyEmailController::class, '__invoke'])
|
||||||
->middleware(['auth', 'signed', 'throttle:6,1'])
|
->middleware(['auth', 'signed', 'throttle:6,1'])
|
||||||
->name('verification.verify');
|
->name('verification.verify');
|
||||||
|
|
||||||
Route::post('/email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
|
Route::post('/email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
|
||||||
->middleware(['auth', 'throttle:6,1'])
|
->middleware(['auth', 'throttle:6,1'])
|
||||||
->name('verification.send');
|
->name('verification.send');
|
||||||
|
|
||||||
Route::get('/confirm-password', [ConfirmablePasswordController::class, 'show'])
|
Route::get('/confirm-password', [ConfirmablePasswordController::class, 'show'])
|
||||||
->middleware('auth')
|
->middleware('auth')
|
||||||
->name('password.confirm');
|
->name('password.confirm');
|
||||||
|
|
||||||
Route::post('/confirm-password', [ConfirmablePasswordController::class, 'store'])
|
Route::post('/confirm-password', [ConfirmablePasswordController::class, 'store'])
|
||||||
->middleware('auth');
|
->middleware('auth');
|
||||||
|
|
||||||
Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])
|
Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])
|
||||||
->middleware('auth')
|
->middleware('auth')
|
||||||
->name('logout');
|
->name('logout');
|
||||||
|
|
||||||
Route::get('/blocked', function () {
|
Route::get('/blocked', function () {
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
if ($user && $user->block == 'yes') {
|
if ($user && $user->block == 'yes') {
|
||||||
return view('auth.blocked');
|
return view('auth.blocked');
|
||||||
} else {
|
} else {
|
||||||
return redirect(url('dashboard'));
|
return redirect(url('dashboard'));
|
||||||
}
|
}
|
||||||
})->name('blocked');
|
})->name('blocked');
|
||||||
});
|
|
|
@ -96,7 +96,7 @@ Route::get('/vcard/{id?}', [UserController::class, 'vcard'])->name('vcard');
|
||||||
|
|
||||||
Route::get('/demo-page', [App\Http\Controllers\HomeController::class, 'demo'])->name('demo');
|
Route::get('/demo-page', [App\Http\Controllers\HomeController::class, 'demo'])->name('demo');
|
||||||
|
|
||||||
Route::middleware(['AuthSession', 'auth', 'blocked', 'impersonate'])->group(function () {
|
Route::middleware(['auth', 'blocked', 'impersonate'])->group(function () {
|
||||||
//User route
|
//User route
|
||||||
Route::group([
|
Route::group([
|
||||||
'middleware' => env('REGISTER_AUTH'),
|
'middleware' => env('REGISTER_AUTH'),
|
||||||
|
@ -141,10 +141,11 @@ Route::get('/studio/linkparamform_part/{typeid}/{linkid}', [LinkTypeViewControll
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Route::middleware(['AuthSession', 'auth', 'blocked', 'impersonate'])->group(function () {
|
|
||||||
//Social login route
|
//Social login route
|
||||||
Route::get('/social-auth/{provider}/callback', [SocialLoginController::class, 'providerCallback']);
|
Route::get('/social-auth/{provider}/callback', [SocialLoginController::class, 'providerCallback']);
|
||||||
Route::get('/social-auth/{provider}', [SocialLoginController::class, 'redirectToProvider'])->name('social.redirect');
|
Route::get('/social-auth/{provider}', [SocialLoginController::class, 'redirectToProvider'])->name('social.redirect');
|
||||||
|
|
||||||
|
Route::middleware(['auth', 'blocked', 'impersonate'])->group(function () {
|
||||||
//Admin route
|
//Admin route
|
||||||
Route::group([
|
Route::group([
|
||||||
'middleware' => 'admin',
|
'middleware' => 'admin',
|
||||||
|
|
Loading…
Reference in New Issue