A11y:
- Skip-to-content link lands first in the body and jumps to #main
past the header + sidebar for keyboard users.
- aria-label on the icon buttons that previously carried only an
icon: hamburger menu (+ aria-controls="sidebar"), mobile search
toggle, account menu (also drops the duplicate alt on the avatar
since the button name already speaks the user's name).
Admin:
- Dashboard stat card renamed "Live Videos" → "Ready" (matches the
DB status column; nothing on this card is actually live).
Settings:
- Duplicate "Prefer not to say" option on the Gender select — the
empty placeholder shared the same label as the real option.
Placeholder is now "Select…"; the real "Prefer not to say" option
stays unchanged.
- Birthday picker caps the Year dropdown at (this year − 13) and
the server-side register validation requires the same, so a
client bypass can't let a <13 user through.
Titles:
- Admin layout uses "{Page} | TAKEONE" to match the frontend format
(was "{Page} — TAKEONE"). User pages that said "| TAKEONE" literal
now interpolate config('app.name'). Shorts and Welcome moved from
" - " to " | " separator.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
65 lines
2.3 KiB
PHP
65 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\User;
|
|
use App\Notifications\NewUserRegistered;
|
|
use App\Rules\NotDisposableEmail;
|
|
use App\Rules\ReservedIdentifier;
|
|
use App\Support\SafeNotifier;
|
|
use Illuminate\Auth\Events\Registered;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Hash;
|
|
use Illuminate\Validation\Rules\Password;
|
|
|
|
class RegisteredUserController extends Controller
|
|
{
|
|
public function create()
|
|
{
|
|
return view('auth.register');
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
// Honeypot — bots fill hidden fields; real users never do
|
|
if ($request->filled('_hp')) {
|
|
// Silently appear to succeed to confuse the bot
|
|
return redirect()->route('login');
|
|
}
|
|
|
|
$request->validate([
|
|
'name' => ['required', 'string', 'max:255', new ReservedIdentifier('name')],
|
|
'email' => ['required', 'string', 'email', 'max:255', 'unique:users', new NotDisposableEmail, new ReservedIdentifier('email')],
|
|
'password' => ['required', 'confirmed', Password::defaults()],
|
|
// Age gate: must be at least 13 on sign-up day. The front-end
|
|
// date picker already caps the year dropdown, but the server
|
|
// must enforce it so a client bypass doesn't let a 10-year-old
|
|
// through.
|
|
'birthday' => ['required', 'date', 'before:' . now()->subYears(13)->toDateString()],
|
|
'gender' => ['required', 'in:male,female'],
|
|
'nationality' => ['required', 'string', 'size:2'],
|
|
]);
|
|
|
|
$user = User::create([
|
|
'name' => $request->name,
|
|
'email' => $request->email,
|
|
'password' => Hash::make($request->password),
|
|
'birthday' => $request->birthday,
|
|
'gender' => $request->gender,
|
|
'nationality' => $request->nationality,
|
|
]);
|
|
|
|
event(new Registered($user));
|
|
|
|
// Notify all super admins of the new registration
|
|
User::where('role', 'super_admin')->each(function (User $admin) use ($user) {
|
|
SafeNotifier::send($admin, new NewUserRegistered($user));
|
|
});
|
|
|
|
auth()->login($user);
|
|
|
|
return redirect()->route('verification.notice');
|
|
}
|
|
}
|