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