Remove token from data and add to gin context

This commit is contained in:
2021-12-02 20:04:18 +00:00
parent e7c9a7f52f
commit 36bccce021
4 changed files with 13 additions and 29 deletions

View File

@ -54,6 +54,7 @@ func (h *Handler) Serve() {
authenticatedFrontend.GET("/dashboard", h.dashboard)
authenticatedFrontend.GET("/budget/:budgetid", h.budget)
authenticatedFrontend.GET("/budget/:budgetid/accounts", h.accounts)
authenticatedFrontend.GET("/admin", h.admin)
}
api := router.Group("/api/v1")
{
@ -126,17 +127,17 @@ func (h *Handler) importYNAB(c *gin.Context) {
}
func (h *Handler) verifyLoginWithRedirect(c *gin.Context) {
_, err := h.verifyLogin(c)
token, err := h.verifyLogin(c)
if err != nil {
c.Redirect(http.StatusTemporaryRedirect, "/login")
return
}
c.Set("token", token)
c.Next()
}
func (h *Handler) newTransaction(c *gin.Context) {
transactionMemo, succ := c.GetPostForm("memo")
if !succ {
c.AbortWithStatus(http.StatusNotAcceptable)