Skip to content

Commit 1cf5396

Browse files
ftkgzyro
authored andcommitted
Trim no rows condition.
1 parent 0cf9ac4 commit 1cf5396

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

server/console_authenticate.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,8 @@ func (s *ConsoleServer) lookupConsoleUser(ctx context.Context, unameOrEmail, pas
158158
err = s.db.QueryRowContext(ctx, query, unameOrEmail).Scan(&id, &uname, &email, &role, &dbPassword, &dbDisableTime)
159159
if err != nil {
160160
if err == sql.ErrNoRows {
161-
if lockout, until := s.loginAttemptCache.Add("", ip); lockout != LockoutTypeNone {
162-
switch lockout {
163-
case LockoutTypeAccount:
164-
s.logger.Info(fmt.Sprintf("Console user account locked until %v.", until))
165-
case LockoutTypeIp:
166-
s.logger.Info(fmt.Sprintf("Console user IP locked until %v.", until))
167-
}
161+
if lockout, until := s.loginAttemptCache.Add("", ip); lockout == LockoutTypeIp {
162+
s.logger.Info(fmt.Sprintf("Console user IP locked until %v.", until))
168163
}
169164
err = status.Error(codes.Unauthenticated, "Invalid credentials.")
170165
}

0 commit comments

Comments
 (0)