38 lines
920 B
PHP
38 lines
920 B
PHP
<?php
|
|
|
|
namespace Vanguard\Http\Requests\Auth;
|
|
|
|
use Vanguard\Http\Requests\Request;
|
|
|
|
class PasswordResetRequest extends Request
|
|
{
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'token' => 'required',
|
|
'email' => 'required|email',
|
|
'password' => [
|
|
'required',
|
|
'confirmed',
|
|
'min:8',
|
|
'regex:/^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/'
|
|
],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'password.regex' => __('The password must be at least 8 characters long and contain at least one number and one special character (@$!%*?&).'),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the password reset fields.
|
|
*/
|
|
public function credentials(): array
|
|
{
|
|
return $this->only('email', 'password', 'password_confirmation', 'token');
|
|
}
|
|
}
|