add logout
This commit is contained in:
@@ -43,18 +43,25 @@ func Login(c echo.Context) (err error) {
|
||||
}
|
||||
|
||||
c.SetCookie(&http.Cookie{
|
||||
Name: "accessToken",
|
||||
Value: _token,
|
||||
Path: "/",
|
||||
MaxAge: 31536000,
|
||||
Expires: time.Now().Add(24 * time.Hour),
|
||||
Secure: true,
|
||||
SameSite: 4,
|
||||
Name: "accessToken",
|
||||
Value: _token,
|
||||
Path: "/",
|
||||
Expires: time.Now().Add(24 * time.Hour),
|
||||
})
|
||||
|
||||
return c.JSON(http.StatusOK, u)
|
||||
}
|
||||
|
||||
func Logout(c echo.Context) error {
|
||||
c.SetCookie(&http.Cookie{
|
||||
Name: "accessToken",
|
||||
Value: "",
|
||||
Path: "/",
|
||||
Expires: time.Unix(0, 0),
|
||||
})
|
||||
return c.NoContent(http.StatusOK)
|
||||
}
|
||||
|
||||
func GetCurrentUser(c echo.Context) error {
|
||||
data, err, _ := api.GetRequest(config.Env.MSHosts.UsersHost+"/me", c.Request().Header)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user