mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-12-28 07:39:55 +08:00
home: imp code
Some checks failed
build / test (macOS-latest) (push) Has been cancelled
build / test (ubuntu-latest) (push) Has been cancelled
build / test (windows-latest) (push) Has been cancelled
lint / go-lint (push) Has been cancelled
lint / eslint (push) Has been cancelled
build / build-release (push) Has been cancelled
build / notify (push) Has been cancelled
lint / notify (push) Has been cancelled
Some checks failed
build / test (macOS-latest) (push) Has been cancelled
build / test (ubuntu-latest) (push) Has been cancelled
build / test (windows-latest) (push) Has been cancelled
lint / go-lint (push) Has been cancelled
lint / eslint (push) Has been cancelled
build / build-release (push) Has been cancelled
build / notify (push) Has been cancelled
lint / notify (push) Has been cancelled
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user