timing attack
This commit is contained in:
parent
e30896ee4c
commit
054ea37239
1 changed files with 6 additions and 5 deletions
|
@ -42,12 +42,13 @@ func (s *Server) Login(ctx context.Context, username, password string) (token st
|
|||
}
|
||||
|
||||
if found == nil {
|
||||
_ = bcrypt.CompareHashAndPassword([]byte("lol@timing"), []byte(password))
|
||||
return "", ErrLoginFailed
|
||||
}
|
||||
|
||||
err = bcrypt.CompareHashAndPassword([]byte(found.Password), []byte(password))
|
||||
if err != nil {
|
||||
return "", ErrLoginFailed
|
||||
} else {
|
||||
err = bcrypt.CompareHashAndPassword([]byte(found.Password), []byte(password))
|
||||
if err != nil {
|
||||
return "", ErrLoginFailed
|
||||
}
|
||||
}
|
||||
|
||||
return s.NewToken(found.ID), nil
|
||||
|
|
Loading…
Reference in a new issue