From 01940034dd4357958d6b6043d5b821906b31c80f Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 15:52:16 -0800 Subject: [PATCH 01/30] Weekly recovey email update --- appinfo/info.xml | 3 + l10n/de.json | 4 +- l10n/de_DE.json | 4 +- l10n/en.json | 4 +- l10n/es.json | 4 +- l10n/fr.json | 4 +- l10n/it.json | 4 +- .../WeeklyRecoveryNotificationJob.php | 264 ++++++++++++++++++ 8 files changed, 285 insertions(+), 6 deletions(-) create mode 100644 lib/BackgroundJob/WeeklyRecoveryNotificationJob.php diff --git a/appinfo/info.xml b/appinfo/info.xml index 48ea203..90d76ba 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -17,4 +17,7 @@ OCA\EmailRecovery\Settings\RecoveryEmailSettings + diff --git a/l10n/de.json b/l10n/de.json index 72dcd1c..48d48f9 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -24,6 +24,8 @@ "Could not verify recovery email because the token is invalid": "Wiederherstellungs-E-Mail konnte nicht verifiziert werden, da das Token ungültig ist", "Unverified recovery email:": "Nicht verifizierte Wiederherstellungs-E-Mail:", "Please set your recovery email address to use your email account without restrictions.": "Bitte geben Sie Ihre Wiederherstellungs-E-Mail-Adresse an, damit Sie Ihr E-Mail ohne Beschränkungen nutzen können.", - "SET RECOVERY EMAIL NOW": "MEINE WIEDERHERSTELLUNGS-E-MAIL-ADRESSE ANGEBEN" + "SET RECOVERY EMAIL NOW": "MEINE WIEDERHERSTELLUNGS-E-MAIL-ADRESSE ANGEBEN", + "20240101_weekly_reminder_subject": "Erforderliche Handlung: Geben Sie eine E-Mail-Adresse zur Wiederherstellung an", + "20240101_weekly_reminder_body": "Hallo **{username}**,\n\nAus Sicherheitsgründen müssen Sie eine Wiederherstellungs-E-Mail-Adresse für Ihr Murena Cloud-Konto angeben. Da Sie dies noch nicht getan haben, ist die Benutzung Ihrer E-Mail-Adresse eingeschränkt. Bitte geben Sie eine gültige E-Mail-Adresse zur Wiederherstellung an, damit die Nutzungsbeschränkungen Ihrer E-Mail-Adresse aufgehoben werden.\n\n[MEINE WIEDERHERSTELLUNGS-E-MAIL-ADRESSE ANGEBEN](https://murena.io/settings/user/security#recovery-email-form)" },"pluralForm" :"nplurals=2; plural=n != 1;" } \ No newline at end of file diff --git a/l10n/de_DE.json b/l10n/de_DE.json index b05534e..c946b00 100644 --- a/l10n/de_DE.json +++ b/l10n/de_DE.json @@ -22,6 +22,8 @@ "You verified recovery email successfully.": "Sie haben die Wiederherstellungs-E-Mail erfolgreich verifiziert.", "Could not verify recovery email because the token is expired": "Wiederherstellungs-E-Mail konnte nicht verifiziert werden, da das Token abgelaufen ist", "Could not verify recovery email because the token is invalid": "Wiederherstellungs-E-Mail konnte nicht verifiziert werden, da das Token ungültig ist", - "Unverified recovery email:": "Nicht verifizierte Wiederherstellungs-E-Mail:" + "Unverified recovery email:": "Nicht verifizierte Wiederherstellungs-E-Mail:", + "20240101_weekly_reminder_subject": "Erforderliche Handlung: Geben Sie eine E-Mail-Adresse zur Wiederherstellung an", + "20240101_weekly_reminder_body": "Hallo **{username}**,\n\nAus Sicherheitsgründen müssen Sie eine Wiederherstellungs-E-Mail-Adresse für Ihr Murena Cloud-Konto angeben. Da Sie dies noch nicht getan haben, ist die Benutzung Ihrer E-Mail-Adresse eingeschränkt. Bitte geben Sie eine gültige E-Mail-Adresse zur Wiederherstellung an, damit die Nutzungsbeschränkungen Ihrer E-Mail-Adresse aufgehoben werden.\n\n[MEINE WIEDERHERSTELLUNGS-E-MAIL-ADRESSE ANGEBEN](https://murena.io/settings/user/security#recovery-email-form)" },"pluralForm" :"nplurals=2; plural=n != 1;" } \ No newline at end of file diff --git a/l10n/en.json b/l10n/en.json index 5fad55a..675badb 100644 --- a/l10n/en.json +++ b/l10n/en.json @@ -23,7 +23,9 @@ "Could not verify recovery email because the token is invalid": "Could not verify recovery email because the token is invalid", "Unverified recovery email:": "Unverified recovery email:", "Please set your recovery email address to use your email account without restrictions.": "Please set your recovery email address to use your email account without restrictions.", - "SET RECOVERY EMAIL NOW": "SET RECOVERY EMAIL NOW" + "SET RECOVERY EMAIL NOW": "SET RECOVERY EMAIL NOW", + "20240101_weekly_reminder_subject": "Action required: Set up your recovery email", + "20240101_weekly_reminder_body": "Dear **{username}**,\n\nFor security reasons you need to set a recovery email address for your Murena Cloud account. As you haven't done so yet, the usage of your email address is restricted. Please set and validate a recovery email address to remove all usage restriction on your email address.\n\n[SET MY RECOVERY EMAIL ADDRESS](https://murena.io/settings/user/security#recovery-email-form)" }, "pluralForm": "nplurals=2; plural=(n != 1);" } \ No newline at end of file diff --git a/l10n/es.json b/l10n/es.json index 2b64cbb..497f64b 100644 --- a/l10n/es.json +++ b/l10n/es.json @@ -24,6 +24,8 @@ "Could not verify recovery email because the token is invalid": "No se ha podido verificar el correo electrónico de recuperación porque el token no es válido", "Unverified recovery email:": "Correo electrónico de recuperación no verificado:", "Please set your recovery email address to use your email account without restrictions.": "Configura tu dirección de correo electrónico de recuperación para utilizar tu cuenta de correo electrónico sin restricciones.", - "SET RECOVERY EMAIL NOW": "CONFIGURAR CORREO ELECTRÓNICO DE RECUPERACIÓN" + "SET RECOVERY EMAIL NOW": "CONFIGURAR CORREO ELECTRÓNICO DE RECUPERACIÓN", + "20240101_weekly_reminder_subject": "Acción necesaria: Configura tu correo electrónico de recuperación", + "20240101_weekly_reminder_body": "Estimado **{username}**,\n\nPor motivos de seguridad, debes proveer una dirección de email de recuperación para tu cuenta Murena Cloud. Como aún no lo haz hecho, el uso de tu dirección de correo electrónico está restringido. Configura y confirma una dirección de correo alternativa de recuperación para eliminar todas las restricciones de uso de tu correo Murena.\n\n[CONFIGURAR DIRECCIÓN DE EMAIL DE RECUPERACIÓN](https://murena.io/settings/user/security#recovery-email-form)" },"pluralForm" :"nplurals=2; plural=n != 1;" } \ No newline at end of file diff --git a/l10n/fr.json b/l10n/fr.json index dc818ef..5f698d9 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -24,6 +24,8 @@ "Could not verify recovery email because the token is invalid": "Impossible de vérifier l'e-mail de récupération car le jeton n'est pas valide.", "Unverified recovery email:": "Courriel de récupération non vérifié :", "Please set your recovery email address to use your email account without restrictions.": "Merci de définir une adresse e-mail de récupération pour bénéficier d'un usage de votre compte sans restrictions.", - "SET RECOVERY EMAIL NOW": "DEFINIR L'ADRESSE DE RECUPERATION MAINTENANT" + "SET RECOVERY EMAIL NOW": "DEFINIR L'ADRESSE DE RECUPERATION MAINTENANT", + "20240101_weekly_reminder_subject": "Action requise: Définissez votre adresse de récupération", + "20240101_weekly_reminder_body": "Cher/Chère **{username}**,\n\nPour des raisons de sécurité, vous devez définir une adresse de récupération pour votre compte Murena Cloud. Comme vous ne l'avez pas encore fait, votre utilisation de votre adresse e-mail est restreinte. Merci de définir et valider un adresse e-mail de récupération pour que toutes les restrictions en place sur votre adresse e-mail puissent être levées.\n\n[DEFINIR MON ADRESSE DE RECUPERATION](https://murena.io/settings/user/security#recovery-email-form)" },"pluralForm" :"nplurals=2; plural=n > 1;" } \ No newline at end of file diff --git a/l10n/it.json b/l10n/it.json index 1344472..3237810 100644 --- a/l10n/it.json +++ b/l10n/it.json @@ -24,6 +24,8 @@ "Could not verify recovery email because the token is invalid": "Impossibile verificare l'email di recupero perché il token non è valido", "Unverified recovery email:": "Email di recupero non verificata:", "Please set your recovery email address to use your email account without restrictions.": "Per poter usare l'account email senza restrizioni devi impostare l'indirizzo email di recovery.", - "SET RECOVERY EMAIL NOW": "IMPOSTA ADESSO LA EMAIL DI RECOVERY" + "SET RECOVERY EMAIL NOW": "IMPOSTA ADESSO LA EMAIL DI RECOVERY", + "20240101_weekly_reminder_subject": "Azione richiesta: imposta un indirizzo email di recovery", + "20240101_weekly_reminder_body": "Caro **{username}**,\n\nPer ragioni di sicurezza, devi impostrare un indirizzo email di recovery per il tuo account Murena Cloud. Dato che non l'hai ancora fatto, l'uso del tuo indirizzo email è stato attualmente limitato. Per rimuovere tutte le limitazioni dovresti impostare e validare una email di recovery.\n\n[IMPOSTA L'INDIRIZZO E-MAIL DI RECOVERY](https://murena.io/settings/user/security#recovery-email-form)" },"pluralForm" :"nplurals=2; plural=n != 1;" } \ No newline at end of file diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php new file mode 100644 index 0000000..31ddfe0 --- /dev/null +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -0,0 +1,264 @@ + + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see + * + */ + +namespace OCA\EmailRecovery\BackgroundJob; + +use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; +use OCP\IConfig; +use OCP\IUserManager; +use OCP\Mail\IEMailTemplate; +use OCP\Mail\IMailer; +use Psr\Log\LoggerInterface; +use OCA\EmailRecovery\AppInfo\Application; +use OCA\EmailRecovery\Service\NotificationService; +use OCP\IUser; +use OCP\Notification\INotification; +use OCP\Notification\IManager as INotificationManager; +use OCP\IURLGenerator; + +class WeeklyRecoveryNotificationJob extends TimedJob +{ + private IConfig $config; + private IMailer $mailer; + private LoggerInterface $logger; + private IUserManager $userManager; + private NotificationService $notificationService; + private $uids = []; + private ITimeFactory $timeFactory; + private INotificationManager $notificationManager; + private IURLGenerator $urlGenerator; + + public function __construct( + IConfig $config, + IMailer $mailer, + IUserManager $userManager, + LoggerInterface $logger, + NotificationService $notificationService, + ITimeFactory $timeFactory, + INotificationManager $notificationManager, + IURLGenerator $urlGenerator + ) { + parent::__construct($timeFactory); + + // $this->setInterval(2 * 60); // Run every 2 minutes + $this->setInterval(60 * 60 * 24); // Run once per day + // $this->setInterval(7 * 24 * 60 * 60); // Run for 7 days + $this->setTimeSensitivity(self::TIME_INSENSITIVE); + + $this->config = $config; + $this->mailer = $mailer; + $this->logger = $logger; + $this->userManager = $userManager; + $this->notificationService = $notificationService; + $this->timeFactory = $timeFactory; + $this->notificationManager = $notificationManager; + $this->urlGenerator = $urlGenerator; + } + + protected function run($argument): void + { + try { + $users = $this->config->getUsersForUserValue(Application::APP_ID, 'recovery-email', ''); + $this->prepareDataForUsers($users); + + $messageId = $this->config->getSystemValue('weekly_reminder_messageid'); + $this->sendCloudNotifications($messageId); + $this->sendEmails($messageId); + } catch (\Exception $e) { + $this->logger->error('Error sending notification emails to users', ['exception' => $e]); + return; + } + } + + /** + * Prepare user data and store it to `uids` + * + * @param array $users + * + */ + private function prepareDataForUsers(array $users): void + { + foreach ($users as $username) { + $user = $this->userManager->get($username); + if ($this->isUserValid($user)) { + $this->logger->error('valid email address : ' . $user->getUID()); + array_push($this->uids, $user->getUID()); + } + } + } + /** + * Send emails to all users + * + * @return void + */ + private function sendCloudNotifications(string $messageId): void + { + try { + $datetime = $this->timeFactory->getDateTime(); + $notification = $this->notificationManager->createNotification(); + $notificationType = 'important'; + $notification->setApp(Application::APP_ID) + ->setDateTime($datetime) + ->setObject(Application::APP_ID . '-' . strtolower($notificationType), $messageId) + ->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath(Application::APP_ID, strtolower($notificationType) . '.svg'))); + + $this->sendNotificationToUsers($messageId, $notification, $this->uids); + } catch (\Exception $e) { + $this->logger->error('Error sending notification email to user', ['exception' => $e]); + } + } + /** + * @param string $messageId + * @param INotification $notification + * @param array $users + */ + protected function sendNotificationToUsers(string $messageId, INotification $notification, array $users): void + { + foreach ($users as $username) { + $user = $this->userManager->get($username); + if (!($user instanceof IUser)) { + continue; + } + $this->sendNotificationToUser($messageId, $user, $notification); + $emailAddress = $user->getEMailAddress(); + if ($emailAddress && $user->isEnabled()) { + if (!$this->mailer->validateMailAddress($emailAddress)) { + $this->logger->warning('User has no valid email address: ' . $user->getUID()); + return; + } + } + } + } + /** + * @param string $messageId + * @param IUser $user + * @param INotification $notification + */ + protected function sendNotificationToUser(string $messageId, IUser $user, INotification $notification): void + { + try { + $uid = $user->getUID(); + $username = $user->getDisplayName(); + $notification->setSubject('cli', [$messageId, $username])->setMessage('cli', [$messageId, $username])->setUser($uid); + $this->notificationManager->notify($notification); + } catch (\Exception $e) { + $this->logger->error($e->getMessage(), ['exception' => $e]); + } + } + /** + * Send emails to all users + * + * @return void + */ + private function sendEmails(string $messageId): void + { + foreach ($this->uids as $uid) { + try { + $user = $this->userManager->get($uid); + $username = $user->getDisplayName(); + $emailAddress = $user->getEMailAddress(); + + $language = $this->config->getUserValue($uid, 'core', 'lang', null); + $translations = $this->notificationService->getTranslatedSubjectAndMessage($messageId, $language); + $subject = $translations['subject']; + $message = $translations['message']; + + $parsedSubject = $this->notificationService->getParsedString($subject, $username); + $subject = $parsedSubject['message']; + $parsedMessage = $this->notificationService->getParsedString($message, $username); + $message = $parsedMessage['message']; + + $this->sendEmail($subject, $message, $emailAddress); + $this->logger->error('RECOVERY EMAIL NOTIFICATION-EMAIL SEND TO :'.$emailAddress); + } catch (\Exception $e) { + $this->logger->error('Error sending notification email to user ' . $uid, ['exception' => $e]); + continue; + } + } + } + + /** + * Send an Email + * + * @param string $subject + * @param string $message + * @param string $emailAddress + * + */ + private function sendEmail(string $subject, string $message, string $emailAddress) + { + $this->logger->error('RECOVERY EMAIL SEND SUBJECT:'.$subject); + $this->logger->error('RECOVERY EMAIL SEND MESSAGE:'.$message); + $this->logger->error('RECOVERY EMAIL SEND EMAIL ADDRESS:'.$emailAddress); + $message = preg_replace('/\[(.*?)\]\((.*?)\)/', "$1", $message); + $template = $this->mailer->createEMailTemplate(Application::APP_ID . '::sendMail'); + $template->setSubject($subject); + $template->addHeader(); + $template->addHeading($subject); + $this->setMailBody($template, $message); + $template->addFooter(); + + $email = $this->mailer->createMessage(); + $email->useTemplate($template); + $email->setTo([$emailAddress]); + + $this->mailer->send($email); + } + /** + * Special-treat list items and strip empty lines + * + * @param IEMailTemplate $template + * @param string $message + * + * @return void + */ + private function setMailBody(IEMailTemplate $template, string $message): void + { + $lines = explode("\n", $message); + $finalHtml = ""; + $finalText = ""; + foreach ($lines as $line) { + if (trim($line) === '') { + continue; + } + $finalHtml .= "

" . $line . "

"; + $finalText .= $line; + } + $template->addBodyText($finalHtml, $finalText); + } + /** + * validate user + * + * @param IUser $user + */ + private function isUserValid(?IUser $user): bool + { + if (!($user instanceof IUser)) { + return false; + } + $emailAddress = $user->getEMailAddress(); + return ($emailAddress && $user->isEnabled() && $this->mailer->validateMailAddress($emailAddress)); + } +} -- GitLab From b60a6eacbd52df75eaf62a7094941310ec162509 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 16:12:44 -0800 Subject: [PATCH 02/30] added service and background job --- .../WeeklyRecoveryNotificationJob.php | 37 ++--- lib/Service/NotificationService.php | 131 ++++++++++++++++++ 2 files changed, 143 insertions(+), 25 deletions(-) create mode 100644 lib/Service/NotificationService.php diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index 31ddfe0..1673f94 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -38,8 +38,7 @@ use OCP\Notification\INotification; use OCP\Notification\IManager as INotificationManager; use OCP\IURLGenerator; -class WeeklyRecoveryNotificationJob extends TimedJob -{ +class WeeklyRecoveryNotificationJob extends TimedJob { private IConfig $config; private IMailer $mailer; private LoggerInterface $logger; @@ -77,9 +76,8 @@ class WeeklyRecoveryNotificationJob extends TimedJob $this->urlGenerator = $urlGenerator; } - protected function run($argument): void - { - try { + protected function run($argument): void { + try { $users = $this->config->getUsersForUserValue(Application::APP_ID, 'recovery-email', ''); $this->prepareDataForUsers($users); @@ -98,8 +96,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob * @param array $users * */ - private function prepareDataForUsers(array $users): void - { + private function prepareDataForUsers(array $users): void { foreach ($users as $username) { $user = $this->userManager->get($username); if ($this->isUserValid($user)) { @@ -113,12 +110,11 @@ class WeeklyRecoveryNotificationJob extends TimedJob * * @return void */ - private function sendCloudNotifications(string $messageId): void - { + private function sendCloudNotifications(string $messageId): void { try { $datetime = $this->timeFactory->getDateTime(); $notification = $this->notificationManager->createNotification(); - $notificationType = 'important'; + $notificationType = 'warning'; $notification->setApp(Application::APP_ID) ->setDateTime($datetime) ->setObject(Application::APP_ID . '-' . strtolower($notificationType), $messageId) @@ -134,13 +130,9 @@ class WeeklyRecoveryNotificationJob extends TimedJob * @param INotification $notification * @param array $users */ - protected function sendNotificationToUsers(string $messageId, INotification $notification, array $users): void - { + protected function sendNotificationToUsers(string $messageId, INotification $notification, array $users): void { foreach ($users as $username) { $user = $this->userManager->get($username); - if (!($user instanceof IUser)) { - continue; - } $this->sendNotificationToUser($messageId, $user, $notification); $emailAddress = $user->getEMailAddress(); if ($emailAddress && $user->isEnabled()) { @@ -156,8 +148,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob * @param IUser $user * @param INotification $notification */ - protected function sendNotificationToUser(string $messageId, IUser $user, INotification $notification): void - { + protected function sendNotificationToUser(string $messageId, IUser $user, INotification $notification): void { try { $uid = $user->getUID(); $username = $user->getDisplayName(); @@ -172,8 +163,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob * * @return void */ - private function sendEmails(string $messageId): void - { + private function sendEmails(string $messageId): void { foreach ($this->uids as $uid) { try { $user = $this->userManager->get($uid); @@ -207,8 +197,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob * @param string $emailAddress * */ - private function sendEmail(string $subject, string $message, string $emailAddress) - { + private function sendEmail(string $subject, string $message, string $emailAddress) { $this->logger->error('RECOVERY EMAIL SEND SUBJECT:'.$subject); $this->logger->error('RECOVERY EMAIL SEND MESSAGE:'.$message); $this->logger->error('RECOVERY EMAIL SEND EMAIL ADDRESS:'.$emailAddress); @@ -234,8 +223,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob * * @return void */ - private function setMailBody(IEMailTemplate $template, string $message): void - { + private function setMailBody(IEMailTemplate $template, string $message): void { $lines = explode("\n", $message); $finalHtml = ""; $finalText = ""; @@ -253,8 +241,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob * * @param IUser $user */ - private function isUserValid(?IUser $user): bool - { + private function isUserValid(?IUser $user): bool { if (!($user instanceof IUser)) { return false; } diff --git a/lib/Service/NotificationService.php b/lib/Service/NotificationService.php new file mode 100644 index 0000000..376df29 --- /dev/null +++ b/lib/Service/NotificationService.php @@ -0,0 +1,131 @@ +l10nFactory = $l10nFactory; + } + + /** + * @param string $message + * @param string $username + */ + public function getParsedString(string $message, string $username) { + $richString = $message; + + $data = $this->prepareRichString($message, $richString, $username, 'url'); + $message = $data['message']; + $richString = $data['richString']; + + $data = $this->prepareRichString($message, $richString, $username, 'username'); + $message = $data['message']; + $richString = $data['richString']; + + $data = $this->prepareRichString($message, $richString, $username, 'bold'); + $message = $data['message']; + $richString = $data['richString']; + + return $this->assignVariables($message, $richString, $username); + } + /** + * @param string $message + * @param string $richString + * @param string $username + * @param string $type + */ + private function prepareRichString($message, $richString, $username, $type) { + switch ($type) { + case 'url': + $richString = preg_replace('/\[(.*?)\]\((.*?)\)/', '{$1[$2]}', $message); + break; + + case 'bold': + preg_match_all('#\*{2}(.*?)\*{2}#', $message, $matches); + if (sizeof($matches)) { + foreach ($matches[1] as $match) { + $richString = str_replace('**' . $match . '**', '{' . $match . '}', $richString); + $message = str_replace('**' . $match . '**', $match, $message); + } + } + break; + + case 'username': + $richString = str_replace('{username}', $username, $richString); + $message = str_replace('{username}', $username, $message); + break; + } + return ['message' => $message, 'richString' => $richString]; + } + /** + * @param string $message + * @param string $richString + * @param string $username + */ + private function assignVariables($message, $richString, $username) { + preg_match_all('/{(.*?)}/', $richString, $matches); + $messageParameters = []; + if (sizeof($matches)) { + foreach ($matches[1] as $key => $match) { + $result = $this->checkURL($match, $richString); + $link = $result['link']; + $match = $result['match']; + $richString = $result['richString']; + $matchKey = 'key_' . $key; + + $messageParameters[$matchKey] = + [ + 'type' => ($match === 'username') ? 'user' : 'highlight', + 'id' => '', + 'name' => ($match === 'username') ? $username : $match, + 'link' => isset($link) ? $link : '' + ]; + + $richString = str_replace($match, $matchKey, $richString); + } + } + $placeholders = $replacements = []; + foreach ($messageParameters as $placeholder => $parameter) { + $placeholders[] = '{' . $placeholder . '}'; + $replacements[] = $parameter['name']; + } + $message = str_replace($placeholders, $replacements, $message); + + return ['message' => $message, 'richString' => $richString, 'parameters' => $messageParameters]; + } + + /** + * @param string $match + * @param string $richString + */ + private function checkURL($match, $richString) { + preg_match('#\[(.*?)\]#', $match, $result); + $link = (sizeof($result)) ? $result[1] : ''; + + if (isset($link)) { + $match = str_replace('[' . $link . ']', '', $match); + $richString = str_replace('[' . $link . ']', '', $richString); + } + return ['link' => $link, 'match' => $match, 'richString' => $richString]; + } + + /** + * @param string $messageId + * @param string|null $language + */ + public function getTranslatedSubjectAndMessage(string $messageId, $language) { + if (is_null($language)) { + $language = 'en'; + } + $l = $this->l10nFactory->get(Application::APP_ID, $language); + return ['subject' => $l->t($messageId . '_subject'), 'message' => $l->t($messageId . '_body')]; + } +} -- GitLab From 67f8fbd429be8e37ff8999e5122661391782db03 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 16:14:33 -0800 Subject: [PATCH 03/30] added notified --- lib/Notification/Notifier.php | 112 ++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 lib/Notification/Notifier.php diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php new file mode 100644 index 0000000..2f9adda --- /dev/null +++ b/lib/Notification/Notifier.php @@ -0,0 +1,112 @@ + + * + * @author Joas Schilling + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\EmailRecovery\Notification; + +use OCP\L10N\IFactory; +use OCP\Notification\INotification; +use OCP\Notification\INotifier; +use OCA\EmailRecovery\AppInfo\Application; +use Psr\Log\LoggerInterface; +use OCA\EmailRecovery\Service\NotificationService; + +class Notifier implements INotifier { + /** @var IFactory */ + protected $l10nFactory; + /** @var LoggerInterface */ + private $logger; + + /** @var NotificationService */ + private $NotificationService; + + public function __construct( + IFactory $l10nFactory, + LoggerInterface $logger, + NotificationService $NotificationService + ) { + $this->l10nFactory = $l10nFactory; + $this->logger = $logger; + $this->NotificationService = $NotificationService; + } + + /** + * Identifier of the notifier, only use [a-z0-9_] + * + * @return string + * @since 17.0.0 + */ + public function getID(): string { + return Application::APP_ID; + } + + /** + * Human readable name describing the notifier + * + * @return string + * @since 17.0.0 + */ + public function getName(): string { + return $this->l10nFactory->get(Application::APP_ID)->t('Murena Notifications'); + } + + /** + * @param INotification $notification + * @param string $languageCode The code of the language that should be used to prepare the notification + * @return INotification + * @throws \InvalidArgumentException When the notification was not prepared by a notifier + */ + public function prepare(INotification $notification, string $languageCode): INotification { + if ($notification->getApp() !== Application::APP_ID) { + // Not my app => throw + throw new \InvalidArgumentException('Unknown app'); + } + try { + $subjectParams = $notification->getSubjectParameters(); + $messageId = $subjectParams[0]; + $username = $subjectParams[1]; + + $translations = $this->NotificationService->getTranslatedSubjectAndMessage($messageId, $languageCode); + $subject = $translations['subject']; + $message = $translations['message']; + + $parsedSubject = $this->NotificationService->getParsedString($subject, $username); + $subjectParameters = $parsedSubject['parameters']; + $plainSubject = $parsedSubject['message']; + $richSubject = $parsedSubject['richString']; + + $parsedMessage = $this->NotificationService->getParsedString($message, $username); + $messageParameters = $parsedMessage['parameters']; + $plainMessage = $parsedMessage['message']; + $richMessage = $parsedMessage['richString']; + + $notification->setParsedSubject($plainSubject)->setRichSubject($richSubject, $subjectParameters); + $notification->setParsedMessage($plainMessage)->setRichMessage($richMessage, $messageParameters); + + return $notification; + } catch (\Exception $e) { + throw new \InvalidArgumentException('Unknown app'); + } + } +} -- GitLab From 42564655f20dcbc1cf246db1fc9be5b242a6f32c Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 16:17:18 -0800 Subject: [PATCH 04/30] added notified --- appinfo/info.xml | 4 ++-- lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index 90d76ba..a0b67da 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -17,7 +17,7 @@ OCA\EmailRecovery\Settings\RecoveryEmailSettings - + diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index 1673f94..bfa000f 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -61,8 +61,8 @@ class WeeklyRecoveryNotificationJob extends TimedJob { ) { parent::__construct($timeFactory); - // $this->setInterval(2 * 60); // Run every 2 minutes - $this->setInterval(60 * 60 * 24); // Run once per day + $this->setInterval(1 * 60); // Run every 1 minutes + // $this->setInterval(60 * 60 * 24); // Run once per day // $this->setInterval(7 * 24 * 60 * 60); // Run for 7 days $this->setTimeSensitivity(self::TIME_INSENSITIVE); -- GitLab From 7c19e8ecbbc618951b34590264ca50366bfd7348 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 16:19:38 -0800 Subject: [PATCH 05/30] added notified --- lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index bfa000f..0e84c3d 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -134,13 +134,6 @@ class WeeklyRecoveryNotificationJob extends TimedJob { foreach ($users as $username) { $user = $this->userManager->get($username); $this->sendNotificationToUser($messageId, $user, $notification); - $emailAddress = $user->getEMailAddress(); - if ($emailAddress && $user->isEnabled()) { - if (!$this->mailer->validateMailAddress($emailAddress)) { - $this->logger->warning('User has no valid email address: ' . $user->getUID()); - return; - } - } } } /** -- GitLab From 7876ce8c2edcfde6a97f0debf456deb56d7c4551 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 16:30:28 -0800 Subject: [PATCH 06/30] notification loggers --- appinfo/info.xml | 2 +- lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index a0b67da..6076c77 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -19,5 +19,5 @@ OCA\EmailRecovery\BackgroundJob\WeeklyRecoveryNotificationJob - + diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index 0e84c3d..4b45d5b 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -61,7 +61,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob { ) { parent::__construct($timeFactory); - $this->setInterval(1 * 60); // Run every 1 minutes + $this->setInterval(2 * 60); // Run every 2 minutes // $this->setInterval(60 * 60 * 24); // Run once per day // $this->setInterval(7 * 24 * 60 * 60); // Run for 7 days $this->setTimeSensitivity(self::TIME_INSENSITIVE); @@ -77,6 +77,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob { } protected function run($argument): void { + $this->logger->error('WeeklyRecoveryNotificationJob running...'); try { $users = $this->config->getUsersForUserValue(Application::APP_ID, 'recovery-email', ''); $this->prepareDataForUsers($users); @@ -147,7 +148,9 @@ class WeeklyRecoveryNotificationJob extends TimedJob { $username = $user->getDisplayName(); $notification->setSubject('cli', [$messageId, $username])->setMessage('cli', [$messageId, $username])->setUser($uid); $this->notificationManager->notify($notification); + $this->logger->error('NOTIFICATION SENT TO '.$username. ' successfully.'); } catch (\Exception $e) { + $this->logger->error('NOTIFICATION ERROR WHILE SENDING. SEE BELOW:'); $this->logger->error($e->getMessage(), ['exception' => $e]); } } @@ -191,9 +194,6 @@ class WeeklyRecoveryNotificationJob extends TimedJob { * */ private function sendEmail(string $subject, string $message, string $emailAddress) { - $this->logger->error('RECOVERY EMAIL SEND SUBJECT:'.$subject); - $this->logger->error('RECOVERY EMAIL SEND MESSAGE:'.$message); - $this->logger->error('RECOVERY EMAIL SEND EMAIL ADDRESS:'.$emailAddress); $message = preg_replace('/\[(.*?)\]\((.*?)\)/', "$1", $message); $template = $this->mailer->createEMailTemplate(Application::APP_ID . '::sendMail'); $template->setSubject($subject); -- GitLab From c8aa836a0f43451768d3dff482eae956e91c6c89 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 16:34:04 -0800 Subject: [PATCH 07/30] registered notifier --- lib/AppInfo/Application.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index ca33cdf..d98ff3a 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -34,6 +34,8 @@ use OCA\EmailRecovery\Listeners\BeforeTemplateRenderedListener; use OCP\User\Events\UserConfigChangedEvent; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; +use OCP\Notification\IManager as INotificationManager; +use OCA\EmailRecovery\Notification\Notifier; class Application extends App implements IBootstrap { public const APP_ID = 'email-recovery'; @@ -47,5 +49,9 @@ class Application extends App implements IBootstrap { $context->registerEventListener(UserConfigChangedEvent::class, UserConfigChangedListener::class); } public function boot(IBootContext $context): void { + $context->injectFn([$this, 'registerNotifier']); + } + public function registerNotifier(INotificationManager $manager): void { + $manager->registerNotifierService(Notifier::class); } } -- GitLab From bebe4cb691fc7d106c98825b0d90b1048dbc18e3 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 16:34:33 -0800 Subject: [PATCH 08/30] registered notifier --- lib/Notification/Notifier.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 2f9adda..d71d5d9 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -68,7 +68,7 @@ class Notifier implements INotifier { * @since 17.0.0 */ public function getName(): string { - return $this->l10nFactory->get(Application::APP_ID)->t('Murena Notifications'); + return $this->l10nFactory->get(Application::APP_ID)->t('Email Recovery'); } /** -- GitLab From f82f32f4c7bc229dc10b1400036813bee2978291 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 16:48:45 -0800 Subject: [PATCH 09/30] change in interval --- l10n/de.json | 2 +- l10n/de_DE.json | 2 +- l10n/en.json | 2 +- l10n/es.json | 2 +- l10n/fr.json | 2 +- l10n/it.json | 2 +- lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/l10n/de.json b/l10n/de.json index 48d48f9..4d8661b 100644 --- a/l10n/de.json +++ b/l10n/de.json @@ -25,7 +25,7 @@ "Unverified recovery email:": "Nicht verifizierte Wiederherstellungs-E-Mail:", "Please set your recovery email address to use your email account without restrictions.": "Bitte geben Sie Ihre Wiederherstellungs-E-Mail-Adresse an, damit Sie Ihr E-Mail ohne Beschränkungen nutzen können.", "SET RECOVERY EMAIL NOW": "MEINE WIEDERHERSTELLUNGS-E-MAIL-ADRESSE ANGEBEN", - "20240101_weekly_reminder_subject": "Erforderliche Handlung: Geben Sie eine E-Mail-Adresse zur Wiederherstellung an", + "20240101_weekly_reminder_subject": "**Erforderliche Handlung: Geben Sie eine E-Mail-Adresse zur Wiederherstellung an**", "20240101_weekly_reminder_body": "Hallo **{username}**,\n\nAus Sicherheitsgründen müssen Sie eine Wiederherstellungs-E-Mail-Adresse für Ihr Murena Cloud-Konto angeben. Da Sie dies noch nicht getan haben, ist die Benutzung Ihrer E-Mail-Adresse eingeschränkt. Bitte geben Sie eine gültige E-Mail-Adresse zur Wiederherstellung an, damit die Nutzungsbeschränkungen Ihrer E-Mail-Adresse aufgehoben werden.\n\n[MEINE WIEDERHERSTELLUNGS-E-MAIL-ADRESSE ANGEBEN](https://murena.io/settings/user/security#recovery-email-form)" },"pluralForm" :"nplurals=2; plural=n != 1;" } \ No newline at end of file diff --git a/l10n/de_DE.json b/l10n/de_DE.json index c946b00..170d678 100644 --- a/l10n/de_DE.json +++ b/l10n/de_DE.json @@ -23,7 +23,7 @@ "Could not verify recovery email because the token is expired": "Wiederherstellungs-E-Mail konnte nicht verifiziert werden, da das Token abgelaufen ist", "Could not verify recovery email because the token is invalid": "Wiederherstellungs-E-Mail konnte nicht verifiziert werden, da das Token ungültig ist", "Unverified recovery email:": "Nicht verifizierte Wiederherstellungs-E-Mail:", - "20240101_weekly_reminder_subject": "Erforderliche Handlung: Geben Sie eine E-Mail-Adresse zur Wiederherstellung an", + "20240101_weekly_reminder_subject": "**Erforderliche Handlung: Geben Sie eine E-Mail-Adresse zur Wiederherstellung an**", "20240101_weekly_reminder_body": "Hallo **{username}**,\n\nAus Sicherheitsgründen müssen Sie eine Wiederherstellungs-E-Mail-Adresse für Ihr Murena Cloud-Konto angeben. Da Sie dies noch nicht getan haben, ist die Benutzung Ihrer E-Mail-Adresse eingeschränkt. Bitte geben Sie eine gültige E-Mail-Adresse zur Wiederherstellung an, damit die Nutzungsbeschränkungen Ihrer E-Mail-Adresse aufgehoben werden.\n\n[MEINE WIEDERHERSTELLUNGS-E-MAIL-ADRESSE ANGEBEN](https://murena.io/settings/user/security#recovery-email-form)" },"pluralForm" :"nplurals=2; plural=n != 1;" } \ No newline at end of file diff --git a/l10n/en.json b/l10n/en.json index 675badb..b4b133a 100644 --- a/l10n/en.json +++ b/l10n/en.json @@ -24,7 +24,7 @@ "Unverified recovery email:": "Unverified recovery email:", "Please set your recovery email address to use your email account without restrictions.": "Please set your recovery email address to use your email account without restrictions.", "SET RECOVERY EMAIL NOW": "SET RECOVERY EMAIL NOW", - "20240101_weekly_reminder_subject": "Action required: Set up your recovery email", + "20240101_weekly_reminder_subject": "**Action required: Set up your recovery email**", "20240101_weekly_reminder_body": "Dear **{username}**,\n\nFor security reasons you need to set a recovery email address for your Murena Cloud account. As you haven't done so yet, the usage of your email address is restricted. Please set and validate a recovery email address to remove all usage restriction on your email address.\n\n[SET MY RECOVERY EMAIL ADDRESS](https://murena.io/settings/user/security#recovery-email-form)" }, "pluralForm": "nplurals=2; plural=(n != 1);" diff --git a/l10n/es.json b/l10n/es.json index 497f64b..e6c4d6d 100644 --- a/l10n/es.json +++ b/l10n/es.json @@ -25,7 +25,7 @@ "Unverified recovery email:": "Correo electrónico de recuperación no verificado:", "Please set your recovery email address to use your email account without restrictions.": "Configura tu dirección de correo electrónico de recuperación para utilizar tu cuenta de correo electrónico sin restricciones.", "SET RECOVERY EMAIL NOW": "CONFIGURAR CORREO ELECTRÓNICO DE RECUPERACIÓN", - "20240101_weekly_reminder_subject": "Acción necesaria: Configura tu correo electrónico de recuperación", + "20240101_weekly_reminder_subject": "**Acción necesaria: Configura tu correo electrónico de recuperación**", "20240101_weekly_reminder_body": "Estimado **{username}**,\n\nPor motivos de seguridad, debes proveer una dirección de email de recuperación para tu cuenta Murena Cloud. Como aún no lo haz hecho, el uso de tu dirección de correo electrónico está restringido. Configura y confirma una dirección de correo alternativa de recuperación para eliminar todas las restricciones de uso de tu correo Murena.\n\n[CONFIGURAR DIRECCIÓN DE EMAIL DE RECUPERACIÓN](https://murena.io/settings/user/security#recovery-email-form)" },"pluralForm" :"nplurals=2; plural=n != 1;" } \ No newline at end of file diff --git a/l10n/fr.json b/l10n/fr.json index 5f698d9..46ad294 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -25,7 +25,7 @@ "Unverified recovery email:": "Courriel de récupération non vérifié :", "Please set your recovery email address to use your email account without restrictions.": "Merci de définir une adresse e-mail de récupération pour bénéficier d'un usage de votre compte sans restrictions.", "SET RECOVERY EMAIL NOW": "DEFINIR L'ADRESSE DE RECUPERATION MAINTENANT", - "20240101_weekly_reminder_subject": "Action requise: Définissez votre adresse de récupération", + "20240101_weekly_reminder_subject": "**Action requise: Définissez votre adresse de récupération**", "20240101_weekly_reminder_body": "Cher/Chère **{username}**,\n\nPour des raisons de sécurité, vous devez définir une adresse de récupération pour votre compte Murena Cloud. Comme vous ne l'avez pas encore fait, votre utilisation de votre adresse e-mail est restreinte. Merci de définir et valider un adresse e-mail de récupération pour que toutes les restrictions en place sur votre adresse e-mail puissent être levées.\n\n[DEFINIR MON ADRESSE DE RECUPERATION](https://murena.io/settings/user/security#recovery-email-form)" },"pluralForm" :"nplurals=2; plural=n > 1;" } \ No newline at end of file diff --git a/l10n/it.json b/l10n/it.json index 3237810..c7e7a4d 100644 --- a/l10n/it.json +++ b/l10n/it.json @@ -25,7 +25,7 @@ "Unverified recovery email:": "Email di recupero non verificata:", "Please set your recovery email address to use your email account without restrictions.": "Per poter usare l'account email senza restrizioni devi impostare l'indirizzo email di recovery.", "SET RECOVERY EMAIL NOW": "IMPOSTA ADESSO LA EMAIL DI RECOVERY", - "20240101_weekly_reminder_subject": "Azione richiesta: imposta un indirizzo email di recovery", + "20240101_weekly_reminder_subject": "**Azione richiesta: imposta un indirizzo email di recovery**", "20240101_weekly_reminder_body": "Caro **{username}**,\n\nPer ragioni di sicurezza, devi impostrare un indirizzo email di recovery per il tuo account Murena Cloud. Dato che non l'hai ancora fatto, l'uso del tuo indirizzo email è stato attualmente limitato. Per rimuovere tutte le limitazioni dovresti impostare e validare una email di recovery.\n\n[IMPOSTA L'INDIRIZZO E-MAIL DI RECOVERY](https://murena.io/settings/user/security#recovery-email-form)" },"pluralForm" :"nplurals=2; plural=n != 1;" } \ No newline at end of file diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index 4b45d5b..1e83ef5 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -61,8 +61,8 @@ class WeeklyRecoveryNotificationJob extends TimedJob { ) { parent::__construct($timeFactory); - $this->setInterval(2 * 60); // Run every 2 minutes - // $this->setInterval(60 * 60 * 24); // Run once per day + // $this->setInterval(2 * 60); // Run every 2 minutes + $this->setInterval(60 * 60 * 24); // Run once per day // $this->setInterval(7 * 24 * 60 * 60); // Run for 7 days $this->setTimeSensitivity(self::TIME_INSENSITIVE); -- GitLab From 9b050d8a4f2ee97860b72bf4c5c3446179ad11e5 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 16:53:34 -0800 Subject: [PATCH 10/30] added button css --- scss/email-recovery.scss | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index 4fbf9ae..f690262 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -102,3 +102,12 @@ body#body-public #header { top:186px; } } +[data-object-type="email-recovery-warning"] a.external { + padding: 10px 12px; + border-radius: 15px; + background-color: var(--color-primary-element); + color: var(--color-primary-element-text); + text-decoration: none; + font-size: 12px; + font-weight: bold; +} -- GitLab From 15930c1a744cc59cfc359a24d5217a3fe7f6d085 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 17:08:00 -0800 Subject: [PATCH 11/30] added button css --- scss/email-recovery.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index f690262..064b9a6 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -104,7 +104,7 @@ body#body-public #header { } [data-object-type="email-recovery-warning"] a.external { padding: 10px 12px; - border-radius: 15px; + border-radius: 22px; background-color: var(--color-primary-element); color: var(--color-primary-element-text); text-decoration: none; -- GitLab From ea361540cb9feed38ec9dff9904ca81ae07b70fb Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 21:59:17 -0800 Subject: [PATCH 12/30] rename to prepareValidUserIds --- lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index 1e83ef5..0b95965 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -80,7 +80,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob { $this->logger->error('WeeklyRecoveryNotificationJob running...'); try { $users = $this->config->getUsersForUserValue(Application::APP_ID, 'recovery-email', ''); - $this->prepareDataForUsers($users); + $this->prepareValidUserIds($users); $messageId = $this->config->getSystemValue('weekly_reminder_messageid'); $this->sendCloudNotifications($messageId); @@ -97,7 +97,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob { * @param array $users * */ - private function prepareDataForUsers(array $users): void { + private function prepareValidUserIds(array $users): void { foreach ($users as $username) { $user = $this->userManager->get($username); if ($this->isUserValid($user)) { -- GitLab From e7ee8706a08d4a269a5e8728861ac7bb5051e036 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 22:00:28 -0800 Subject: [PATCH 13/30] removed continue --- lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index 0b95965..2ae675a 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -180,7 +180,6 @@ class WeeklyRecoveryNotificationJob extends TimedJob { $this->logger->error('RECOVERY EMAIL NOTIFICATION-EMAIL SEND TO :'.$emailAddress); } catch (\Exception $e) { $this->logger->error('Error sending notification email to user ' . $uid, ['exception' => $e]); - continue; } } } -- GitLab From 8e57a91d9072af8c65377938989ccc8fb81de75f Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 22:01:11 -0800 Subject: [PATCH 14/30] removed logger --- lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index 2ae675a..e6a04c6 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -77,7 +77,6 @@ class WeeklyRecoveryNotificationJob extends TimedJob { } protected function run($argument): void { - $this->logger->error('WeeklyRecoveryNotificationJob running...'); try { $users = $this->config->getUsersForUserValue(Application::APP_ID, 'recovery-email', ''); $this->prepareValidUserIds($users); -- GitLab From 263cffa7bd95004de75bb51a764b10057882d9a4 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 22:03:16 -0800 Subject: [PATCH 15/30] added debug --- lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index e6a04c6..f625c69 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -100,7 +100,6 @@ class WeeklyRecoveryNotificationJob extends TimedJob { foreach ($users as $username) { $user = $this->userManager->get($username); if ($this->isUserValid($user)) { - $this->logger->error('valid email address : ' . $user->getUID()); array_push($this->uids, $user->getUID()); } } @@ -147,9 +146,8 @@ class WeeklyRecoveryNotificationJob extends TimedJob { $username = $user->getDisplayName(); $notification->setSubject('cli', [$messageId, $username])->setMessage('cli', [$messageId, $username])->setUser($uid); $this->notificationManager->notify($notification); - $this->logger->error('NOTIFICATION SENT TO '.$username. ' successfully.'); + $this->logger->debug('Notificaiton sent to '.$username. ' successfully.'); } catch (\Exception $e) { - $this->logger->error('NOTIFICATION ERROR WHILE SENDING. SEE BELOW:'); $this->logger->error($e->getMessage(), ['exception' => $e]); } } @@ -176,7 +174,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob { $message = $parsedMessage['message']; $this->sendEmail($subject, $message, $emailAddress); - $this->logger->error('RECOVERY EMAIL NOTIFICATION-EMAIL SEND TO :'.$emailAddress); + $this->logger->debug('Recovery email sent to '.$emailAddress.' successfully.'); } catch (\Exception $e) { $this->logger->error('Error sending notification email to user ' . $uid, ['exception' => $e]); } -- GitLab From 9b00ec87eeca6a943874489864f33bba965d786f Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 22:05:48 -0800 Subject: [PATCH 16/30] prepareValidUserIds response change --- lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index f625c69..a59efaf 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -78,9 +78,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob { protected function run($argument): void { try { - $users = $this->config->getUsersForUserValue(Application::APP_ID, 'recovery-email', ''); - $this->prepareValidUserIds($users); - + $this->prepareValidUserIds(); $messageId = $this->config->getSystemValue('weekly_reminder_messageid'); $this->sendCloudNotifications($messageId); $this->sendEmails($messageId); @@ -93,10 +91,10 @@ class WeeklyRecoveryNotificationJob extends TimedJob { /** * Prepare user data and store it to `uids` * - * @param array $users * */ - private function prepareValidUserIds(array $users): void { + private function prepareValidUserIds(): void { + $users = $this->config->getUsersForUserValue(Application::APP_ID, 'recovery-email', ''); foreach ($users as $username) { $user = $this->userManager->get($username); if ($this->isUserValid($user)) { -- GitLab From 953bb7d0e53027a06ba0152d5954cb926e9c7879 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 26 Dec 2023 22:12:31 -0800 Subject: [PATCH 17/30] weeklyrecoverynotification job --- .../WeeklyRecoveryNotificationJob.php | 53 ++++++++++++------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index a59efaf..2753d43 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -89,9 +89,8 @@ class WeeklyRecoveryNotificationJob extends TimedJob { } /** - * Prepare user data and store it to `uids` - * - * + * Prepares valid user IDs and stores them in the 'uids' array. + * @return void */ private function prepareValidUserIds(): void { $users = $this->config->getUsersForUserValue(Application::APP_ID, 'recovery-email', ''); @@ -103,7 +102,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob { } } /** - * Send emails to all users + * Send cloud notification to users * * @return void */ @@ -123,9 +122,13 @@ class WeeklyRecoveryNotificationJob extends TimedJob { } } /** - * @param string $messageId - * @param INotification $notification - * @param array $users + * Sends a notification with the specified messageId and notification object to a list of users. + * + * @param string $messageId The identifier for the notification message. + * @param INotification $notification The notification object to be sent. + * @param array $users An array of usernames to whom the notification will be sent. + * + * @return void */ protected function sendNotificationToUsers(string $messageId, INotification $notification, array $users): void { foreach ($users as $username) { @@ -134,9 +137,13 @@ class WeeklyRecoveryNotificationJob extends TimedJob { } } /** - * @param string $messageId - * @param IUser $user - * @param INotification $notification + * Sends a notification with the specified messageId and notification object to a user. + * + * @param string $messageId The identifier for the notification message. + * @param IUser $user The user to whom the notification will be sent. + * @param INotification $notification The notification object to be sent. + * + * @return void */ protected function sendNotificationToUser(string $messageId, IUser $user, INotification $notification): void { try { @@ -144,13 +151,15 @@ class WeeklyRecoveryNotificationJob extends TimedJob { $username = $user->getDisplayName(); $notification->setSubject('cli', [$messageId, $username])->setMessage('cli', [$messageId, $username])->setUser($uid); $this->notificationManager->notify($notification); - $this->logger->debug('Notificaiton sent to '.$username. ' successfully.'); + $this->logger->debug('Notificaiton sent to ' . $username . ' successfully.'); } catch (\Exception $e) { $this->logger->error($e->getMessage(), ['exception' => $e]); } } /** - * Send emails to all users + * Sends recovery emails to all users. + * + * @param string $messageId The identifier for the notification message. * * @return void */ @@ -172,7 +181,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob { $message = $parsedMessage['message']; $this->sendEmail($subject, $message, $emailAddress); - $this->logger->debug('Recovery email sent to '.$emailAddress.' successfully.'); + $this->logger->debug('Recovery email sent to ' . $emailAddress . ' successfully.'); } catch (\Exception $e) { $this->logger->error('Error sending notification email to user ' . $uid, ['exception' => $e]); } @@ -180,14 +189,16 @@ class WeeklyRecoveryNotificationJob extends TimedJob { } /** - * Send an Email + * Send an email. * - * @param string $subject - * @param string $message - * @param string $emailAddress + * @param string $subject The subject of the email. + * @param string $message The body/content of the email. + * @param string $emailAddress The recipient's email address. * + * @return void */ - private function sendEmail(string $subject, string $message, string $emailAddress) { + private function sendEmail(string $subject, string $message, string $emailAddress): void { + // Convert Markdown-style links to HTML anchor tags $message = preg_replace('/\[(.*?)\]\((.*?)\)/', "$1", $message); $template = $this->mailer->createEMailTemplate(Application::APP_ID . '::sendMail'); $template->setSubject($subject); @@ -224,9 +235,11 @@ class WeeklyRecoveryNotificationJob extends TimedJob { $template->addBodyText($finalHtml, $finalText); } /** - * validate user + * Validate a user. + * + * @param IUser|null $user The user to be validated. * - * @param IUser $user + * @return bool Returns true if the user is valid, false otherwise. */ private function isUserValid(?IUser $user): bool { if (!($user instanceof IUser)) { -- GitLab From 77c2e3fbea1bef976faa0d363f3122efc11d6c13 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 27 Dec 2023 21:15:03 -0800 Subject: [PATCH 18/30] change as per feedback --- .../WeeklyRecoveryNotificationJob.php | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index 2753d43..c4a456d 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -118,7 +118,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob { $this->sendNotificationToUsers($messageId, $notification, $this->uids); } catch (\Exception $e) { - $this->logger->error('Error sending notification email to user', ['exception' => $e]); + $this->logger->error('Error sending cloud notifications. Error:' . $e->getMessage(), ['exception' => $e]); } } /** @@ -132,8 +132,12 @@ class WeeklyRecoveryNotificationJob extends TimedJob { */ protected function sendNotificationToUsers(string $messageId, INotification $notification, array $users): void { foreach ($users as $username) { - $user = $this->userManager->get($username); - $this->sendNotificationToUser($messageId, $user, $notification); + try { + $user = $this->userManager->get($username); + $this->sendNotificationToUser($messageId, $user, $notification); + } catch (\Exception $e) { + $this->logger->error('Error while sending notification. Error:' . $e->getMessage(), ['exception' => $e]); + } } } /** @@ -146,14 +150,14 @@ class WeeklyRecoveryNotificationJob extends TimedJob { * @return void */ protected function sendNotificationToUser(string $messageId, IUser $user, INotification $notification): void { + $uid = $user->getUID(); + $displayName = $user->getDisplayName(); try { - $uid = $user->getUID(); - $username = $user->getDisplayName(); - $notification->setSubject('cli', [$messageId, $username])->setMessage('cli', [$messageId, $username])->setUser($uid); + $notification->setSubject('cli', [$messageId, $displayName])->setMessage('cli', [$messageId, $displayName])->setUser($uid); $this->notificationManager->notify($notification); - $this->logger->debug('Notificaiton sent to ' . $username . ' successfully.'); + $this->logger->debug('Notificaiton sent to ' . $uid . ' successfully.'); } catch (\Exception $e) { - $this->logger->error($e->getMessage(), ['exception' => $e]); + $this->logger->error('Failed to send notification to ' . $uid . '. Error:' . $e->getMessage(), ['exception' => $e]); } } /** @@ -183,7 +187,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob { $this->sendEmail($subject, $message, $emailAddress); $this->logger->debug('Recovery email sent to ' . $emailAddress . ' successfully.'); } catch (\Exception $e) { - $this->logger->error('Error sending notification email to user ' . $uid, ['exception' => $e]); + $this->logger->error('Error sending notification email to user ' . $uid.'. Error:' . $e->getMessage(), ['exception' => $e]); } } } -- GitLab From 5312bd2464f6d8786cb39caf70ac63e7ee9cc69c Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 27 Dec 2023 21:19:43 -0800 Subject: [PATCH 19/30] run in two minutes --- lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index c4a456d..dceccac 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -61,8 +61,8 @@ class WeeklyRecoveryNotificationJob extends TimedJob { ) { parent::__construct($timeFactory); - // $this->setInterval(2 * 60); // Run every 2 minutes - $this->setInterval(60 * 60 * 24); // Run once per day + $this->setInterval(2 * 60); // Run every 2 minutes + // $this->setInterval(60 * 60 * 24); // Run once per day // $this->setInterval(7 * 24 * 60 * 60); // Run for 7 days $this->setTimeSensitivity(self::TIME_INSENSITIVE); -- GitLab From 913f4ea527dc92506b433da30ce2131d0b116401 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Wed, 27 Dec 2023 21:36:16 -0800 Subject: [PATCH 20/30] changes --- lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index dceccac..0ea5f16 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -61,9 +61,9 @@ class WeeklyRecoveryNotificationJob extends TimedJob { ) { parent::__construct($timeFactory); - $this->setInterval(2 * 60); // Run every 2 minutes + // $this->setInterval(2 * 60); // Run every 2 minutes // $this->setInterval(60 * 60 * 24); // Run once per day - // $this->setInterval(7 * 24 * 60 * 60); // Run for 7 days + $this->setInterval(7 * 24 * 60 * 60); // Run for 7 days $this->setTimeSensitivity(self::TIME_INSENSITIVE); $this->config = $config; @@ -118,7 +118,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob { $this->sendNotificationToUsers($messageId, $notification, $this->uids); } catch (\Exception $e) { - $this->logger->error('Error sending cloud notifications. Error:' . $e->getMessage(), ['exception' => $e]); + $this->logger->error('Error sending recovery email cloud notifications to users. Error:' . $e->getMessage(), ['exception' => $e]); } } /** @@ -136,7 +136,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob { $user = $this->userManager->get($username); $this->sendNotificationToUser($messageId, $user, $notification); } catch (\Exception $e) { - $this->logger->error('Error while sending notification. Error:' . $e->getMessage(), ['exception' => $e]); + $this->logger->error('Error sending recovery email cloud notifications to users. Error:' . $e->getMessage(), ['exception' => $e]); } } } -- GitLab From c43c5d99f167e491ef523c65323008e2753999ea Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 28 Dec 2023 11:04:17 -0800 Subject: [PATCH 21/30] font size --- scss/email-recovery.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index 064b9a6..fc22ba9 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -108,6 +108,8 @@ body#body-public #header { background-color: var(--color-primary-element); color: var(--color-primary-element-text); text-decoration: none; - font-size: 12px; + font-size: calc(21px - 1vw); font-weight: bold; + white-space: nowrap; + } -- GitLab From 21924dbfcec9df8632e14769560b150a25a781ca Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 28 Dec 2023 11:04:57 -0800 Subject: [PATCH 22/30] font size --- scss/email-recovery.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index fc22ba9..a3082f1 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -111,5 +111,4 @@ body#body-public #header { font-size: calc(21px - 1vw); font-weight: bold; white-space: nowrap; - } -- GitLab From d951a84c616a5a73d63247ac800571885507af4a Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 28 Dec 2023 11:13:51 -0800 Subject: [PATCH 23/30] resolved issue --- scss/email-recovery.scss | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index a3082f1..98ffa40 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -102,13 +102,16 @@ body#body-public #header { top:186px; } } -[data-object-type="email-recovery-warning"] a.external { - padding: 10px 12px; - border-radius: 22px; +[data-object-type=email-recovery-warning] a.external { background-color: var(--color-primary-element); color: var(--color-primary-element-text); text-decoration: none; - font-size: calc(21px - 1vw); + padding: 10px 12px; + border-radius: 22px; + display: block; + text-align: center; + padding: 10px 12px; + border-radius: 22px; + font-size: 12px; font-weight: bold; - white-space: nowrap; } -- GitLab From 5eff2b48097e2f584eb4bfa4230b9f65bbdef5ff Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 28 Dec 2023 11:18:33 -0800 Subject: [PATCH 24/30] resolved issue --- img/important.svg | 9 +++++++++ lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 2 +- scss/email-recovery.scss | 6 ++---- 3 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 img/important.svg diff --git a/img/important.svg b/img/important.svg new file mode 100644 index 0000000..d2ec0fd --- /dev/null +++ b/img/important.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index 0ea5f16..3f4b94a 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -110,7 +110,7 @@ class WeeklyRecoveryNotificationJob extends TimedJob { try { $datetime = $this->timeFactory->getDateTime(); $notification = $this->notificationManager->createNotification(); - $notificationType = 'warning'; + $notificationType = 'important'; $notification->setApp(Application::APP_ID) ->setDateTime($datetime) ->setObject(Application::APP_ID . '-' . strtolower($notificationType), $messageId) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index 98ffa40..a0b16fb 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -102,16 +102,14 @@ body#body-public #header { top:186px; } } -[data-object-type=email-recovery-warning] a.external { +[data-object-type=email-recovery-important] a.external { background-color: var(--color-primary-element); color: var(--color-primary-element-text); text-decoration: none; - padding: 10px 12px; - border-radius: 22px; display: block; text-align: center; padding: 10px 12px; - border-radius: 22px; + border-radius: 30px; font-size: 12px; font-weight: bold; } -- GitLab From 535fdb64b28cc6cfc279cb85a3616dad0fa1d7f8 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 28 Dec 2023 11:23:11 -0800 Subject: [PATCH 25/30] resolved issue --- scss/email-recovery.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index a0b16fb..e707788 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -102,7 +102,7 @@ body#body-public #header { top:186px; } } -[data-object-type=email-recovery-important] a.external { +[data-object-type=email-recovery-warning] a.external { background-color: var(--color-primary-element); color: var(--color-primary-element-text); text-decoration: none; -- GitLab From 2095331f9b1cb79925cc841c4a9e0878e7870edb Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 28 Dec 2023 11:25:54 -0800 Subject: [PATCH 26/30] resolved issue --- lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index 3f4b94a..2f4866d 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -61,9 +61,9 @@ class WeeklyRecoveryNotificationJob extends TimedJob { ) { parent::__construct($timeFactory); - // $this->setInterval(2 * 60); // Run every 2 minutes + $this->setInterval(2 * 60); // Run every 2 minutes // $this->setInterval(60 * 60 * 24); // Run once per day - $this->setInterval(7 * 24 * 60 * 60); // Run for 7 days + // $this->setInterval(7 * 24 * 60 * 60); // Run for 7 days $this->setTimeSensitivity(self::TIME_INSENSITIVE); $this->config = $config; -- GitLab From f61811d890dd87c3578c426b9d17fc9cb03fc4e6 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 28 Dec 2023 11:26:21 -0800 Subject: [PATCH 27/30] added important --- scss/email-recovery.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index e707788..a0b16fb 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -102,7 +102,7 @@ body#body-public #header { top:186px; } } -[data-object-type=email-recovery-warning] a.external { +[data-object-type=email-recovery-important] a.external { background-color: var(--color-primary-element); color: var(--color-primary-element-text); text-decoration: none; -- GitLab From 732b7e5771e0cb2f36a0a4ef9b00fd2fe6f2f0e4 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 28 Dec 2023 11:43:40 -0800 Subject: [PATCH 28/30] email recovery important --- scss/email-recovery.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index a0b16fb..6683562 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -102,7 +102,7 @@ body#body-public #header { top:186px; } } -[data-object-type=email-recovery-important] a.external { +[data-object-type="email-recovery-important"] a.external { background-color: var(--color-primary-element); color: var(--color-primary-element-text); text-decoration: none; -- GitLab From 1665e9031ea3db43393ba830377f6ce47470415b Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 28 Dec 2023 11:48:11 -0800 Subject: [PATCH 29/30] widthfit contnet --- scss/email-recovery.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/scss/email-recovery.scss b/scss/email-recovery.scss index 6683562..40e8175 100644 --- a/scss/email-recovery.scss +++ b/scss/email-recovery.scss @@ -112,4 +112,5 @@ body#body-public #header { border-radius: 30px; font-size: 12px; font-weight: bold; + width: fit-content; } -- GitLab From 53193029d5c1b19ac0d2d9a14d02d210539f762d Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Thu, 28 Dec 2023 11:50:28 -0800 Subject: [PATCH 30/30] 7 days --- lib/BackgroundJob/WeeklyRecoveryNotificationJob.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php index 2f4866d..3f4b94a 100644 --- a/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php +++ b/lib/BackgroundJob/WeeklyRecoveryNotificationJob.php @@ -61,9 +61,9 @@ class WeeklyRecoveryNotificationJob extends TimedJob { ) { parent::__construct($timeFactory); - $this->setInterval(2 * 60); // Run every 2 minutes + // $this->setInterval(2 * 60); // Run every 2 minutes // $this->setInterval(60 * 60 * 24); // Run once per day - // $this->setInterval(7 * 24 * 60 * 60); // Run for 7 days + $this->setInterval(7 * 24 * 60 * 60); // Run for 7 days $this->setTimeSensitivity(self::TIME_INSENSITIVE); $this->config = $config; -- GitLab