1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: don't trim hash

This commit is contained in:
Ferdinand Mütsch
2020-05-29 00:04:48 +02:00
parent 75dd070b3d
commit 50eba49547
2 changed files with 2 additions and 3 deletions

View File

@@ -63,9 +63,8 @@ func IsMd5(hash string) bool {
}
func CheckPasswordBcrypt(user *models.User, password, salt string) bool {
hashedPassword := []byte(strings.TrimSpace(user.Password))
plainPassword := []byte(strings.TrimSpace(password) + salt)
err := bcrypt.CompareHashAndPassword(hashedPassword, plainPassword)
err := bcrypt.CompareHashAndPassword([]byte(user.Password), plainPassword)
return err == nil
}