diff --git a/api/.env.example b/api/.env.example index 6bbe528..9df7716 100644 --- a/api/.env.example +++ b/api/.env.example @@ -3,6 +3,8 @@ MONGO_URI= JWT_SECRET=secret JWT_EXPIRATION=60d +FRONTEND_URL= + FIREBASE_PROJECT_ID= FIREBASE_PRIVATE_KEY_ID= FIREBASE_PRIVATE_KEY= diff --git a/api/src/auth/auth.service.ts b/api/src/auth/auth.service.ts index a77bff8..97d5e24 100644 --- a/api/src/auth/auth.service.ts +++ b/api/src/auth/auth.service.ts @@ -155,11 +155,13 @@ export class AuthService { }) passwordReset.save() + const resetLink = `${process.env.FRONTEND_URL || 'https://textbee.dev'}/reset-password?email=${encodeURIComponent(user.email)}&otp=${otp}` + await this.mailService.sendEmailFromTemplate({ to: user.email, - subject: 'Password Reset', + subject: 'textbee.dev - Password Reset', template: 'password-reset-request', - context: { name: user.name, otp }, + context: { name: user.name, resetLink, otp }, }) return { message: 'Password reset email sent' } @@ -189,7 +191,7 @@ export class AuthService { this.mailService.sendEmailFromTemplate({ to: user.email, - subject: 'Password Reset', + subject: 'textbee.dev - Password Reset', template: 'password-reset-success', context: { name: user.name }, }) diff --git a/api/src/mail/templates/password-reset-request.hbs b/api/src/mail/templates/password-reset-request.hbs index 5893847..b0a9690 100644 --- a/api/src/mail/templates/password-reset-request.hbs +++ b/api/src/mail/templates/password-reset-request.hbs @@ -1,14 +1,129 @@ -
- We have received a request to reset your password. If you did not make this - request, please ignore this email. Otherwise, you can reset your password - using the OTP below. -
-Hello {{name}},
+ +We have received a request to reset your password. If you did not make + this request, please ignore this email. Otherwise, you can reset your + password using the button below.
+ +If the button above doesn't work, you can copy and paste the following + link into your browser:
+{{resetLink}}
+ +Alternatively, you can use this OTP:
+- Your password has been successfully reset. You can now login with your new password. -
-Hello {{name}},
+ +Your password has been successfully reset. You can now login to your account using your new password.
+ + + + +
-My name is Vernu, and I'm the founder of TextBee.
-
-
-I built TextBee to help you with your messaging needs. be it sending OTP, notifications, or automated messaging workflows for your business.
-
-
-Here are few tips to get you started:
-
-
Hi {{name}},
+I'm Vernu, the founder of TextBee. I built this platform to help you + with all your messaging needs - whether it's sending OTPs, + notifications, or creating automated messaging workflows for your + business.
+ +
+ P.S.
+ I'd love to hear from you! Why did you choose TextBee? Do you have any
+ feedback or questions?
+ Feel free to reach out to our support team at
+ contact@textbee.dev.
+ We read and respond to all emails as quickly as possible.
+
+ Cheers,
+ Vernu
+ Founder, TextBee.dev
+