Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70953ea150 | ||
|
|
228a4f8dc7 |
@@ -57,9 +57,17 @@
|
|||||||
} else {
|
} else {
|
||||||
if (!Auth::attempt($authData, $this->boolean('remember'))) {
|
if (!Auth::attempt($authData, $this->boolean('remember'))) {
|
||||||
RateLimiter::hit($this->throttleKey());
|
RateLimiter::hit($this->throttleKey());
|
||||||
throw ValidationException::withMessages([
|
$loginField = filter_var($credentials['login'], FILTER_VALIDATE_EMAIL) ? 'email' : 'nik';
|
||||||
'login' => 'Email/NIK atau password tidak sesuai.'
|
$user = User::where($loginField, $credentials['login'])->first();
|
||||||
]);
|
|
||||||
|
$messages = [];
|
||||||
|
if ($user) {
|
||||||
|
$messages['password'] = 'Password tidak sesuai';
|
||||||
|
} else {
|
||||||
|
$messages['login'] = 'Email/NIK tidak ditemukan';
|
||||||
|
}
|
||||||
|
|
||||||
|
throw ValidationException::withMessages($messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
RateLimiter::clear($this->throttleKey());
|
RateLimiter::clear($this->throttleKey());
|
||||||
@@ -99,7 +107,9 @@
|
|||||||
$branch = Branch::where('code', 'LIKE', '%' . $lastFourDigits)->first();
|
$branch = Branch::where('code', 'LIKE', '%' . $lastFourDigits)->first();
|
||||||
|
|
||||||
session()->put($userArray[0]);
|
session()->put($userArray[0]);
|
||||||
session()->put('branch_id',$branch->id);
|
if ($branch) {
|
||||||
|
session()->put('branch_id', $branch->id);
|
||||||
|
}
|
||||||
|
|
||||||
$user = User::updateOrCreate(
|
$user = User::updateOrCreate(
|
||||||
[$loginField => $credentials['login']],
|
[$loginField => $credentials['login']],
|
||||||
@@ -128,9 +138,17 @@
|
|||||||
|
|
||||||
// Authentication failed
|
// Authentication failed
|
||||||
RateLimiter::hit($this->throttleKey());
|
RateLimiter::hit($this->throttleKey());
|
||||||
throw ValidationException::withMessages([
|
$loginField = filter_var($credentials['login'], FILTER_VALIDATE_EMAIL) ? 'email' : 'nik';
|
||||||
'login' => 'Email/NIK atau password tidak sesuai.',
|
$user = User::where($loginField, $credentials['login'])->first();
|
||||||
]);
|
|
||||||
|
$messages = [];
|
||||||
|
if ($user) {
|
||||||
|
$messages['password'] = 'Password tidak sesuai';
|
||||||
|
} else {
|
||||||
|
$messages['login'] = 'Email/NIK tidak ditemukan';
|
||||||
|
}
|
||||||
|
|
||||||
|
throw ValidationException::withMessages($messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user