From cd55493cad3dd5a01022e1373e26dbd42a8245cb Mon Sep 17 00:00:00 2001 From: Jamie Sykes Date: Tue, 20 Aug 2024 09:12:03 +0100 Subject: [PATCH] feat: allow registration process to log a user in if correct configuration has allowed for it. --- src/controllers/MagicLoginController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/controllers/MagicLoginController.php b/src/controllers/MagicLoginController.php index b591194..15ce7ed 100755 --- a/src/controllers/MagicLoginController.php +++ b/src/controllers/MagicLoginController.php @@ -206,6 +206,12 @@ public function actionRegister() // Save the user Craft::$app->runAction('users/save-user'); + // Handle users which can be logged in automatically. + $currentUser = Craft::$app->getUser()->getIdentity(); + if ($currentUser) { + return $this->redirectToPostedUrl(null, 'magic-login/login-link-sent'); + } + // Send the new user a magic login link email. Craft::$app->runAction('magic-login/magic-login/login');