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