| @@ 35-45 (lines=11) @@ | ||
| 32 | $session = new Ajde_Session('AC.Form'); |
|
| 33 | if (!isset($post['_token']) || !$session->has('formTime')) { |
|
| 34 | $exception = new Ajde_Core_Exception_Security('No form token received or no form time set, bailing out to prevent CSRF attack'); |
|
| 35 | if (config('app.debug') === true) { |
|
| 36 | Ajde_Http_Response::setResponseType(Ajde_Http_Response::RESPONSE_TYPE_FORBIDDEN); |
|
| 37 | throw $exception; |
|
| 38 | } else { |
|
| 39 | // Prevent inf. loops |
|
| 40 | unset($_POST); |
|
| 41 | unset($_REQUEST); |
|
| 42 | // Rewrite |
|
| 43 | Ajde_Exception_Log::logException($exception); |
|
| 44 | Ajde_Http_Response::dieOnCode(Ajde_Http_Response::RESPONSE_TYPE_FORBIDDEN); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||
| 48 | $formToken = $post['_token']; |
|
| @@ 56-66 (lines=11) @@ | ||
| 53 | } else { |
|
| 54 | $exception = new Ajde_Core_Exception_Security('Form token timed out, bailing out to prevent CSRF attack'); |
|
| 55 | } |
|
| 56 | if (config('app.debug') === true) { |
|
| 57 | Ajde_Http_Response::setResponseType(Ajde_Http_Response::RESPONSE_TYPE_FORBIDDEN); |
|
| 58 | throw $exception; |
|
| 59 | } else { |
|
| 60 | // Prevent inf. loops |
|
| 61 | unset($_POST); |
|
| 62 | unset($_REQUEST); |
|
| 63 | // Rewrite |
|
| 64 | Ajde_Exception_Log::logException($exception); |
|
| 65 | Ajde_Http_Response::dieOnCode(Ajde_Http_Response::RESPONSE_TYPE_FORBIDDEN); |
|
| 66 | } |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||