MCPcopy Create free account
hub / github.com/actiontech/dtle / ValidatePassword

Function ValidatePassword

api/handler/v2/auth.go:63–77  ·  view source on GitHub ↗

validate current user in blacklist and update blacklist

(blacklistKey, currentPwd, verifiedPwd string)

Source from the content-addressed store, hash-verified

61
62// validate current user in blacklist and update blacklist
63func 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
80func VerifyPassword(encryptPwd string) bool {

Callers 2

innerLoginFunction · 0.85
ResetPasswordV2Function · 0.85

Calls 2

setBlacklistMethod · 0.80

Tested by

no test coverage detected