Company
Date Published
Author
Pranav Mayuram
Word count
907
Language
English
Hacker News points
None

Summary

In the third installment of building the Touchbase application, the focus is on creating an email verification system utilizing Couchbase, nodemailer, and the Sendgrid Web API. The process begins with setting up necessary Node.js modules, such as the Couchbase Node.js SDK, body-parser, uuid, nodemailer, and nodemailer-sendgrid-transport, which are essential for sending verification emails. The email verification system is integrated into Touchbase through the `Session.makeVerification` function, which generates verification emails and updates user documents to enable account login only after the email is verified. This function is linked to the `/api/registerUser` endpoint, ensuring users receive a verification email they must click to confirm their email address. The email content is crafted using an HTML to JavaScript string converter and utilizes a `[email protected]` email alias for clear identification. Upon clicking the verification link, users are directed to the `api/verify/:verificationID` page, where the system verifies the ID, updates the user's `emailVerified` status to true, and completes the registration process, thus allowing the user access to their account.