MCPcopy Index your code
hub / github.com/TruthHun/DocHub / Xsrf

Method Xsrf

controllers/HomeControllers/BaseController.go:84–87  ·  view source on GitHub ↗

防止跨站攻击,在有表单的控制器放大中调用,不要直接在base控制器中调用,因为用户每访问一个页面都重新刷新cookie了

()

Source from the content-addressed store, hash-verified

82
83//防止跨站攻击,在有表单的控制器放大中调用,不要直接在base控制器中调用,因为用户每访问一个页面都重新刷新cookie了
84func (this *BaseController) Xsrf() {
85 //使用的时候,直接在模板表单添加{{.xsrfdata}}
86 this.Data["xsrfdata"] = template.HTML(this.XSRFFormHTML())
87}
88
89//检测用户登录的cookie是否存在
90func (this *BaseController) checkCookieLogin() {

Callers 4

PrepareMethod · 0.45
GetMethod · 0.45
GetMethod · 0.45
GetMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected