mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-10-26 11:27:18 +00:00
home: imp code
This commit is contained in:
parent
2fdb14b579
commit
00e992b175
@ -506,21 +506,25 @@ func (mw *authMiddlewareDefault) userFromRequestBasicAuth(
|
||||
return nil, fmt.Errorf("login attempt blocked for %s", left)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
rateLimiter.inc(remoteIP)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
rateLimiter.remove(remoteIP)
|
||||
}()
|
||||
|
||||
user, _ = mw.users.ByLogin(ctx, aghuser.Login(login))
|
||||
if user == nil {
|
||||
rateLimiter.inc(remoteIP)
|
||||
|
||||
return nil, errInvalidLogin
|
||||
}
|
||||
|
||||
ok = user.Password.Authenticate(ctx, pass)
|
||||
if !ok {
|
||||
rateLimiter.inc(remoteIP)
|
||||
|
||||
return nil, errInvalidLogin
|
||||
}
|
||||
|
||||
rateLimiter.remove(remoteIP)
|
||||
|
||||
return user, nil
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user