Skip to content

Commit ca5a322

Browse files
author
Christian Roessner
committed
Fix: Remove redundant password history checks in cache loading
Eliminated the unnecessary verification steps related to password history within the cache loading process. This streamlines the function and avoids redundant password lookups for already known wrong passwords. Signed-off-by: Christian Roessner <[email protected]>
1 parent d36f508 commit ca5a322

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

server/core/cache.go

-15
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ func cachePassDB(auth *AuthState) (passDBResult *PassDBResult, err error) {
5252
ppc = &backend.PositivePasswordCache{}
5353

5454
isRedisErr := false
55-
5655
if isRedisErr, err = backend.LoadCacheFromRedis(auth.HTTPClientContext, redisPosUserKey, ppc); err != nil {
5756
return
5857
}
@@ -78,19 +77,5 @@ func cachePassDB(auth *AuthState) (passDBResult *PassDBResult, err error) {
7877
}
7978
}
8079

81-
if !passDBResult.Authenticated {
82-
if key := auth.getPasswordHistoryRedisHashKey(true); key != "" {
83-
auth.loadPasswordHistoryFromRedis(key)
84-
}
85-
86-
// Prevent password lookups for already known wrong passwords (And the user is unknown in the entire system)
87-
if auth.PasswordHistory != nil {
88-
passwordHash := util.GetHash(util.PreparePassword(auth.Password))
89-
if _, foundPassword := (*auth.PasswordHistory)[passwordHash]; foundPassword {
90-
passDBResult.UserFound = true
91-
}
92-
}
93-
}
94-
9580
return
9681
}

0 commit comments

Comments
 (0)