Skip to content

Commit 7adb846

Browse files
committed
fix: manage user not found case
Signed-off-by: romanetar <roman_ag@hotmail.com>
1 parent 981463f commit 7adb846

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

app/Http/Controllers/UserController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ public function emitOTP()
314314

315315
$user = $this->auth_service->getUserByUsername($username);
316316

317+
if (is_null($user)) {
318+
throw new EntityNotFoundException();
319+
}
320+
317321
if (!$user->isActive())
318322
throw new ValidationException
319323
(

resources/js/login/login.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,10 @@ class LoginPage extends React.Component {
509509
});
510510
}, (error) => {
511511
let {response, status, message} = error;
512+
if(status == 404){
513+
this.showAlert('We couldn\'t find an account with the email provided.', 'error');
514+
return;
515+
}
512516
if(status == 412){
513517
const {message, errors} = response.body;
514518
this.showAlert(errors[0], 'error');

0 commit comments

Comments
 (0)