Replace Auth::routes() with explicit auth route definitions

Expand the laravel/ui Auth::routes() helper into explicit route
definitions for login, logout, registration and password reset. This
removes the routing magic, makes every auth route visible in web.php,
and lets the honeypot ProtectAgainstSpam middleware live directly on the
single POST /register definition instead of a duplicate route.

laravel/ui is retained since the Auth controllers still rely on its
Illuminate\Foundation\Auth traits.
pull/7108/head
Your Name 2 weeks ago
parent ce4343e3e2
commit 889d9efe99

@ -4,7 +4,10 @@ use App\Http\Controllers\AccountController;
use App\Http\Controllers\AccountInterstitialController;
use App\Http\Controllers\AdminInviteController;
use App\Http\Controllers\AppRegisterController;
use App\Http\Controllers\Auth\ForgotPasswordController;
use App\Http\Controllers\Auth\LoginController;
use App\Http\Controllers\Auth\RegisterController;
use App\Http\Controllers\Auth\ResetPasswordController;
use App\Http\Controllers\AuthorizeInteractionController;
use App\Http\Controllers\AvatarController;
use App\Http\Controllers\BookmarkController;
@ -63,10 +66,17 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
Route::get('web/explore', [LandingController::class, 'exploreRedirect']);
Route::get('authorize_interaction', [AuthorizeInteractionController::class, 'get']);
Auth::routes();
Route::get('register', [RegisterController::class, 'showRegistrationForm'])->name('register');
Route::post('register', [RegisterController::class, 'register'])->middleware(ProtectAgainstSpam::class);
Route::get('login', [LoginController::class, 'showLoginForm'])->name('login');
Route::post('login', [LoginController::class, 'login']);
Route::post('logout', [LoginController::class, 'logout'])->name('logout');
Route::get('password/reset', [ForgotPasswordController::class, 'showLinkRequestForm'])->name('password.request');
Route::post('password/email', [ForgotPasswordController::class, 'sendResetLinkEmail'])->name('password.email');
Route::get('password/reset/{token}', [ResetPasswordController::class, 'showResetForm'])->name('password.reset');
Route::post('password/reset', [ResetPasswordController::class, 'reset'])->name('password.update');
Route::get('auth/oidc/start', [RemoteOidcController::class, 'start']);
Route::get('auth/oidc/callback', [RemoteOidcController::class, 'handleCallback']);

Loading…
Cancel
Save