- Installed p7h/nas-file-manager package via private VCS repo - Published config/nas-file-manager.php with super_admin middleware restriction - Added NAS env vars to .env.example - Created admin/nas-storage page with connection info panel and file browser widget - Added NAS Storage link to admin sidebar (super_admin only) - Added SuperAdminController@nasStorage method and admin.nas-storage route - Includes all accumulated branch changes: profile wall, 2FA, audit logs, settings panel, country/phone/timezone components, posts, slideshow, playlist shares, video downloads/shares, comment likes, notifications, social links, and more Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
61 lines
2.5 KiB
PHP
61 lines
2.5 KiB
PHP
<?php
|
|
|
|
use App\Http\Controllers\Auth\AuthenticatedSessionController;
|
|
use App\Http\Controllers\Auth\RegisteredUserController;
|
|
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
Route::middleware('guest')->group(function () {
|
|
Route::get('register', [RegisteredUserController::class, 'create'])->name('register');
|
|
Route::post('register', [RegisteredUserController::class, 'store'])
|
|
->middleware('throttle:5,1') // max 5 registrations per minute per IP
|
|
->name('register.store');
|
|
|
|
Route::get('login', [AuthenticatedSessionController::class, 'create'])->name('login');
|
|
Route::post('login', [AuthenticatedSessionController::class, 'store'])
|
|
->middleware('throttle:10,1') // max 10 login attempts per minute per IP
|
|
->name('login.store');
|
|
});
|
|
|
|
// Email verification
|
|
Route::middleware('auth')->group(function () {
|
|
Route::get('email/verify', fn () => view('auth.verify-email'))
|
|
->name('verification.notice');
|
|
|
|
Route::get('email/verify/{id}/{hash}', function (Request $request, $id, $hash) {
|
|
// If the link belongs to a different account, log out and ask them to
|
|
// sign in as the right account before clicking the link again.
|
|
if (Auth::check() && (string) Auth::id() !== (string) $id) {
|
|
session()->forget('impersonator_id');
|
|
Auth::logout();
|
|
$request->session()->invalidate();
|
|
$request->session()->regenerateToken();
|
|
return redirect()->route('login')
|
|
->with('info', 'Please log in with the account that owns this verification link, then click the link again.');
|
|
}
|
|
|
|
$user = Auth::user();
|
|
|
|
// Validate the hash against the authenticated user's email
|
|
if (! hash_equals(sha1($user->getEmailForVerification()), (string) $hash)) {
|
|
abort(403);
|
|
}
|
|
|
|
if (! $user->hasVerifiedEmail()) {
|
|
$user->markEmailAsVerified();
|
|
event(new \Illuminate\Auth\Events\Verified($user));
|
|
}
|
|
|
|
return redirect('/videos')->with('verified', true);
|
|
})->middleware('signed')->name('verification.verify');
|
|
|
|
Route::post('email/verification-notification', function (Request $request) {
|
|
$request->user()->sendEmailVerificationNotification();
|
|
return back()->with('resent', true);
|
|
})->middleware('throttle:3,1')->name('verification.send');
|
|
|
|
Route::post('logout', [AuthenticatedSessionController::class, 'destroy'])->name('logout');
|
|
});
|