mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-08 19:22:42 +08:00
使用已有的加密方案加密密码
This commit is contained in:
@@ -14,6 +14,10 @@ func PasswordHash(password string) (string, error) {
|
||||
}
|
||||
|
||||
func PasswordVerify(password, hash string) bool {
|
||||
// 保留老用户明文验证
|
||||
if len(hash) != 60 {
|
||||
return password == hash
|
||||
}
|
||||
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
|
||||
return err == nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user