mirror of https://github.com/mindoc-org/mindoc.git
style:格式化代码
parent
ead36721d4
commit
1ecdb10303
|
@ -1,15 +1,15 @@
|
||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"net/url"
|
|
||||||
|
|
||||||
"github.com/lifei6671/mindoc/mail"
|
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
"github.com/lifei6671/gocaptcha"
|
"github.com/lifei6671/gocaptcha"
|
||||||
"github.com/lifei6671/mindoc/conf"
|
"github.com/lifei6671/mindoc/conf"
|
||||||
|
"github.com/lifei6671/mindoc/mail"
|
||||||
"github.com/lifei6671/mindoc/models"
|
"github.com/lifei6671/mindoc/models"
|
||||||
"github.com/lifei6671/mindoc/utils"
|
"github.com/lifei6671/mindoc/utils"
|
||||||
"html/template"
|
"html/template"
|
||||||
|
@ -31,7 +31,7 @@ func (c *AccountController) referer() string {
|
||||||
func (c *AccountController) Prepare() {
|
func (c *AccountController) Prepare() {
|
||||||
c.BaseController.Prepare()
|
c.BaseController.Prepare()
|
||||||
c.EnableXSRF = true
|
c.EnableXSRF = true
|
||||||
c.Data["xsrfdata"]=template.HTML(c.XSRFFormHTML())
|
c.Data["xsrfdata"] = template.HTML(c.XSRFFormHTML())
|
||||||
if c.Ctx.Input.IsPost() {
|
if c.Ctx.Input.IsPost() {
|
||||||
token := c.Ctx.Input.Query("_xsrf")
|
token := c.Ctx.Input.Query("_xsrf")
|
||||||
if token == "" {
|
if token == "" {
|
||||||
|
@ -42,7 +42,7 @@ func (c *AccountController) Prepare() {
|
||||||
}
|
}
|
||||||
if token == "" {
|
if token == "" {
|
||||||
if c.IsAjax() {
|
if c.IsAjax() {
|
||||||
c.JsonResult(403,"非法请求")
|
c.JsonResult(403, "非法请求")
|
||||||
} else {
|
} else {
|
||||||
c.ShowErrorPage(403, "非法请求")
|
c.ShowErrorPage(403, "非法请求")
|
||||||
}
|
}
|
||||||
|
@ -50,13 +50,14 @@ func (c *AccountController) Prepare() {
|
||||||
xsrfToken := c.XSRFToken()
|
xsrfToken := c.XSRFToken()
|
||||||
if xsrfToken != token {
|
if xsrfToken != token {
|
||||||
if c.IsAjax() {
|
if c.IsAjax() {
|
||||||
c.JsonResult(403,"非法请求")
|
c.JsonResult(403, "非法请求")
|
||||||
} else {
|
} else {
|
||||||
c.ShowErrorPage(403, "非法请求")
|
c.ShowErrorPage(403, "非法请求")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Login 用户登录
|
// Login 用户登录
|
||||||
func (c *AccountController) Login() {
|
func (c *AccountController) Login() {
|
||||||
c.Prepare()
|
c.Prepare()
|
||||||
|
|
Loading…
Reference in New Issue