added user logout
parent
12cff8e623
commit
8f76aa49bd
|
@ -67,6 +67,20 @@ func UserLogin(c *fiber.Ctx) error {
|
||||||
return c.JSON(structs.UserLoginResponse{Session: session})
|
return c.JSON(structs.UserLoginResponse{Session: session})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func UserLogout(c *fiber.Ctx) error {
|
||||||
|
session := utils.GetXAuhorizationHeader(c)
|
||||||
|
|
||||||
|
if len(session) != utils.LenHeaderXAuthorization {
|
||||||
|
return c.SendStatus(fiber.StatusUnauthorized)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info().Msg(session)
|
||||||
|
|
||||||
|
database.DB.Delete(&structs.UserSession{}, "id = ?", session)
|
||||||
|
|
||||||
|
return c.SendStatus(fiber.StatusCreated)
|
||||||
|
}
|
||||||
|
|
||||||
func validatePasswordLength(password string) bool {
|
func validatePasswordLength(password string) bool {
|
||||||
lenPassword := len(password)
|
lenPassword := len(password)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue