Documentation ¶
Index ¶
- Constants
- Variables
- func AccessControl(ctx echo.Context)
- func CheckIsHttps(ctx echo.Context) bool
- func GenToken(uid int) string
- func GetCookieSession(ctx echo.Context) *sessions.Session
- func GetFromCookie(ctx echo.Context, key string) string
- func ParseToken(token string) (int, bool)
- func Render(ctx echo.Context, contentTpl string, data map[string]interface{}) error
- func RenderAdmin(ctx echo.Context, contentTpl string, data map[string]interface{}) error
- func RenderQuery(ctx echo.Context, contentTpl string, data map[string]interface{}) error
- func Request(ctx echo.Context) *http.Request
- func ResponseWriter(ctx echo.Context) http.ResponseWriter
- func SetCookie(ctx echo.Context, key, value string)
- func SetLoginCookie(ctx echo.Context, username string)
- func ValidateToken(token string) bool
Constants ¶
View Source
const ( LayoutTpl = "common/layout.html" AdminLayoutTpl = "common.html" )
View Source
const ( TokenSalt = "b3%JFOykZx_golang_polaris" NeedReLoginCode = 600 )
Variables ¶
View Source
var Store = sessions.NewCookieStore([]byte(setting.Get().GetString("global.cookie_secret")))
Functions ¶
func AccessControl ¶
func CheckIsHttps ¶
若是处于代理后边,代理应该转发一个X-Forwarded-Proto来表示请求的协议
func ParseToken ¶
func RenderAdmin ¶
RenderAdmin html 输出
func RenderQuery ¶
后台 query 查询返回结果
func ResponseWriter ¶
func ResponseWriter(ctx echo.Context) http.ResponseWriter
func SetLoginCookie ¶
func ValidateToken ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.