Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance User Registration and Email Notification #56

Closed
wants to merge 4 commits into from

Conversation

maxCastro1
Copy link
Contributor

Enhance User Registration and Email Notification

Description:

This PR introduces several enhancements to the user registration process and the email notification system.

User Registration Updates:

  • The status field of the User entity is now set to 'active' by default. This means that when a new user is created, their status will automatically be active unless otherwise specified.
  • Similarly, the verified field of the User entity is now set to false by default. This indicates that a new user is not verified until they confirm their email address or complete another verification process.

Email Notification Function:

  • A new function sendMail has been created to handle sending emails. This function takes four parameters: userAuth, passAuth, message, and link.
  • userAuth and passAuth are the authentication credentials for the email server. These are retrieved from environment variables process.env.AUTH_EMAIL and process.env.AUTH_PASSWORD.
  • message is an object containing the details of the email to be sent. It includes to, from, subject, and text fields.
  • link is an optional parameter for including a link in the email.
  • The sendMail function is used in the registerUser function to send a welcome email to new users and a verification link. The email includes a link for the user to verify their account.

@maxCastro1 maxCastro1 requested a review from aimedivin May 3, 2024 09:56
@coveralls
Copy link

coveralls commented May 3, 2024

Pull Request Test Coverage Report for Build 8949538426

Details

  • 31 of 45 (68.89%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-7.5%) to 65.641%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/controllers/authController.ts 26 31 83.87%
src/utils/sendMail.ts 3 12 25.0%
Totals Coverage Status
Change from base Build 8919969005: -7.5%
Covered Lines: 113
Relevant Lines: 152

💛 - Coveralls

Comment on lines 0 to 3
import { UserController } from './authController';
import { registerUser } from './authController';

export{UserController}; No newline at end of file
export{registerUser};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you import like this . in index.ts export without importing something before. you just like that
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, we should put all our the functions related to the user in one file for userAuth, It will be better for accessibility thats why am exporting by name . beacuse having a file for every function would make the project cloudy

Comment on lines 9 to +10

const registerUser = async (req: Request, res: Response) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use export const registerUser
You won't need to export like this export {registerUser }

@maxCastro1 maxCastro1 requested a review from elijahladdie May 3, 2024 10:28
@maxCastro1 maxCastro1 closed this May 5, 2024
@maxCastro1 maxCastro1 deleted the feature-user-registration branch May 22, 2024 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants