1
0

Prevent login from inactive (aka non-verified) users (#8)

This commit is contained in:
konrad
2018-11-01 22:47:41 +00:00
committed by Gitea
parent 301a4eedda
commit 4713023a97
6 changed files with 68 additions and 5 deletions

View File

@ -2,6 +2,7 @@ package v1
import (
"code.vikunja.io/api/pkg/models"
"code.vikunja.io/api/pkg/routes/crud"
"crypto/md5"
"encoding/hex"
"github.com/dgrijalva/jwt-go"
@ -41,7 +42,7 @@ func Login(c echo.Context) error {
// Check user
user, err := models.CheckUserCredentials(&u)
if err != nil {
return c.JSON(http.StatusUnauthorized, models.Message{"Wrong username or password."})
return crud.HandleHTTPError(err)
}
// Create token