Skip to content

Commit

Permalink
Set the expiry on the session cookie. Fixes #113.\nThis commit adds a…
Browse files Browse the repository at this point in the history
… new settings property, 'sessionlifetime', so we need to add in #83 now.
  • Loading branch information
sbrl committed Sep 30, 2016
1 parent 59f2b2c commit e3ccc41
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
"max_recent_changes": {"type": "number", "description": "The maximum number of recent changes to display on the recent changes page.", "default": 512},
"export_allow_only_admins": {"type": "checkbox", "description": "Whether to only allow adminstrators to export the your wiki as a zip using the page-export module.", "default": false},
"sessionprefix": {"type": "text", "description": "You shouldn't need to change this. The prefix that should be used in the names of the session variables. Defaults to \"auto\", which automatically generates this field. See the readme for more information.", "default": "auto"},
"sessionlifetime": { "type": "number", "description": "Again, you shouldn't need to change this under normal circumstances. This setting controls the lifetime of a login session. Defaults to 24 hours, but it may get cut off sooner depending on the underlying PHP session lifetime.", "default": 86400 },
"css": {"type": "textarea", "description": "A string of css to include. Will be included in the <head> of every page inside a <style> tag. This may also be a url - urls will be referenced via a <link rel='stylesheet' /> tag.", "default": "auto"}
}
GUICONFIG;
Expand Down Expand Up @@ -338,6 +339,8 @@
$paths->upload_file_prefix = "Files/"; // The prefix to append to uploaded files

session_start();
// Make sure that the login cookie lasts beyond the end of the user's session
setcookie(session_name(), session_id(), time() + $settings->sessionlifetime);
///////// Login System /////////
// Clear expired sessions
if(isset($_SESSION[$settings->sessionprefix . "-expiretime"]) and
Expand Down
2 changes: 2 additions & 0 deletions core.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
$paths->upload_file_prefix = "Files/"; // The prefix to append to uploaded files

session_start();
// Make sure that the login cookie lasts beyond the end of the user's session
setcookie(session_name(), session_id(), time() + $settings->sessionlifetime);
///////// Login System /////////
// Clear expired sessions
if(isset($_SESSION[$settings->sessionprefix . "-expiretime"]) and
Expand Down
1 change: 1 addition & 0 deletions peppermint.guiconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,6 @@
"max_recent_changes": {"type": "number", "description": "The maximum number of recent changes to display on the recent changes page.", "default": 512},
"export_allow_only_admins": {"type": "checkbox", "description": "Whether to only allow adminstrators to export the your wiki as a zip using the page-export module.", "default": false},
"sessionprefix": {"type": "text", "description": "You shouldn't need to change this. The prefix that should be used in the names of the session variables. Defaults to \"auto\", which automatically generates this field. See the readme for more information.", "default": "auto"},
"sessionlifetime": { "type": "number", "description": "Again, you shouldn't need to change this under normal circumstances. This setting controls the lifetime of a login session. Defaults to 24 hours, but it may get cut off sooner depending on the underlying PHP session lifetime.", "default": 86400 },
"css": {"type": "textarea", "description": "A string of css to include. Will be included in the <head> of every page inside a <style> tag. This may also be a url - urls will be referenced via a <link rel='stylesheet' /> tag.", "default": "auto"}
}

0 comments on commit e3ccc41

Please sign in to comment.