Skip to content
Permalink
Browse files

Add token support for unencrypted config

  • Loading branch information...
tribut committed Apr 16, 2018
1 parent 48304bf commit 5a50743f81c8fa3e17b08182f7b760b5f276d96c
Showing with 8 additions and 0 deletions.
  1. +8 −0 server/views/unencrypted.go
@@ -29,6 +29,14 @@ func Create(c *gin.Context) {

once = c.PostForm("once") != ""
d := c.DefaultPostForm("duration", "1d")
token := c.PostForm("token")

if conf.C.Token != "" && conf.C.Token != token {
logger.ErrC(c, "server", "Incorrect token")
c.String(http.StatusUnauthorized, "Incorrect token\n")
c.AbortWithStatus(http.StatusUnauthorized)
return
}

if val, ok := models.DurationMap[d]; ok {
duration = val

0 comments on commit 5a50743

Please sign in to comment.
You can’t perform that action at this time.