mirror of
https://github.com/getAlby/lndhub.go.git
synced 2025-12-21 14:44:45 +01:00
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:
@@ -52,7 +52,9 @@ func (AuthController) Auth(c echo.Context) error {
|
|||||||
}
|
}
|
||||||
if bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(body.Password)) != nil {
|
if bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(body.Password)) != nil {
|
||||||
return c.JSON(http.StatusNotFound, echo.Map{
|
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
|
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{
|
return c.JSON(http.StatusOK, echo.Map{
|
||||||
"refresh_token": refreshToken,
|
"refresh_token": refreshToken,
|
||||||
"access_token": accessToken,
|
"access_token": accessToken,
|
||||||
|
|||||||
Reference in New Issue
Block a user