예제 #1
0
        public IActionResult setStatus(string sessionKey, string code)
        {
            var res = _context.sessionCodeIsEqual(sessionKey, code, HttpContext.Request.Headers["Api-Key"]);

            _context.setSessionStatus(sessionKey, HttpContext.Request.Headers["Api-Key"], res);
            if (!res)
            {
                return(BadRequest("Code is invalid"));
            }
            return(Ok());
        }
예제 #2
0
            public void OnActionExecuting(ActionExecutingContext context)
            {
                string session = context.HttpContext.Request.Headers["SessionCaptcha"];
                string code    = context.HttpContext.Request.Headers["CodeCaptcha"];

                if (session == null || code == null)
                {
                    context.Result = new BadRequestResult();
                }
                var result = _context.sessionCodeIsEqual(session, code, ApiKey);

                _context.setSessionStatus(session, ApiKey, result);
                if (!result)
                {
                    context.Result = new BadRequestObjectResult("invalid code");
                }
            }