Skip to content

Commit

Permalink
fix(ac): forbid to set new password the same as the old (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI authored Aug 29, 2024
1 parent 8dd2b2b commit e593ff6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/dashboard/business/ac/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ func ResetAccountPassword(ctx context.Context, username string, resetParam *para
newBts := sha256.Sum256([]byte(resetParam.Password))
newEncryptedPwd := hex.EncodeToString(newBts[:])

if account.password == newEncryptedPwd {
return nil, httpErr.NewBadRequest("new password is the same as the old password")
}

up := &acmodel.UpdateAccountCreds{
Username: username,
AccountCreds: acmodel.AccountCreds{
Expand Down

0 comments on commit e593ff6

Please sign in to comment.