Skip to content

Commit

Permalink
CSRF tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Jan 17, 2022
1 parent 78413af commit c2fa19a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lhc_web/design/defaulttheme/tpl/lhchat/cannedmsgedit.tpl.php
Expand Up @@ -12,6 +12,8 @@

<form action="<?php echo erLhcoreClassDesign::baseurl('chat/cannedmsgedit')?>/<?php echo $canned_message->id?>" method="post" onsubmit="return confirmSave()">

<?php include(erLhcoreClassDesign::designtpl('lhkernel/csfr_token.tpl.php'));?>

<?php include(erLhcoreClassDesign::designtpl('lhchat/cannedmsgform.tpl.php'));?>

<div class="btn-group" role="group" aria-label="...">
Expand Down
4 changes: 3 additions & 1 deletion lhc_web/design/defaulttheme/tpl/lhchat/newcannedmsg.tpl.php
Expand Up @@ -5,7 +5,9 @@
<?php endif; ?>

<form action="<?php echo erLhcoreClassDesign::baseurl('chat/newcannedmsg')?>" method="post">


<?php include(erLhcoreClassDesign::designtpl('lhkernel/csfr_token.tpl.php'));?>

<?php include(erLhcoreClassDesign::designtpl('lhchat/cannedmsgform.tpl.php'));?>

<div class="btn-group" role="group" aria-label="...">
Expand Down
5 changes: 5 additions & 0 deletions lhc_web/modules/lhchat/cannedmsgedit.php
Expand Up @@ -29,6 +29,11 @@

if (isset($_POST['Update_action']) || isset($_POST['Save_action']) )
{
if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
erLhcoreClassModule::redirect('chat/cannedmsg');
exit;
}

$previousState = $Msg->getState();

$Errors = erLhcoreClassAdminChatValidatorHelper::validateCannedMessage($Msg, $userDepartments);
Expand Down
5 changes: 5 additions & 0 deletions lhc_web/modules/lhchat/newcannedmsg.php
Expand Up @@ -17,6 +17,11 @@

if (isset($_POST['Save_action']))
{
if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
erLhcoreClassModule::redirect('chat/cannedmsg');
exit;
}

$Errors = erLhcoreClassAdminChatValidatorHelper::validateCannedMessage($CannedMessage, $userDepartments);

erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_newcannedmsg', array('departments' => $userDepartments, 'scope' => 'global', 'errors' => & $Errors, 'msg' => & $CannedMessage));
Expand Down
5 changes: 5 additions & 0 deletions lhc_web/modules/lhgroupchat/options.php
Expand Up @@ -8,6 +8,11 @@

if ( isset($_POST['StoreOptions']) ) {

if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
erLhcoreClassModule::redirect('groupchat/options');
exit;
}

$definition = array(
'supervisor' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'int'
Expand Down
5 changes: 5 additions & 0 deletions lhc_web/modules/lhnotifications/settings.php
Expand Up @@ -7,6 +7,11 @@

if ( isset($_POST['StoreOptions']) ) {

if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
erLhcoreClassModule::redirect('notifications/index');
exit;
}

$definition = array(
'enabled' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'boolean'
Expand Down

0 comments on commit c2fa19a

Please sign in to comment.