From 6eb4af9296dda2eb00b9f50f73cc6d466fcf9ae5 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 6 Aug 2024 13:05:37 +0530 Subject: [PATCH 1/6] temp MR --- appinfo/routes.php | 1 + lib/Controller/AccountController.php | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index eeeec68a..3496d5ad 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -28,6 +28,7 @@ return ['routes' => [ ['name' => 'account#index', 'url' => '/accounts/{lang}/signup', 'verb' => 'GET', 'postfix' => 'signwithlang'], ['name' => 'account#index', 'url' => '/accounts/signup', 'verb' => 'GET', 'postfix' => 'signwithoutlang'], ['name' => 'account#create', 'url' => '/accounts/create', 'verb' => 'POST'], + ['name' => 'account#sendemail', 'url' => '/accounts/sendemail', 'verb' => 'GET'], ['name' => 'account#captcha', 'url' => '/accounts/captcha', 'verb' => 'GET'], ['name' => 'account#verify_captcha', 'url' => '/accounts/verify_captcha', 'verb' => 'POST'], ['name' => 'account#check_username_available', 'url' => '/accounts/check_username_available', 'verb' => 'POST'], diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index b6aab241..1596a857 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -122,7 +122,15 @@ class AccountController extends Controller { } return $response; } - + /** + * @NoAdminRequired + * @PublicPage + * @NoCSRFRequired + * + **/ + public function sendemail() { + echo 'test'; + } /** * @NoAdminRequired * @PublicPage -- GitLab From ea87f26e7e4c5f285e0be6bb9c06a6070728a253 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 6 Aug 2024 13:11:04 +0530 Subject: [PATCH 2/6] changes --- lib/Controller/AccountController.php | 8 +++++++- lib/Service/UserService.php | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 1596a857..91efbd24 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -129,7 +129,13 @@ class AccountController extends Controller { * **/ public function sendemail() { - echo 'test'; + $displayname = 'Ronak'; + $username = 'ronak.patel'; + $userEmail = 'eronax59@gmail.com'; + $language = 'en'; + $this->userService->sendWelcomeEmail($displayname, $username, $userEmail, $language); + echo 'sent'; + die; } /** * @NoAdminRequired diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 7cca2d81..8ac542ad 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -172,12 +172,14 @@ class UserService { $sendgridAPIkey = $this->getSendGridAPIKey(); if (empty($sendgridAPIkey)) { + print_r("sendgrid_api_key is missing or empty."); $this->logger->warning("sendgrid_api_key is missing or empty.", ['app' => Application::APP_ID]); return; } $templateIDs = $this->getSendGridTemplateIDs(); if (empty($templateIDs)) { + print_r("welcome_sendgrid_template_ids is missing or empty."); $this->logger->warning("welcome_sendgrid_template_ids is missing or empty.", ['app' => Application::APP_ID]); return; } @@ -194,6 +196,7 @@ class UserService { $email = $this->createSendGridEmail($fromEmail, $fromName, $username, $displayname, $userEmail, $templateID); $this->sendEmailWithSendGrid($email, $sendgridAPIkey); } catch (Throwable $e) { + print_r('Error sending welcome email to user: ' . $username . ': ' . $e->getMessage()); $this->logger->error('Error sending welcome email to user: ' . $username . ': ' . $e->getMessage()); } } -- GitLab From 447cc1f50b39a18f718ed5a2bf8ebdbaf94ffdd4 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Tue, 6 Aug 2024 13:14:14 +0530 Subject: [PATCH 3/6] changes --- lib/Service/UserService.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 8ac542ad..1f26ec8d 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -173,6 +173,7 @@ class UserService { $sendgridAPIkey = $this->getSendGridAPIKey(); if (empty($sendgridAPIkey)) { print_r("sendgrid_api_key is missing or empty."); + die; $this->logger->warning("sendgrid_api_key is missing or empty.", ['app' => Application::APP_ID]); return; } @@ -180,6 +181,7 @@ class UserService { $templateIDs = $this->getSendGridTemplateIDs(); if (empty($templateIDs)) { print_r("welcome_sendgrid_template_ids is missing or empty."); + die; $this->logger->warning("welcome_sendgrid_template_ids is missing or empty.", ['app' => Application::APP_ID]); return; } @@ -197,6 +199,7 @@ class UserService { $this->sendEmailWithSendGrid($email, $sendgridAPIkey); } catch (Throwable $e) { print_r('Error sending welcome email to user: ' . $username . ': ' . $e->getMessage()); + die; $this->logger->error('Error sending welcome email to user: ' . $username . ': ' . $e->getMessage()); } } @@ -235,7 +238,8 @@ class UserService { $response = $sendgrid->send($email, [ CURLOPT_TIMEOUT => 15 ]); if ($response->statusCode() < 200 || $response->statusCode() > 299) { - $this->logger->error("SendGrid API error - Status Code: " . $response->statusCode()); + print_r("SendGrid API error - Status Code: " . $response->statusCode()); + die; } } /** -- GitLab From 1039fb2ff729f35cdeef8fcdea20d316cb611551 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Wed, 28 Aug 2024 16:33:28 +0530 Subject: [PATCH 4/6] chnged avinsh --- lib/Controller/AccountController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Controller/AccountController.php b/lib/Controller/AccountController.php index 91efbd24..959b4c5e 100644 --- a/lib/Controller/AccountController.php +++ b/lib/Controller/AccountController.php @@ -129,9 +129,9 @@ class AccountController extends Controller { * **/ public function sendemail() { - $displayname = 'Ronak'; - $username = 'ronak.patel'; - $userEmail = 'eronax59@gmail.com'; + $displayname = 'Avinash'; + $username = 'avinashrecovery1'; + $userEmail = 'avinashrecovery1@dev.eeo.one'; $language = 'en'; $this->userService->sendWelcomeEmail($displayname, $username, $userEmail, $language); echo 'sent'; -- GitLab From efc75b995020775968e485b13dabf71be1726bca Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Wed, 28 Aug 2024 16:39:12 +0530 Subject: [PATCH 5/6] chnged avinsh --- lib/Service/UserService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index 1f26ec8d..a89fe13c 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -193,7 +193,7 @@ class UserService { $fromEmail = Util::getDefaultEmailAddress('noreply'); $fromName = $this->defaults->getName(); - + $fromEmail = 'ronak.register@murena.io'; try { $email = $this->createSendGridEmail($fromEmail, $fromName, $username, $displayname, $userEmail, $templateID); $this->sendEmailWithSendGrid($email, $sendgridAPIkey); -- GitLab From 4d85756e5092a0af10777bc3a9a70d7954a06383 Mon Sep 17 00:00:00 2001 From: theronakpatel Date: Wed, 28 Aug 2024 16:41:44 +0530 Subject: [PATCH 6/6] noreply@murenatest.io --- lib/Service/UserService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/UserService.php b/lib/Service/UserService.php index a89fe13c..96138bc1 100644 --- a/lib/Service/UserService.php +++ b/lib/Service/UserService.php @@ -193,7 +193,7 @@ class UserService { $fromEmail = Util::getDefaultEmailAddress('noreply'); $fromName = $this->defaults->getName(); - $fromEmail = 'ronak.register@murena.io'; + $fromEmail = 'noreply@murenatest.io'; try { $email = $this->createSendGridEmail($fromEmail, $fromName, $username, $displayname, $userEmail, $templateID); $this->sendEmailWithSendGrid($email, $sendgridAPIkey); -- GitLab