renamed session to sessions

This commit is contained in:
bunkerity 2023-04-11 17:10:02 +02:00
parent 4cd3fc6447
commit 1ec83f256d
2 changed files with 19 additions and 19 deletions

View File

@ -1,11 +1,11 @@
{
"id": "session",
"id": "sessions",
"order": 999,
"name": "Session",
"name": "Sessions",
"description": "Management of session used by other plugins.",
"version": "0.1",
"settings": {
"SESSION_SECRET": {
"SESSIONS_SECRET": {
"context": "global",
"default": "random",
"help": "Secret used to encrypt sessions variables for storing data related to challenges.",
@ -14,7 +14,7 @@
"regex": "^\\w+$",
"type": "password"
},
"SESSION_NAME": {
"SESSIONS_NAME": {
"context": "global",
"default": "random",
"help": "Name of the cookie given to clients.",
@ -23,7 +23,7 @@
"regex": "^\\w+$",
"type": "text"
},
"SESSION_IDLING_TIMEOUT": {
"SESSIONS_IDLING_TIMEOUT": {
"context": "global",
"default": "1800",
"help": "Maximum time (in seconds) of inactivity before the session is invalidated.",
@ -32,7 +32,7 @@
"regex": "^\\d+$",
"type": "text"
},
"SESSION_ROLLING_TIMEOUT": {
"SESSIONS_ROLLING_TIMEOUT": {
"context": "global",
"default": "3600",
"help": "Maximum time (in seconds) before a session must be renewed.",
@ -41,7 +41,7 @@
"regex": "^\\d+$",
"type": "text"
},
"SESSION_ABSOLUTE_TIMEOUT": {
"SESSIONS_ABSOLUTE_TIMEOUT": {
"context": "global",
"default": "86400",
"help": "Maximum time (in seconds) before a session is destroyed.",

View File

@ -12,11 +12,11 @@ end
function _M:init()
-- Get vars
local vars = {
["SESSION_SECRET"] = "",
["SESSION_NAME"] = "",
["SESSION_IDLING_TIMEOUT"] = "",
["SESSION_ROLLING_TIMEOUT"] = "",
["SESSION_ABSOLUTE_TIMEOUT"] = "",
["SESSIONS_SECRET"] = "",
["SESSIONS_NAME"] = "",
["SESSIONS_IDLING_TIMEOUT"] = "",
["SESSIONS_ROLLING_TIMEOUT"] = "",
["SESSIONS_ABSOLUTE_TIMEOUT"] = "",
["USE_REDIS"] = "",
["REDIS_HOST"] = "",
["REDIS_PORT"] = "",
@ -33,16 +33,16 @@ function _M:init()
end
-- Init configuration
local config = {
secret = vars["SESSION_SECRET"],
cookie_name = vars["SESSION_NAME"],
idling_timeout = tonumber(vars["SESSION_IDLING_TIMEOUT"]),
rolling_timeout = tonumber(vars["SESSION_ROLLING_TIMEOUT"]),
absolute_timeout = tonumber(vars["SESSION_ABSOLUTE_TIMEOUT"])
secret = vars["SESSIONS_SECRET"],
cookie_name = vars["SESSIONS_NAME"],
idling_timeout = tonumber(vars["SESSIONS_IDLING_TIMEOUT"]),
rolling_timeout = tonumber(vars["SESSIONS_ROLLING_TIMEOUT"]),
absolute_timeout = tonumber(vars["SESSIONS_ABSOLUTE_TIMEOUT"])
}
if vars["SESSION_SECRET"] == "random" then
if vars["SESSIONS_SECRET"] == "random" then
config.secret = utils.rand(16)
end
if vars["SESSION_NAME"] == "random" then
if vars["SESSIONS_NAME"] == "random" then
config.cookie_name = utils.rand(16)
end
if vars["USE_REDIS"] == "no" then