Time Conditions: Token integration.

This commit is contained in:
Nate 2019-09-19 07:39:16 -06:00
parent c224da7062
commit a6d67add56
1 changed files with 13 additions and 0 deletions

View File

@ -87,6 +87,14 @@
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: time_conditions.php');
exit;
}
//check for all required data
//if (strlen($domain_uuid) == 0) { $msg .= $text['label-required-domain_uuid']."<br>\n"; }
if (strlen($dialplan_name) == 0) { $msg .= $text['label-required-dialplan_name']."<br>\n"; }
@ -586,6 +594,10 @@
//set the defaults
if (strlen($dialplan_context) == 0) { $dialplan_context = $_SESSION['domain_name']; }
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
//include the header
require_once "resources/header.php";
@ -1208,6 +1220,7 @@ if ($action == 'update') {
if ($action == "update") {
echo " <input type='hidden' name='dialplan_uuid' value='".escape($dialplan_uuid)."'>\n";
}
echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo "</div>";