@@ -7,4 +7,4 @@ |
||
| 7 | 7 | * Csrf token timeout exception |
| 8 | 8 | * @autho: Julfiker <[email protected]> |
| 9 | 9 | */ |
| 10 | -class CsrfTimeOutException extends Exception {protected $massage = "Token already expired! please try again.";} |
|
| 10 | +class CsrfTimeOutException extends Exception {protected $massage = "Token already expired! please try again."; } |
|
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | public function generateToken() { |
| 91 | 91 | $sesId = session_id(); |
| 92 | 92 | if (!$sesId) |
| 93 | - $sesId = session_id("UN_AUTHORIZED"); |
|
| 93 | + $sesId = session_id("UN_AUTHORIZED"); |
|
| 94 | 94 | |
| 95 | 95 | $this->CSRFToken = md5($sesId+self::SLAT+time()); |
| 96 | 96 | $minutes = $this->tokenValidInMinutes; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | if (!$this->session->has(self::SESSION_STORE_TOKEN_NAME) || $this->_isTokenExpired()) |
| 131 | 131 | $this->refreshToken(); |
| 132 | 132 | |
| 133 | - return $this->session->get(self::SESSION_STORE_TOKEN_NAME); |
|
| 133 | + return $this->session->get(self::SESSION_STORE_TOKEN_NAME); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | public function checkToken() { |
| 73 | 73 | $pass = false; |
| 74 | 74 | $method = $this->request->getRealMethod(); |
| 75 | - if (in_array($method, ['PUT','POST','DELETE'])) { |
|
| 75 | + if (in_array($method, [ 'PUT', 'POST', 'DELETE' ])) { |
|
| 76 | 76 | $csrfToken = $this->getRequest()->get($this->getTokenFieldName()); |
| 77 | 77 | if ($csrfToken && $this->getStorageToken() == $csrfToken) { |
| 78 | 78 | $pass = true; |