Skip to content

Commit

Permalink
Fix the configuration files and the functionality is almost done #55
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanPenchev05 committed Mar 13, 2024
1 parent ac6f7fc commit 28dc75c
Show file tree
Hide file tree
Showing 9 changed files with 868 additions and 31 deletions.
42 changes: 24 additions & 18 deletions server/controllers/auth/registerController.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,32 @@ export default async function registerController(req, res) {
const uuid = uuidv4();
const verificationToken = jwt.sign({uuid}, process.env.JWT_SECRET, { expiresIn: '15m' });

const emailTemplate = await generateTemplate("verifyRegisterUser", {verificationToken, username})

console.log(emailTemplate);

sendMail(email, "User Verification", emailTemplate);

// Temporarily store the user's data in Redis with a 15 minute expiry
// Then send a verification email to the user
await setTempMemory(uuid, {
ip,
userAgent,
browser,
operatingSystem,
deviceType,
firstName,
lastName,
email,
username,
password: hashPassword
}, 60 * 15).then(async() => {
const emailTemplate = await generateTemplate("verifyRegisterUser", {verificationToken, username})

sendMail(email, "User Verification", emailTemplate);
}).catch(err => {
throw err;
});
// await setTempMemory(uuid, {
// ip,
// userAgent,
// browser,
// operatingSystem,
// deviceType,
// firstName,
// lastName,
// email,
// username,
// password: hashPassword
// }, 60 * 15).then(async() => {
// const emailTemplate = await generateTemplate("verifyRegisterUser", {verificationToken, username})

// sendMail(email, "User Verification", emailTemplate);
// }).catch(err => {
// throw err;
// });

// If everything is successful, return a 200 status code and a success message
// and tells the client to await for veriification sent via email
Expand Down
Loading

0 comments on commit 28dc75c

Please sign in to comment.