Fix logins from WHMCS by disabling CSRF token on login page for trusted
origins
This commit is contained in:
parent
ca7d0688e7
commit
a62e98beb4
2 changed files with 31 additions and 11 deletions
|
@ -11,17 +11,19 @@ class CORSHelper
|
|||
$response = $response->setHeader('Access-Control-Allow-Origin', '*');
|
||||
$origin = $request->getHeader('Origin');
|
||||
if ((!(preg_match("/https?:\/\/localhost/", $origin) === 1)) && ($origin != "") &&
|
||||
(!in_array($origin,
|
||||
array("http://www.airtime.pro",
|
||||
"https://www.airtime.pro",
|
||||
"https://account.sourcefabric.com",
|
||||
"http://" . $_SERVER['SERVER_NAME'],
|
||||
"https://" . $_SERVER['SERVER_NAME']
|
||||
))
|
||||
))
|
||||
(!in_array($origin, self::getAllowedOrigins())))
|
||||
{
|
||||
//Don't allow CORS from other domains to prevent XSS.
|
||||
throw new Zend_Controller_Action_Exception('Forbidden', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getAllowedOrigins()
|
||||
{
|
||||
return array("http://www.airtime.pro",
|
||||
"https://www.airtime.pro",
|
||||
"https://account.sourcefabric.com",
|
||||
"http://" . $_SERVER['SERVER_NAME'],
|
||||
"https://" . $_SERVER['SERVER_NAME']);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue