Skip to content

Commit 9da3f3b

Browse files
committed
Security: Set cookie as secure if HTTPS - refs BT#21289
1 parent 1d1f3bc commit 9da3f3b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

main/calendar/agenda_js.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,12 @@
396396

397397
$tpl->assign('group_id', (!empty($group_id) ? $group_id : 0));
398398

399+
if (api_is_https()) {
400+
$tpl->assign('is_https', 1);
401+
} else {
402+
$tpl->assign('is_https', 0);
403+
}
404+
399405
$templateName = $tpl->get_template('agenda/month.tpl');
400406
$content = $tpl->fetch($templateName);
401407
$tpl->assign('content', $content);

main/template/default/agenda/month.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ $(function() {
266266
'view': view.name,
267267
'start': view.intervalStart.format("YYYY-MM-DD")
268268
};
269-
Cookies.set('agenda_cookies', data, 1); // Expires 1 day
269+
Cookies.set('agenda_cookies', data, { expires: 1{% if is_https %}, secure: true{% endif %} }); // Expires 1 day
270270
},
271271
// Add event
272272
select: function(start, end, jsEvent, view) {

0 commit comments

Comments
 (0)