feat: check passwords on login
This commit is contained in:
@ -81,6 +81,11 @@ func (h *AuthHandler) login(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !util.VerifyPassword(params.Password, user.PasswordHash) {
|
||||||
|
web.Error(w, "username or/and password are incorrect", http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
claims := types.UserClaims{
|
claims := types.UserClaims{
|
||||||
UserID: user.ID.String(),
|
UserID: user.ID.String(),
|
||||||
RegisteredClaims: jwt.RegisteredClaims{
|
RegisteredClaims: jwt.RegisteredClaims{
|
||||||
|
Reference in New Issue
Block a user