From ad0da2ae38f3be49915241de421dc831258f1de1 Mon Sep 17 00:00:00 2001 From: Jan Christoph Bernack Date: Wed, 10 May 2023 22:50:13 +0200 Subject: [PATCH] squashed and cleaned changes of aquafree release v2.5 --- .../service/mail/DefaultMailService.java | 16 + .../main/resources/i18n/messages.properties | 16 +- .../resources/templates/account.activated.ftl | 528 +++++++++++--- .../resources/templates/account.lockout.ftl | 518 +++++++++++--- .../main/resources/templates/activation.ftl | 658 +++++++++++++++--- .../templates/password.was.reset.ftl | 583 +++++++++++++--- .../resources/templates/reset.password.ftl | 531 +++++++++++--- 7 files changed, 2351 insertions(+), 499 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/mail/DefaultMailService.java b/application/src/main/java/org/thingsboard/server/service/mail/DefaultMailService.java index f433066c06a..0ab19f7e537 100644 --- a/application/src/main/java/org/thingsboard/server/service/mail/DefaultMailService.java +++ b/application/src/main/java/org/thingsboard/server/service/mail/DefaultMailService.java @@ -56,6 +56,8 @@ import java.util.Properties; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; @Service @Slf4j @@ -199,8 +201,19 @@ public void sendActivationEmail(String activationLink, String email) throws Thin String subject = messages.getMessage("activation.subject", null, Locale.US); + String activationToken = null; + Pattern activationTokenPattern = Pattern.compile("\\?activateToken=(.*)"); + Matcher activationTokenPatternMatcher = activationTokenPattern.matcher(activationLink); + + while(activationTokenPatternMatcher.find()) { + activationToken = activationTokenPatternMatcher.group(1); + System.out.println("found token: " + activationToken); + } + + Map model = new HashMap<>(); model.put("activationLink", activationLink); + model.put("activationToken", activationToken); model.put(TARGET_EMAIL, email); String message = mergeTemplateIntoString("activation.ftl", model); @@ -227,8 +240,11 @@ public void sendResetPasswordEmail(String passwordResetLink, String email) throw String subject = messages.getMessage("reset.password.subject", null, Locale.US); + String currentResetPasswordToken = passwordResetLink.split("=")[1]; + Map model = new HashMap<>(); model.put("passwordResetLink", passwordResetLink); + model.put("passwordResetToken", currentResetPasswordToken); model.put(TARGET_EMAIL, email); String message = mergeTemplateIntoString("reset.password.ftl", model); diff --git a/application/src/main/resources/i18n/messages.properties b/application/src/main/resources/i18n/messages.properties index 36ad9597dd8..614bf28789d 100644 --- a/application/src/main/resources/i18n/messages.properties +++ b/application/src/main/resources/i18n/messages.properties @@ -1,8 +1,8 @@ -test.message.subject=Test message from [Rocknitive] Suite -activation.subject=[Rocknitive] Account-Aktivierung -account.activated.subject=[Rocknitive] - Account wurde aktiviert -reset.password.subject=[Rocknitive] - Zurücksetzen des Passworts angefragt -password.was.reset.subject=[Rocknitive] - Passwort wurde zurückgesetzt -account.lockout.subject=[Rocknitive] - Account wurde gesperrt -api.usage.state=[Rocknitive] - Account limits -2fa.verification.code.subject=[Rocknitive] - 2FA verification code +test.message.subject=Test message from [HyGenius] Suite +activation.subject=[HyGenius] Account-Aktivierung +account.activated.subject=[HyGenius] - Account wurde aktiviert +reset.password.subject=[HyGenius] - Zurücksetzen des Passworts angefragt +password.was.reset.subject=[HyGenius] - Passwort wurde zurückgesetzt +account.lockout.subject=[HyGenius] - Account wurde gesperrt +api.usage.state=[HyGenius] - Account limits +2fa.verification.code.subject=[HyGenius] - 2FA verification code diff --git a/application/src/main/resources/templates/account.activated.ftl b/application/src/main/resources/templates/account.activated.ftl index 3644de502ba..58a4390b381 100644 --- a/application/src/main/resources/templates/account.activated.ftl +++ b/application/src/main/resources/templates/account.activated.ftl @@ -18,107 +18,435 @@ - - -Rocknitive Suite - Zugang aktiviert - - - + + + + + + + + + + +
+
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + +
+
+
+ [Eine deutsche Version dieser E-Mail finden Sie weiter unten] +
+
+
+
+ + + + + + +
+ +
+ + + + + + +
+

Congratulations! You HyGenius account was activated.

+
+
+
+ + + + + + +
+
+
+ Login into your HyGenius application to get started!
+
+
+
+ +
+
+ +
+
+
+
+ + + + + + +
+
+
Until next time!
+
+
+ Your Aqua free Team +
+
+
+
+
+
+ Do you have questions? Please contact support@aqua-free.com +
+
+
+
+ + + + + + +
+
+ + + + + + +
+ + + + + + +
+
+ + + + + + +
+

+ Herzlichen Glückwunsch! Ihr HyGenius Zugang wurde aktiviert.

