Files
InvoiceShelf/app/Http/Requests/ProfileRequest.php
Darko Gjorgjijoski 39c9179888 Support internationalized domain names (IDN) in email validation
Add IdnEmail validation rule that converts IDN domains to Punycode
via idn_to_ascii() before validating with FILTER_VALIDATE_EMAIL.
Applied to all email fields: customers, members, profiles, admin
users, customer portal profiles, and mail configuration.

Includes unit tests for standard emails, IDN emails, and invalid
inputs.

Fixes #388
2026-04-06 23:55:29 +02:00

41 lines
849 B
PHP

<?php
namespace App\Http\Requests;
use App\Rules\IdnEmail;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\Rule;
class ProfileRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'name' => [
'required',
],
'password' => [
'nullable',
'min:8',
],
'email' => [
'required',
new IdnEmail,
Rule::unique('users')->ignore(Auth::id(), 'id'),
],
];
}
}