feat: User management, SMTP email activation and password resets
Build and Deploy / build-and-push (push) Successful in 1m0s
Build and Deploy / build-and-push (push) Successful in 1m0s
This commit is contained in:
@@ -40,7 +40,35 @@ const sendMail = async (to, subject, text, html = '') => {
|
||||
}
|
||||
};
|
||||
|
||||
const sendActivationEmail = async (email, token, baseUrl) => {
|
||||
const activationLink = `${baseUrl}/activate?token=${token}`;
|
||||
const subject = "Activate your Titan 3D Account";
|
||||
const html = `
|
||||
<h2>Welcome to Titan 3D!</h2>
|
||||
<p>Please click the link below to activate your account:</p>
|
||||
<a href="${activationLink}">${activationLink}</a>
|
||||
<p>If you did not request this, please ignore this email.</p>
|
||||
`;
|
||||
const text = `Welcome to Titan 3D! Please navigate to the following link to activate your account: ${activationLink}`;
|
||||
return sendMail(email, subject, text, html);
|
||||
};
|
||||
|
||||
const sendPasswordResetEmail = async (email, token, baseUrl) => {
|
||||
const resetLink = `${baseUrl}/reset-password?token=${token}`;
|
||||
const subject = "Reset your Titan 3D Password";
|
||||
const html = `
|
||||
<h2>Password Reset Request</h2>
|
||||
<p>Please click the link below to securely reset your password:</p>
|
||||
<a href="${resetLink}">${resetLink}</a>
|
||||
<p>If you did not request this, please ignore this email.</p>
|
||||
`;
|
||||
const text = `Please navigate to the following link to reset your password: ${resetLink}`;
|
||||
return sendMail(email, subject, text, html);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
sendMail,
|
||||
sendActivationEmail,
|
||||
sendPasswordResetEmail,
|
||||
transporter
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user