mirror of
https://git.vectorsigma.ru/public/AdGuardHome.git
synced 2026-08-03 19:39:39 +00:00
Pull request 2456: 7985-fix-contol-profile
Updates #7985. Squashed commit of the following: commit 1d5a3e66cc046ac8be6c0ebe7f5e06bc3e2a5e72 Merge:bdc76b1b152398e27eAuthor: Stanislav Chzhen <s.chzhen@adguard.com> Date: Thu Aug 28 19:05:51 2025 +0300 Merge branch 'master' into 7985-fix-contol-profile commitbdc76b1b10Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Aug 26 15:47:07 2025 +0300 home: imp code commitaef012ed02Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Aug 26 13:14:39 2025 +0300 home: add tests commit799e8b49a1Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Mon Aug 25 16:59:06 2025 +0300 all: fix control profile
This commit is contained in:
@@ -54,7 +54,7 @@ type authConfig struct {
|
||||
|
||||
// rateLimiter manages the rate limiting for login attempts. It must not be
|
||||
// nil.
|
||||
rateLimiter loginRaateLimiter
|
||||
rateLimiter loginRateLimiter
|
||||
|
||||
// trustedProxies is a set of subnets considered as trusted.
|
||||
trustedProxies netutil.SubnetSet
|
||||
@@ -75,12 +75,27 @@ type authConfig struct {
|
||||
|
||||
// auth stores web user information and handles authentication.
|
||||
type auth struct {
|
||||
logger *slog.Logger
|
||||
rateLimiter loginRaateLimiter
|
||||
// logger is used to log the operation of the auth module.
|
||||
logger *slog.Logger
|
||||
|
||||
// rateLimiter manages rate limiting for login attempts.
|
||||
rateLimiter loginRateLimiter
|
||||
|
||||
// trustedProxies is a set of subnets considered trusted.
|
||||
trustedProxies netutil.SubnetSet
|
||||
sessions aghuser.SessionStorage
|
||||
users aghuser.DB
|
||||
isGLiNet bool
|
||||
|
||||
// sessions stores web users' sessions.
|
||||
sessions aghuser.SessionStorage
|
||||
|
||||
// users stores user credentials.
|
||||
users aghuser.DB
|
||||
|
||||
// isGLiNet indicates whether GLiNet mode is enabled.
|
||||
isGLiNet bool
|
||||
|
||||
// isUserless indicates that there are no users defined in the configuration
|
||||
// file.
|
||||
isUserless bool
|
||||
}
|
||||
|
||||
// newAuth returns the new properly initialized *auth.
|
||||
@@ -111,6 +126,7 @@ func newAuth(ctx context.Context, conf *authConfig) (a *auth, err error) {
|
||||
sessions: s,
|
||||
users: userDB,
|
||||
isGLiNet: conf.isGLiNet,
|
||||
isUserless: len(conf.users) == 0,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -174,6 +190,8 @@ func (a *auth) addUser(ctx context.Context, u *webUser, password string) (err er
|
||||
panic(err)
|
||||
}
|
||||
|
||||
a.isUserless = false
|
||||
|
||||
a.logger.DebugContext(ctx, "added user", "login", u.Name)
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user