+
+
+
+ + + + + + +
+
+
+ Sie könne sich nun an der HyGenius App anmelden.
+
+
+
- - - - - - -
-
- - -
- - - - - - - - - - - - - - - -
-

Ihr Rocknitive Suite Zugang wurde aktiviert

-
- Herzlichen Glückwunsch! Ihr Rocknitive Suite Zugang wurde aktiviert. -
- Sie können sich nun an der Rocknitive Suite anmelden. -
- -
- — The Rocknitive Suite -
- -
-
+
+
+ +
+
+
+
+ + + + + + +
+
+
+ Bis zum nächsten Mal! +
+
+
+
+ Ihr Aqua free Team +
+
+
+
+
+
+ Fragen? Kontaktiere support@aqua-free.com +
+
+
+
+
+ +
+
+
+
+
diff --git a/application/src/main/resources/templates/account.lockout.ftl b/application/src/main/resources/templates/account.lockout.ftl index b35236f5aa1..f3a52c3ff63 100644 --- a/application/src/main/resources/templates/account.lockout.ftl +++ b/application/src/main/resources/templates/account.lockout.ftl @@ -18,97 +18,435 @@ - - -Thingsboard - Account Lockout - - - + + + + + + + + + + +
+
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + +
+
+
+ [Eine deutsche Version dieser E-Mail finden Sie weiter unten] +
+
+
+
+ + + + + + +
+ +
+ + + + + + +
+

User account $lockoutAccount has been locked.

+
+
+
+ + + + + + +
+
+
+ Your HyGenius account $lockoutAccount has been locked out due to failed credentials were provided more than $maxFailedLoginAttempts times.
+
+
+
+ +
+
+ This email was sent to $targetEmail by HyGenius +
+
+
+
+ + + + + + +
+
+
Until next time!
+
+
+ Your Aqua free Team +
+
+
+
+
+
+ Do you have questions? Please contact support@aqua-free.com +
+
+
+
+ + + + + + +
+
+ + + + + + +
+ + + + + + +
+
+ + + + + + +
+

+ Der Account $lockoutAccount wurde geblockt.

+
+
+
+ + + + + + +
+
+
+ Der HyGenius-Account $lockoutAccount wurde aufgrund von $maxFailedLoginAttempts Loginversuchen geblockt.
+
+
+
- - - - - - -
-
- - -
- - - - - - - - - -
-

Thingsboard user account has been locked out

-
- Ihr Nutzerkonto ${lockoutAccount} wurde gesperrt, weil Sie sich ${maxFailedLoginAttempts} mal mit falschen Zugangsdaten eingeloggt haben. -
- — The Thingsboard -
- -
-
+
+
+ Diese Mail wurde von HyGenius an $targetEmail gesendet. +
+
+
+
+ + + + + + +
+
+
+ Bis zum nächsten Mal! +
+
+
+
+ Ihr Aqua free Team +
+
+
+
+
+
+ Fragen? Kontaktiere support@aqua-free.com +
+
+
+
+
+ +
+
+
+
+
diff --git a/application/src/main/resources/templates/activation.ftl b/application/src/main/resources/templates/activation.ftl index e1321db1f4d..56a8dec0a3b 100644 --- a/application/src/main/resources/templates/activation.ftl +++ b/application/src/main/resources/templates/activation.ftl @@ -18,107 +18,563 @@ - - -Rocknitive Suite - Zugang aktivieren - - - - + + + + + + + + + + + +
+
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + +
+
+
+ [Eine deutsche Version dieser E-Mail finden Sie weiter unten] +
+
+
+
+ + + + + + +
+ +
+ + + + + + +
+

Account + Activation

+
+
+
+ + + + + + +
+
+
+ Thank you very much, +
+
+
+
+ Your requested HyGenius account is now available and + can be used.
+
+
+
+
+ NOTE: Please open this e-mail on your + cellphone. +
+
+
+ By clicking on the button you will be taken + directly to our app and can start setting up + your account. +
+
+
+
+ + + + + + +
+ + + + + + +
+ Activate account + now +
+
+ + + + + + +
+
+
+ If you have problems and the app does not + open by clicking on the button above, please + copy the following activation code into the + app: +
+
+ $activationToken
+
+
+
+ + + + + + +
+
+
Until next time!
+
+
+ Your Aqua free Team +
+
+
+
+
+
+ Do you have questions? Please contact support@aqua-free.com +
+
+
+
+ + + + + + +
+
+ + + + + + +
+ + + + + + +
+
+ + + + + + +
+

+ Account-Aktivierung

