admin users begin

This commit is contained in:
Александр Бабкин
2022-06-24 09:00:38 +03:00
parent 4578844d84
commit 2ff5204549
7 changed files with 148 additions and 7 deletions

View File

@@ -29,7 +29,8 @@ class LoginRequest extends FormRequest
public function rules()
{
return [
'email' => ['required', 'string', 'email'],
// 'email' => ['required', 'string', 'email'],
'username' => ['required', 'string'],
'password' => ['required', 'string'],
];
}
@@ -45,11 +46,19 @@ class LoginRequest extends FormRequest
{
$this->ensureIsNotRateLimited();
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
// if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
// RateLimiter::hit($this->throttleKey());
// throw ValidationException::withMessages([
// 'email' => trans('auth.failed'),
// ]);
// }
if (! Auth::attempt($this->only('username', 'password'), $this->boolean('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.failed'),
'username' => trans('auth.failed'),
]);
}