50 lines
1.1 KiB
PHP
50 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Vanguard\Http\Requests\Auth;
|
|
|
|
use Vanguard\Http\Requests\Request;
|
|
|
|
class PasswordResetRequest extends Request
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'token' => 'required',
|
|
'email' => 'required|email',
|
|
'password' => [
|
|
'required',
|
|
'confirmed',
|
|
'min:8',
|
|
'regex:/^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/'
|
|
],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom messages for validator errors.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function messages()
|
|
{
|
|
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.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function credentials()
|
|
{
|
|
return $this->only('email', 'password', 'password_confirmation', 'token');
|
|
}
|
|
}
|