+
+
+
+ + + + + + +
+
+
+ Herzlichen Dank, +
+
+
+
+ Ihr angeforderter Hygenius Account steht nun zur Verfügung und kann verwendet werden. +
+
+
+
+ HINWEIS: Bitte öffnen Sie diese E-Mail auf Ihrem Handy.  +
+
+
+
+ Mit einem Klick auf den Button gelangen Sie direkt in unsere App und können mit der Einrichtung des Zugang beginnen. +
+
+
+
+
+
+ + + + + + +
+ + + + + + +
+ Account jetzt + aktivieren +
+
+ + + + + + +
+
+
+ Sollten Sie Probleme haben und die App + öffnet sich nicht bei einem Klick auf den + oben stehenden Button, kopieren Sie bitten + folgenden Aktivierungscode in die App: +
+
+ $activationToken
+
+
+
+ + + + + + +
+
+
+ Bis zum nächsten Mal! +
+
+
+
+ Ihr Aqua free Team +
+
+
+
+
+
+ Fragen? Kontaktiere support@aqua-free.com +
+
+
+
+
+ +
+
+
+
+
diff --git a/application/src/main/resources/templates/password.was.reset.ftl b/application/src/main/resources/templates/password.was.reset.ftl index ed987d53200..f5031423679 100644 --- a/application/src/main/resources/templates/password.was.reset.ftl +++ b/application/src/main/resources/templates/password.was.reset.ftl @@ -18,107 +18,490 @@ - - -Thingsboard - Zugangspasswort zurückgesetzt - - - + + + + + + + + + + +
+
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + +
+
+
+ [Eine deutsche Version dieser E-Mail finden Sie weiter unten] +
+
+
+
+ + + + + + +
+ +
+ + + + + + +
+

Reset password request

+
+
+
+ + + + + + +
+
+
+ You requested a password reset for your HyGenius account.
+
+
+
+
+ Please klick on the button below to start the resetting process.
+
+ + +
+
+
+ + + + + + +
+
+
+ If you have problems and the app does not + open by clicking on the button above, please + copy the following code into the + app: +
+
+ $passwordResetToken
+
+
+
+ + + + + + +
+
+
Until next time!
+
+
+ Your Aqua free Team +
+
+
+
+
+
+ Do you have questions? Please contact support@aqua-free.com +
+
+
+
+ + + + + + +
+
+ + + + + + +
+ + + + + + +
+
+ + + + + + +
+

Passwort zurücksetzen

+
+
+
+ + + + + + +
+
+
+ Sie möchten das Passwort ihres HyGenius Kontos zurücksetzen.
+
+
+
+
+ Bitte klicken Sie auf den
+
- - - - - - -
-
- - -
- - - - - - - - - - - - - - - -
-

Ihr Rocknitive Suite Zugangspasswort wurde zurückgesetzt

-
- Sie haben ein neues Passwort für die Rocknitive Suite erstellt. -
- Sie können sich nun an der Rocknitive Suite mit Ihrem neuen Passwort anmelden. -
- -
- — Rocknitive -
- -
-
+ +
+
+
+ + + + + + +
+
+
+ Sollten Sie Probleme haben und die App + öffnet sich nicht bei einem Klick auf den + oben stehenden Button, kopieren Sie bitten + folgenden Code in die App: +
+
+ $passwordResetToken
+
+
+
+ + + + + + +
+
+
+ Bis zum nächsten Mal! +
+
+
+
+ Ihr Aqua free Team +
+
+
+
+
+
+ Fragen? Kontaktiere support@aqua-free.com +
+
+
+
+
+ +
+
+
+
+
diff --git a/application/src/main/resources/templates/reset.password.ftl b/application/src/main/resources/templates/reset.password.ftl index b4fb9712a2b..743502eaf98 100644 --- a/application/src/main/resources/templates/reset.password.ftl +++ b/application/src/main/resources/templates/reset.password.ftl @@ -18,107 +18,438 @@ - - -Rocknitive Suite - Anfrage zum Zurücksetzen des Passworts - - - + + + + + + + + + + +
+
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + +
+
+
+ [Eine deutsche Version dieser E-Mail finden Sie weiter unten] +
+
+
+
+ + + + + + +
+ +
+ + + + + + +
+

Your HyGenius password has been reset.

+
+
+
+ + + + + + +
+
+
+ You created a new password for your HyGenius account.
+
+
+ Login with your new passwort and get started!
+
+
+
+ +
+
+ +
+
+
+
+ + + + + + +
+
+
Until next time!
+
+
+ Your Aqua free Team +
+
+
+
+
+
+ Do you have questions? Please contact support@aqua-free.com +
+
+
+
+ + + + + + +
+
+ + + + + + +
+ + + + + + +
+
+ + + + + + +
+

+ Ihr HyGenius Passwort wurde zurückgesetzt

+
+
+
+ + + + + + +
+
+
+ Ein neues Passwort für HyGenius wurde erstellt. Melden Sie sich mit dem neuen Passwort an um loszulegen!
+
+
+
- - - - - - -
-
- - -
- - - - - - - - - - - - - - - -
-

Anfrage zum Zurücksetzen des Passworts

-
- Sie haben eine Anfrage zum Zurücksetzen Ihres Passworts in der Rocknitive Suite gestellt. -
- Klicken sie unten um den Prozess zu starten. -
- -
- — Rocknitive -
- -
-
+
+
+ +
+
+
+
+ + + + + + +
+
+
+ Bis zum nächsten Mal! +
+
+
+
+ Ihr Aqua free Team +
+
+
+
+
+
+ Fragen? Kontaktiere support@aqua-free.com +
+
+
+
+
+ +
+
+
+
+