Remove token from data and add to gin context
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user