Skip to content

Commit 2db4345

Browse files
committed
update HomeController class
handle 401 error
1 parent ee62ca4 commit 2db4345

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Controllers/HomeController.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ public function error(): IActionResult
2222
$code = $this->HttpContext->Error ? $this->HttpContext->Error->getCode() : 404;
2323

2424
switch ($code) {
25-
case 404:
26-
$error = new \Exception("Sorry! Looks like this page doesn't exist.", 404);
25+
case 401:
26+
return $this->redirect('/account/login');
2727
break;
2828
case 403:
2929
$error = new \Exception("Sorry! Your request is not allowed.", 403);
3030
break;
31+
case 404:
32+
$error = new \Exception("Sorry! Looks like this page doesn't exist.", 404);
33+
break;
3134
default:
3235
$error = new \Exception("Woops! Looks like something went wrong.", 500);
3336
break;

0 commit comments

Comments
 (0)