82 lines
4.5 KiB
PHP
82 lines
4.5 KiB
PHP
<?php
|
|
|
|
use App\Http\Controllers\Auth\CompleteProfileController;
|
|
use App\Http\Controllers\Auth\EmailVerificationController;
|
|
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\Auth\SocialiteController;
|
|
use App\Http\Controllers\Auth\TwoFactorChallengeController;
|
|
use App\Http\Controllers\Auth\TwoFactorSettingsController;
|
|
use App\Http\Controllers\Auth\TwoFactorSetupController;
|
|
use App\Http\Controllers\ProfileController;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
Route::middleware('guest')->group(function () {
|
|
Route::get('login', [LoginController::class, 'create'])->name('login');
|
|
Route::post('login', [LoginController::class, 'store'])->middleware('throttle:auth.login');
|
|
|
|
Route::get('register', [RegisterController::class, 'create'])->name('register');
|
|
Route::post('register', [RegisterController::class, 'store'])->middleware('throttle:auth.register');
|
|
|
|
Route::get('forgot-password', [ForgotPasswordController::class, 'create'])->name('password.request');
|
|
Route::post('forgot-password', [ForgotPasswordController::class, 'store'])->name('password.email')->middleware('throttle:auth.password-email');
|
|
|
|
Route::get('reset-password/{token}', [ResetPasswordController::class, 'create'])->name('password.reset');
|
|
Route::post('reset-password', [ResetPasswordController::class, 'store'])->name('password.store')->middleware('throttle:auth.password-reset');
|
|
|
|
// Socialite routes
|
|
Route::get('auth/{provider}', [SocialiteController::class, 'redirect'])
|
|
->middleware('throttle:auth.social')
|
|
->name('socialite.redirect');
|
|
Route::get('auth/{provider}/callback', [SocialiteController::class, 'callback'])->name('socialite.callback')->middleware('throttle:auth.social');
|
|
|
|
// Complete profile after social login (when username is taken)
|
|
Route::get('complete-profile', [CompleteProfileController::class, 'create'])->name('auth.complete-profile');
|
|
Route::post('complete-profile', [CompleteProfileController::class, 'store'])
|
|
->middleware('throttle:auth.social');
|
|
|
|
Route::get('two-factor-challenge', [TwoFactorChallengeController::class, 'create'])
|
|
->name('two-factor.login');
|
|
Route::post('two-factor-challenge', [TwoFactorChallengeController::class, 'store'])
|
|
->middleware('throttle:auth.two-factor')
|
|
->name('two-factor.login.store');
|
|
});
|
|
|
|
Route::middleware('auth')->group(function () {
|
|
Route::post('logout', [LoginController::class, 'destroy'])->name('logout');
|
|
|
|
// Email verification routes
|
|
Route::get('email/verify', [EmailVerificationController::class, 'notice'])->name('verification.notice');
|
|
Route::get('email/verify/{id}/{hash}', [EmailVerificationController::class, 'verify'])->middleware('signed')->name('verification.verify');
|
|
Route::post('email/verification-notification', [EmailVerificationController::class, 'resend'])
|
|
->middleware('throttle:auth.account')
|
|
->name('verification.send');
|
|
|
|
Route::get('profile', ProfileController::class)->name('profile.show');
|
|
Route::redirect('security', '/profile')->name('profile.security-redirect');
|
|
Route::get('two-factor-setup', TwoFactorSetupController::class)
|
|
->name('two-factor.setup');
|
|
Route::get('two-factor-setup/complete', [TwoFactorSetupController::class, 'complete'])
|
|
->name('two-factor.setup.complete');
|
|
Route::post('two-factor-setup', [TwoFactorSettingsController::class, 'enable'])
|
|
->middleware('throttle:auth.two-factor')
|
|
->name('two-factor.setup.enable');
|
|
Route::post('two-factor-setup/confirm', [TwoFactorSettingsController::class, 'confirm'])
|
|
->middleware('throttle:auth.two-factor')
|
|
->name('two-factor.setup.confirm');
|
|
Route::post('profile/two-factor', [TwoFactorSettingsController::class, 'enable'])
|
|
->middleware('throttle:auth.two-factor')
|
|
->name('profile.two-factor.enable');
|
|
Route::post('profile/two-factor/confirm', [TwoFactorSettingsController::class, 'confirm'])
|
|
->middleware('throttle:auth.two-factor')
|
|
->name('profile.two-factor.confirm');
|
|
Route::delete('profile/two-factor', [TwoFactorSettingsController::class, 'disable'])
|
|
->middleware('throttle:auth.two-factor')
|
|
->name('profile.two-factor.disable');
|
|
Route::post('profile/two-factor/recovery-codes', [TwoFactorSettingsController::class, 'recoveryCodes'])
|
|
->middleware('throttle:auth.two-factor')
|
|
->name('profile.two-factor.recovery-codes');
|
|
});
|