mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 07:45:54 +01:00
fixed session timeout when timeout value is 0
This commit is contained in:
parent
808e3902d1
commit
72475e4b96
@ -29,6 +29,10 @@ interface
|
||||
uses System.SysUtils,
|
||||
System.Generics.Collections;
|
||||
|
||||
const
|
||||
|
||||
DEFAULT_SESSION_INACTIVITY = 60; // in minutes
|
||||
|
||||
type
|
||||
TWebSession = class abstract
|
||||
strict protected
|
||||
@ -136,7 +140,11 @@ end;
|
||||
|
||||
function TWebSession.IsExpired: Boolean;
|
||||
begin
|
||||
Result := MinutesBetween(now, LastAccess) > FTimeout;
|
||||
// spinettaro sessiontimeout -- if a session cookie has been choosed the inactivity time is 60 minutes
|
||||
if FTimeout = 0 then
|
||||
Result := MinutesBetween(now, LastAccess) > DEFAULT_SESSION_INACTIVITY
|
||||
else
|
||||
Result := MinutesBetween(now, LastAccess) > FTimeout;
|
||||
end;
|
||||
|
||||
procedure TWebSession.MarkAsUsed;
|
||||
|
@ -1268,7 +1268,11 @@ begin
|
||||
IsExpired := true;
|
||||
if List.TryGetValue(ASessionID, Result) then
|
||||
begin
|
||||
IsExpired := MinutesBetween(Now, Result.LastAccess) > ASessionTimeout;
|
||||
// spinettaro sessiontimeout -- if a session cookie has been choosed the inactivity time is 60 minutes
|
||||
if ASessionTimeout = 0 then
|
||||
IsExpired := MinutesBetween(Now, Result.LastAccess) > DEFAULT_SESSION_INACTIVITY
|
||||
else
|
||||
IsExpired := MinutesBetween(Now, Result.LastAccess) > ASessionTimeout;
|
||||
// StrToInt(Config.Value['sessiontimeout']);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user