From cb5229a5e826323580f7db9908303c0574571b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sun, 21 Jun 2020 16:01:46 +0200 Subject: [PATCH] MAPG-69 welcome email shouldn't be sent to existing user --- src/Controller/LoginController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Controller/LoginController.php b/src/Controller/LoginController.php index 400f95d..5223a54 100644 --- a/src/Controller/LoginController.php +++ b/src/Controller/LoginController.php @@ -273,8 +273,12 @@ class LoginController $user = $this->userRepository->getByEmail($userData['email']); if ($user === null) { + $sendWelcomeEmail = true; + $user = new User(); $user->setEmail($userData['email']); + } else { + $sendWelcomeEmail = false; } $user->setActive(true); @@ -282,7 +286,9 @@ class LoginController $this->pdm->saveToDb($user); - $this->sendWelcomeEmail($user->getEmail()); + if ($sendWelcomeEmail) { + $this->sendWelcomeEmail($user->getEmail()); + } $this->request->session()->delete('google_user_data'); $this->request->setUser($user);