Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BackendLoginCheckFilter = func(ctx *context.Context) { if ctx.Request.URL.Path == "/backend/login" { return } tokenHeader := ctx.Request.Header["Token"] if len(tokenHeader) <= 0 { ctx.Abort(403, "NO AUTH") } sign := utils.SHA256Encode(os.Getenv("BACKEND_USER") + os.Getenv("BACKEND_PASS")) if sign != tokenHeader[0] { ctx.Abort(403, "NO AUTH") } }
View Source
var LoginCheckFilter = func(ctx *context.Context) { userId := ctx.GetCookie("login_user_id") userSign := ctx.GetCookie("login_user_sign") user := models.Users{} if err := orm.NewOrm().QueryTable("users").Filter("id", userId).One(&user); err != nil { ctx.Redirect(302, beego.URLFor("UserController.Login")) return } if utils.AuthSignCheck(user.Id, user.Email, user.Password, userSign) == false { ctx.Redirect(302, beego.URLFor("UserController.Login")) return } }
Functions ¶
func BackendLoginCheck ¶
func BackendLoginCheck()
func CorsHandler ¶
func CorsHandler()
func LoginCheck ¶
func LoginCheck()
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.