Skip to content

307 move password hashing to new auth file#309

Open
stephanie-xu wants to merge 4 commits intomainfrom
307-move-password-hashing-to-new-auth-file
Open

307 move password hashing to new auth file#309
stephanie-xu wants to merge 4 commits intomainfrom
307-move-password-hashing-to-new-auth-file

Conversation

@stephanie-xu
Copy link

Pull Request

Brief Summary

  • Moved the password hashing and comparing into a new class Password in password.ts with 2 methods, and changed the relevant parts of userController to use the new class's static methods.

Questions / Considerations for the Future

  • not sure if the TODO listed in the comments (moving password hashing to frontend) will change this in the future

API Changes

-

Database Changes

-

New Tests

  • No tests added, the current tests cover all changed files

Closes #307

Copy link
Member

@ethanszeto ethanszeto left a comment

Choose a reason for hiding this comment

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

Looks good, just one extra thing that could be cool

Comment on lines +20 to +23
static async hash(password) {
const encrypted = await bcrypt.hash(password, 10);
return encrypted;
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add random salting here:

The way the bcrypt works is that you get to define the "salting" you do (aka. random string). Right now we don't really generate a random salt, making the outcome predictable. Try to use genSalt in order to bolster the security of passwords

Copy link
Member

Choose a reason for hiding this comment

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

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.

Move password hashing to new auth file

3 participants