FIX about session cookie

This commit is contained in:
danieleteti 2016-02-28 18:35:50 +01:00
parent 51feaf2f33
commit 80be08f7fc

View File

@ -1089,14 +1089,16 @@ class function TMVCEngine.SendSessionCookie(AContext: TWebContext;
ASessionID: string): string; ASessionID: string): string;
var var
Cookie: TCookie; Cookie: TCookie;
LSessTimeout: Integer;
begin begin
Cookie := AContext.Response.Cookies.Add; Cookie := AContext.Response.Cookies.Add;
Cookie.Name := TMVCConstants.SESSION_TOKEN_NAME; Cookie.Name := TMVCConstants.SESSION_TOKEN_NAME;
Cookie.Value := ASessionID; Cookie.Value := ASessionID;
// danieleteti - reintroduced sessiontimeout LSessTimeout := StrToIntDef(AContext.Config[TMVCConfigKey.SessionTimeout], 0);
Cookie.Expires := now + OneMinute * if LSessTimeout = 0 then
strtoint(AContext.Config[TMVCConfigKey.SessionTimeout]); Cookie.Expires := 0
Cookie.Expires := 0; // session cookie; else
Cookie.Expires := now + OneMinute * LSessTimeout;
Cookie.Path := '/'; Cookie.Path := '/';
Result := ASessionID; Result := ASessionID;
end; end;