Example #1
0
/**
 *	custom check form token
 *
 *	@param true is pass
 */
func (ctx *HttpContext) CheckFormTokenByString(token string) bool {
	if 0 == len(token) {
		return false
	}

	session, err := ctx.Session(false)
	if nil == session || nil != err {
		return false
	}

	return session.CheckFormTokenSignature(token)
}
Example #2
0
/**
 *	check form token
 *
 *	@return true is pass
 */
func (ctx *HttpContext) CheckFormToken() bool {

	formVals := ctx.Request.Form
	if 0 == len(formVals) {
		return false
	}

	hideVal := ctx.Request.Form.Get(HTML_FORM_TOKEN_NAME)
	if 0 == len(hideVal) {
		return false
	}

	session, err := ctx.Session(false)
	if nil == session || nil != err {
		return false
	}

	return session.CheckFormTokenSignature(hideVal)

}