diff --git a/backend/spring-boot/Dockerfile b/backend/spring-boot/Dockerfile index 7daffc8d..ebee47f3 100644 --- a/backend/spring-boot/Dockerfile +++ b/backend/spring-boot/Dockerfile @@ -1,5 +1,10 @@ FROM maven:3.9.6-amazoncorretto-21-debian AS build +RUN apt-get update; apt-get install -y curl \ + && curl -sL https://deb.nodesource.com/setup_20.x | bash - \ + && apt-get install -y nodejs \ + && curl -L https://www.npmjs.com/install.sh | sh + WORKDIR /app COPY pom.xml . diff --git a/backend/spring-boot/pom.xml b/backend/spring-boot/pom.xml index d33e5616..ed40b25c 100644 --- a/backend/spring-boot/pom.xml +++ b/backend/spring-boot/pom.xml @@ -30,6 +30,7 @@ 3.13.0 2.43.0 1.17.0 + 3.5.0 @@ -224,6 +225,45 @@ + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + + generate verify-email.html + + exec + + generate-resources + + npx + + mjml + src/main/resources/templates/email/verify-email.mjml + -o + src/main/resources/templates/email/verify-email.html + + + + + generate reset-password.html + + exec + + generate-resources + + npx + + mjml + src/main/resources/templates/email/reset-password.mjml + -o + src/main/resources/templates/email/reset-password.html + + + + + diff --git a/backend/spring-boot/src/main/java/org/bootstrapbugz/backend/auth/jwt/event/email/ResetPasswordEmail.java b/backend/spring-boot/src/main/java/org/bootstrapbugz/backend/auth/jwt/event/email/ResetPasswordEmail.java index 083beb2e..0e3a4149 100644 --- a/backend/spring-boot/src/main/java/org/bootstrapbugz/backend/auth/jwt/event/email/ResetPasswordEmail.java +++ b/backend/spring-boot/src/main/java/org/bootstrapbugz/backend/auth/jwt/event/email/ResetPasswordEmail.java @@ -20,9 +20,9 @@ public void sendEmail(EmailService emailService, Environment environment, User u final var link = environment.getProperty("ui.app.url") + "/auth/reset-password?token=" + token; final var body = CharStreams.toString(new InputStreamReader(template, StandardCharsets.UTF_8)) - .replace("$name", user.getUsername()) - .replace("$link", link) - .replace("$appName", Objects.requireNonNull(environment.getProperty("app.name"))); + .replace("${name}", user.getUsername()) + .replace("${link}", link) + .replace("${appName}", Objects.requireNonNull(environment.getProperty("app.name"))); emailService.sendHtmlEmail(user.getEmail(), "Reset password", body); } } diff --git a/backend/spring-boot/src/main/java/org/bootstrapbugz/backend/auth/jwt/event/email/VerificationEmail.java b/backend/spring-boot/src/main/java/org/bootstrapbugz/backend/auth/jwt/event/email/VerificationEmail.java index 1a1c20c6..fc12bb6c 100644 --- a/backend/spring-boot/src/main/java/org/bootstrapbugz/backend/auth/jwt/event/email/VerificationEmail.java +++ b/backend/spring-boot/src/main/java/org/bootstrapbugz/backend/auth/jwt/event/email/VerificationEmail.java @@ -20,9 +20,9 @@ public void sendEmail(EmailService emailService, Environment environment, User u final var link = environment.getProperty("ui.app.url") + "/auth/verify-email?token=" + token; final var body = CharStreams.toString(new InputStreamReader(template, StandardCharsets.UTF_8)) - .replace("$name", user.getUsername()) - .replace("$link", link) - .replace("$appName", Objects.requireNonNull(environment.getProperty("app.name"))); + .replace("${name}", user.getUsername()) + .replace("${link}", link) + .replace("${appName}", Objects.requireNonNull(environment.getProperty("app.name"))); emailService.sendHtmlEmail(user.getEmail(), "Verify email", body); } } diff --git a/backend/spring-boot/src/main/resources/templates/email/.gitignore b/backend/spring-boot/src/main/resources/templates/email/.gitignore new file mode 100644 index 00000000..96c469a5 --- /dev/null +++ b/backend/spring-boot/src/main/resources/templates/email/.gitignore @@ -0,0 +1,2 @@ +reset-password.html +verify-email.html \ No newline at end of file diff --git a/backend/spring-boot/src/main/resources/templates/email/reset-password.html b/backend/spring-boot/src/main/resources/templates/email/reset-password.html deleted file mode 100644 index 07b68bea..00000000 --- a/backend/spring-boot/src/main/resources/templates/email/reset-password.html +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - Reset password - - - -Reset password - - - - - - -
  -
- - - - - - - - -
- - - - -
-

- Hi $name, -

-

- In order to reset your password please click the button below. -

- - - - - - -
- - - - - - -
- Reset password -
-
-

- If you didn't attempt to reset your password you can just delete this - email. -

-

- Cheers, $appName -

-
-
- - - - - - -
-
 
- - diff --git a/backend/spring-boot/src/main/resources/templates/email/reset-password.mjml b/backend/spring-boot/src/main/resources/templates/email/reset-password.mjml new file mode 100644 index 00000000..5ae7fbb3 --- /dev/null +++ b/backend/spring-boot/src/main/resources/templates/email/reset-password.mjml @@ -0,0 +1,29 @@ + + + + + +

Password Reset Request

+

Hi ${name},

+

We received a request to reset the password for your ${appName} account. Please click the button below to reset your password.

+
+ + + Reset Password + + + + If you didn’t request a password reset, please ignore this email. + +
+
+ + + + +

© ${appName}. All rights reserved.

+
+
+
+
+
diff --git a/backend/spring-boot/src/main/resources/templates/email/verify-email.html b/backend/spring-boot/src/main/resources/templates/email/verify-email.html deleted file mode 100644 index 7d70ec22..00000000 --- a/backend/spring-boot/src/main/resources/templates/email/verify-email.html +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - - Verify email - - - -Verify email - - - - - - -
  -
- - - - - - - - -
- - - - -
-

- Hi $name, -

-

- We're excited to have you get started. First, you need to confirm your - account. Just press the button below. -

- - - - - - -
- - - - - - -
- Verify -
-
-

- If you didn't attempt to verify your email address with our service you - can just delete this email. -

-

- Cheers, $appName -

-
-
- - - - - - -
-
 
- - diff --git a/backend/spring-boot/src/main/resources/templates/email/verify-email.mjml b/backend/spring-boot/src/main/resources/templates/email/verify-email.mjml new file mode 100644 index 00000000..90c87f91 --- /dev/null +++ b/backend/spring-boot/src/main/resources/templates/email/verify-email.mjml @@ -0,0 +1,29 @@ + + + + + +

Welcome to ${appName}!

+

Hi ${name},

+

Thank you for signing up with ${appName}! We are excited to have you on board. To complete your registration and activate your account, please click the button below to verify your email address.

+
+ + + Verify Your Email + + + + If you did not sign up for ${appName}, please ignore this email. + +
+
+ + + + +

© ${appName}. All rights reserved.

+
+
+
+
+
diff --git a/frontend/svelte-kit/src/routes/auth/confirm-registration/+server.ts b/frontend/svelte-kit/src/routes/auth/verify-email/+server.ts similarity index 100% rename from frontend/svelte-kit/src/routes/auth/confirm-registration/+server.ts rename to frontend/svelte-kit/src/routes/auth/verify-email/+server.ts