Skip to content

Commit f96bdad

Browse files
authored
Merge pull request #316 from datamweb/refactor-whit-startUpAction
2 parents 149581b + c1e0173 commit f96bdad

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Controllers/LoginController.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use App\Controllers\BaseController;
66
use CodeIgniter\HTTP\RedirectResponse;
7+
use CodeIgniter\Shield\Authentication\Authenticators\Session;
78

89
class LoginController extends BaseController
910
{
@@ -47,9 +48,14 @@ public function loginAction(): RedirectResponse
4748
return redirect()->route('login')->withInput()->with('error', $result->reason());
4849
}
4950

51+
// custom bit of information
52+
$user = $result->extraInfo();
53+
/** @var Session $authenticator */
54+
$authenticator = auth('session')->getAuthenticator();
55+
5056
// If an action has been defined for login, start it up.
51-
$actionClass = setting('Auth.actions')['login'] ?? null;
52-
if (! empty($actionClass)) {
57+
$hasAction = $authenticator->startUpAction('login', $user);
58+
if ($hasAction) {
5359
return redirect()->route('auth-action-show')->withCookies();
5460
}
5561

0 commit comments

Comments
 (0)