validate current user in blacklist and update blacklist
(blacklistKey, currentPwd, verifiedPwd string)
| 61 | |
| 62 | // validate current user in blacklist and update blacklist |
| 63 | func ValidatePassword(blacklistKey, currentPwd, verifiedPwd string) error { |
| 64 | realCurrentPwd, err := handler.DecryptPasswordSupportNoRsaKey(currentPwd, g.RsaPrivateKey) |
| 65 | if err != nil { |
| 66 | return fmt.Errorf("decrypt current password err") |
| 67 | } |
| 68 | realVerifiedPwd, err := handler.DecryptPasswordSupportNoRsaKey(verifiedPwd, g.RsaPrivateKey) |
| 69 | if err != nil { |
| 70 | return fmt.Errorf("decrypt verified password err") |
| 71 | } |
| 72 | if realCurrentPwd != realVerifiedPwd { |
| 73 | BL.setBlacklist(blacklistKey, time.Minute*30) |
| 74 | return fmt.Errorf("user or password is wrong") |
| 75 | } |
| 76 | return nil |
| 77 | } |
| 78 | |
| 79 | // there are at least three types of uppercase letters, lowercase characters, numbers, and special characters |
| 80 | func VerifyPassword(encryptPwd string) bool { |
no test coverage detected