Skip to content

Conversation

@yym0329
Copy link

@yym0329 yym0329 commented May 1, 2023

  • RESTful API 구현
  • bcrypt 라이브러리 이용하여 password encryption 구현한듯?

@Byunk Byunk changed the title Password Encryption implemented Youngmin May 1, 2023
Copy link
Member

@Byunk Byunk left a comment

Choose a reason for hiding this comment

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

Good~

export async function createUser(req: Request, res: Response, next: NextFunction) {
try {
const { username, password, name, email }: { username: string; password: string; name: string; email: string } = req.body;
const user: UserDocument = await User.create({ username, password, name, email });
Copy link
Member

Choose a reason for hiding this comment

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

await User.create(
{
username: username,
password: hashedPassword,
name: name,
email: email,
})

export interface IUser extends Document {
username: string;
password: string;
hashedPassword: string;
Copy link
Member

Choose a reason for hiding this comment

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

password와 hashedPassword를 분리할 필요는 없을 것 같아요.
Encrypted된 password만 DB에 저장하는 것이 목표입니다!

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.

2 participants