Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
747 changes: 642 additions & 105 deletions drivers/api/docs/docs.go

Large diffs are not rendered by default.

747 changes: 642 additions & 105 deletions drivers/api/docs/swagger.json

Large diffs are not rendered by default.

443 changes: 388 additions & 55 deletions drivers/api/docs/swagger.yaml

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions drivers/api/handler/v2/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ func (b *BlackList) blackListExist(key string) (int, bool) {
}

// validate current user in blacklist and update blacklist
func ValidatePassword(user, operation, currentPwd, verifiedPwd string) error {
if leftMinute, exist := BL.blackListExist(fmt.Sprintf("%s:%s", user, operation)); exist {
return fmt.Errorf("the password cannot be changed temporarily, please try again after %v minute", leftMinute)
}
func ValidatePassword(blackListKey, currentPwd, verifiedPwd string) error {
realCurrentPwd, err := handler.DecryptPasswordSupportNoRsaKey(currentPwd, g.RsaPrivateKey)
if err != nil {
return fmt.Errorf("decrypt current password err")
Expand All @@ -73,7 +70,7 @@ func ValidatePassword(user, operation, currentPwd, verifiedPwd string) error {
return fmt.Errorf("decrypt verified password err")
}
if realCurrentPwd != realVerifiedPwd {
BL.setBlackList(fmt.Sprintf("%s:%s", user, operation), time.Minute*30)
BL.setBlackList(blackListKey, time.Minute*30)
return fmt.Errorf("user or password is wrong")
}
return nil
Expand Down
Loading