mirror of
https://github.com/rejetto/hfs2.git
synced 2025-12-19 10:03:56 +01:00
fix: session logout not working
This commit is contained in:
parent
6bf82353b8
commit
8ff8a9ca22
@ -213,6 +213,7 @@ type
|
|||||||
function getHeader(h:string):string; // extract the value associated to the specified header field
|
function getHeader(h:string):string; // extract the value associated to the specified header field
|
||||||
function getCookie(k:string):string;
|
function getCookie(k:string):string;
|
||||||
procedure setCookie(k, v:string; pairs:array of string; extra:string='');
|
procedure setCookie(k, v:string; pairs:array of string; extra:string='');
|
||||||
|
procedure delCookie(k:string);
|
||||||
function getBuffer():ansistring;
|
function getBuffer():ansistring;
|
||||||
function initInputStream():boolean;
|
function initInputStream():boolean;
|
||||||
property address:string read P_address; // other peer ip address
|
property address:string read P_address; // other peer ip address
|
||||||
@ -1016,6 +1017,9 @@ if request.cookies = NIL then
|
|||||||
result:=decodeURL(ansistring(trim(request.cookies.values[k])));
|
result:=decodeURL(ansistring(trim(request.cookies.values[k])));
|
||||||
end; // getCookie
|
end; // getCookie
|
||||||
|
|
||||||
|
procedure ThttpConn.delCookie(k:string);
|
||||||
|
begin setCookie(k,'', ['expires','Thu, 01-Jan-70 00:00:01 GMT']) end;
|
||||||
|
|
||||||
procedure ThttpConn.setCookie(k, v:string; pairs:array of string; extra:string='');
|
procedure ThttpConn.setCookie(k, v:string; pairs:array of string; extra:string='');
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
|
|||||||
16
main.pas
16
main.pas
@ -355,6 +355,7 @@ type
|
|||||||
function sessionGet(k:string):string;
|
function sessionGet(k:string):string;
|
||||||
procedure sessionSet(k, v:string);
|
procedure sessionSet(k, v:string);
|
||||||
procedure disconnect(reason:string);
|
procedure disconnect(reason:string);
|
||||||
|
procedure logout();
|
||||||
end; // Tconndata
|
end; // Tconndata
|
||||||
|
|
||||||
Tautosave = record
|
Tautosave = record
|
||||||
@ -2300,6 +2301,16 @@ disconnectReason:=reason;
|
|||||||
conn.disconnect();
|
conn.disconnect();
|
||||||
end; // disconnect
|
end; // disconnect
|
||||||
|
|
||||||
|
procedure TconnData.logout();
|
||||||
|
begin
|
||||||
|
freeAndNIL(session);
|
||||||
|
sessions.delete(sessions.IndexOf(sessionID));
|
||||||
|
sessionID:='';
|
||||||
|
usr:='';
|
||||||
|
pwd:='';
|
||||||
|
conn.delCookie(SESSION_COOKIE);
|
||||||
|
end; // logout
|
||||||
|
|
||||||
function Tconndata.sessionGet(k:string):string;
|
function Tconndata.sessionGet(k:string):string;
|
||||||
begin
|
begin
|
||||||
try result:=session.values[k];
|
try result:=session.values[k];
|
||||||
@ -4469,7 +4480,7 @@ else if tplLast <> 0 then
|
|||||||
end; // keepTplUpdated
|
end; // keepTplUpdated
|
||||||
|
|
||||||
function getNewSID():string;
|
function getNewSID():string;
|
||||||
begin result:=floatToStr(random()) end;
|
begin result:=replaceStr(base64encode(str_(now())+str_(random())), '=','') end;
|
||||||
|
|
||||||
procedure setNewTplFile(fn:string);
|
procedure setNewTplFile(fn:string);
|
||||||
begin
|
begin
|
||||||
@ -5206,8 +5217,7 @@ var
|
|||||||
if s = '' then // logout
|
if s = '' then // logout
|
||||||
begin
|
begin
|
||||||
s:='ok';
|
s:='ok';
|
||||||
data.usr:='';
|
data.logout();
|
||||||
data.pwd:='';
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
s:='username not found'
|
s:='username not found'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user