Skip to content
Permalink
Browse files

Merge pull request #67 from tribut/token-unencrypted

Add token support for unencrypted config
  • Loading branch information...
Depado committed Apr 16, 2018
2 parents 48304bf + 5a50743 commit 5c8181c6a9347b628df8eb52d949efbaa0a1aba7
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 5c8181c

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