Remember last login

This commit is contained in:
2021-12-06 20:38:55 +00:00
parent 1437fc7b8d
commit e3cf69ab08
5 changed files with 40 additions and 9 deletions

View File

@ -82,9 +82,9 @@ func (h *Handler) loginPost(c *gin.Context) {
c.AbortWithError(http.StatusUnauthorized, err)
}
_, _ = h.Service.DB.UpdateLastLogin(context.Background(), user.ID)
maxAge := (int)((expiration * time.Hour).Seconds())
c.SetCookie(authCookie, t, maxAge, "", "", false, true)
c.JSON(http.StatusOK, map[string]string{
"token": t,
})