more optimization
This commit is contained in:
parent
237874eda6
commit
e97fa30202
3 changed files with 27 additions and 28 deletions
|
@ -32,14 +32,13 @@ func Login(c echo.Context) error {
|
|||
// "403":
|
||||
// "$ref": "#/responses/Message"
|
||||
|
||||
u := new(models.UserLogin)
|
||||
if err := c.Bind(u); err != nil {
|
||||
u := models.UserLogin{}
|
||||
if err := c.Bind(&u); err != nil {
|
||||
return c.JSON(http.StatusBadRequest, models.Message{"Please provide a username and password."})
|
||||
}
|
||||
|
||||
// Check user
|
||||
user, err := models.CheckUserCredentials(u)
|
||||
|
||||
user, err := models.CheckUserCredentials(&u)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusUnauthorized, models.Message{"Wrong username or password."})
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ import (
|
|||
"github.com/labstack/echo/middleware"
|
||||
|
||||
"git.kolaente.de/konrad/list/models"
|
||||
crud "git.kolaente.de/konrad/list/routes/crud"
|
||||
apiv1 "git.kolaente.de/konrad/list/routes/api/v1"
|
||||
_ "git.kolaente.de/konrad/list/routes/api/v1/swagger" // for docs generation
|
||||
"git.kolaente.de/konrad/list/routes/crud"
|
||||
)
|
||||
|
||||
// NewEcho registers a new Echo instance
|
||||
|
|
Loading…
Reference in a new issue