37 lines
842 B
PHP
37 lines
842 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Auth;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class LoginRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'identifier' => ['required', 'string'],
|
|
'password' => [
|
|
'required',
|
|
'string',
|
|
'min:8',
|
|
'regex:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z0-9]).{8,}$/',
|
|
],
|
|
'device_name' => ['nullable', 'string'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'password.min' => 'Password minimal 8 karakter.',
|
|
'password.regex' => 'Password harus mengandung huruf besar, huruf kecil, angka, dan simbol khusus.',
|
|
];
|
|
}
|
|
}
|
|
|