mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-25 12:50:56 +00:00
ensure csrf token available to activate repo
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/drone/drone/model"
|
"github.com/drone/drone/model"
|
||||||
"github.com/drone/drone/router/middleware/context"
|
"github.com/drone/drone/router/middleware/context"
|
||||||
|
"github.com/drone/drone/shared/token"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -66,6 +67,14 @@ func SetRepo() gin.HandlerFunc {
|
|||||||
// if we found a repository, we should display a page
|
// if we found a repository, we should display a page
|
||||||
// to the user allowing them to activate.
|
// to the user allowing them to activate.
|
||||||
if repo != nil && len(repo.FullName) != 0 {
|
if repo != nil && len(repo.FullName) != 0 {
|
||||||
|
// we should probably move this code to a
|
||||||
|
// separate route, but for now we need to
|
||||||
|
// add a CSRF token.
|
||||||
|
data["Csrf"], _ = token.New(
|
||||||
|
token.CsrfToken,
|
||||||
|
user.Login,
|
||||||
|
).Sign(user.Hash)
|
||||||
|
|
||||||
c.HTML(http.StatusNotFound, "repo_activate.html", data)
|
c.HTML(http.StatusNotFound, "repo_activate.html", data)
|
||||||
} else {
|
} else {
|
||||||
c.HTML(http.StatusNotFound, "404.html", data)
|
c.HTML(http.StatusNotFound, "404.html", data)
|
||||||
|
Reference in New Issue
Block a user