Skip to content

Commit 69c4311

Browse files
committed
Revert "fix: remove hash password"
This reverts commit 1deb9e8.
1 parent 1deb9e8 commit 69c4311

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

auth/basic_auth.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,17 @@ func (r *Register) Register(ctx context.Context, repo models.IUserRepo) (err err
7171
return
7272
}
7373

74+
password, err := bcrypt.GenerateFromPassword([]byte(r.Password), passwordCost)
75+
if err != nil {
76+
log.Error(ErrComparePassword)
77+
return
78+
}
79+
7480
// insert db
7581
user := &models.User{
7682
Name: r.Username,
7783
Email: r.Email,
78-
EncryptedPassword: r.Password,
84+
EncryptedPassword: string(password),
7985
CurrentSignInAt: time.Time{},
8086
LastSignInAt: time.Time{},
8187
CurrentSignInIP: "",

0 commit comments

Comments
 (0)