mirror of
https://github.com/fumiama/paper-manager.git
synced 2026-06-08 17:40:23 +08:00
优化 getLoginSalt
This commit is contained in:
@@ -63,8 +63,11 @@ func getLoginSalt(username string) (*saltinfo, error) {
|
||||
}
|
||||
salt := loginsalts.Get(username)
|
||||
if salt.count != nil {
|
||||
if atomic.AddUintptr(salt.count, 1) >= maxSaltCount {
|
||||
x := atomic.AddUintptr(salt.count, 1)
|
||||
if x == maxSaltCount {
|
||||
time.AfterFunc(time.Minute*2, func() { atomic.StoreUintptr(salt.count, 0) })
|
||||
}
|
||||
if x >= maxSaltCount {
|
||||
return nil, errTooManySalts
|
||||
}
|
||||
if salt.Salt != "" {
|
||||
|
||||
Reference in New Issue
Block a user