Logout in case no CSRF token provided while trying to change theme
This commit is contained in:
parent
1b4eeb386a
commit
ca0d973a24
1 changed files with 11 additions and 9 deletions
|
@ -21,23 +21,25 @@ checkRole(array('admin'));
|
|||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
$token = "";
|
||||
$parameters = explode("/", $layout['parameters']);
|
||||
if(count($parameters)==2) {
|
||||
$themeDirectory = $parameters[0];
|
||||
|
||||
// Verify CSRF Token
|
||||
$token = Sanitize::html($parameters[1]);
|
||||
if (!$security->validateTokenCSRF($token)) {
|
||||
Log::set(__FILE__.LOG_SEP.'Error occurred when trying to validate the tokenCSRF.', ALERT_STATUS_FAIL);
|
||||
Log::set(__FILE__.LOG_SEP.'Token in install theme ['.$token.']', ALERT_STATUS_FAIL);
|
||||
|
||||
Session::destroy();
|
||||
Redirect::page('login');
|
||||
} else {
|
||||
if ($security->validateTokenCSRF($token)) {
|
||||
// Activate theme
|
||||
activateTheme($themeDirectory);
|
||||
|
||||
// Redirect
|
||||
Redirect::page('themes');
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect
|
||||
Redirect::page('themes');
|
||||
Log::set(__FILE__.LOG_SEP.'Error occurred when trying to validate the tokenCSRF.', ALERT_STATUS_FAIL);
|
||||
Log::set(__FILE__.LOG_SEP.'Token in install theme ['.$token.']', ALERT_STATUS_FAIL);
|
||||
|
||||
Session::destroy();
|
||||
Redirect::page('login');
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue