Fix auth controller update (#31)

* Fix auth controller update

We should update the user here

* Remove database update on auth call as we simply rely on JWT
This commit is contained in:
Michael Bumann
2022-01-16 15:11:49 +02:00
committed by GitHub
parent 8bc060697f
commit 2c19244cad

View File

@@ -52,7 +52,9 @@ func (AuthController) Auth(c echo.Context) error {
}
if bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(body.Password)) != nil {
return c.JSON(http.StatusNotFound, echo.Map{
"message": "invalid username or password",
"error": true,
"code": 1,
"message": "bad auth",
})
}
}
@@ -86,14 +88,6 @@ func (AuthController) Auth(c echo.Context) error {
return err
}
if _, err := db.NewInsert().Model(&user).Exec(context.TODO()); err != nil {
return c.JSON(http.StatusInternalServerError, echo.Map{
"error": true,
"code": 6,
"message": "Something went wrong. Please try again later",
})
}
return c.JSON(http.StatusOK, echo.Map{
"refresh_token": refreshToken,
"access_token": accessToken,