uniGUI login system (database based) in General Posted May 4, 2019 hi. I made this way so that other users can switch automatically procedure TUniMainModule.UniGUIMainModuleBeforeLogin(Sender: TObject; var Handled: Boolean); var S1,S2:string; begin S1 := (Sender as TUniGUISession).UniApplication.Cookies.Values['_loginname']; S2 := (Sender as TUniGUISession).UniApplication.Cookies.Values['_pwd']; loginQuery.SQL.Text := 'SELECT USERNAME, PASS FROM KULLAN WHERE USERNAME=:USERNAME AND PASS=:PASS'; loginQuery.Params.ParamByName('USERNAME').Value := S1; loginQuery.Params.ParamByName('PASS').Value := S2; UniMainModule.loginQuery.Open; if not UniMainModule.loginQuery.IsEmpty then begin Handled := SameText(S1,S1) and SameText(S2,S2); if Handled then LoggedUser := S1; end; end; log out UniApplication.Cookies.SetCookie('_loginname','',Date-1); UniApplication.Cookies.SetCookie('_pwd','',Date-1); UniApplication.Restart; 1
uniGUI login system (database based)
in General
Posted
hi.
I made this way so that other users can switch automatically
procedure TUniMainModule.UniGUIMainModuleBeforeLogin(Sender: TObject; var Handled: Boolean);
var
S1,S2:string;
begin
S1 := (Sender as TUniGUISession).UniApplication.Cookies.Values['_loginname'];
S2 := (Sender as TUniGUISession).UniApplication.Cookies.Values['_pwd'];
loginQuery.SQL.Text := 'SELECT USERNAME, PASS FROM KULLAN WHERE USERNAME=:USERNAME AND PASS=:PASS';
loginQuery.Params.ParamByName('USERNAME').Value := S1;
loginQuery.Params.ParamByName('PASS').Value := S2;
UniMainModule.loginQuery.Open;
if not UniMainModule.loginQuery.IsEmpty then
begin
Handled := SameText(S1,S1) and SameText(S2,S2);
if Handled then
LoggedUser := S1;
end;
end;
log out
UniApplication.Cookies.SetCookie('_loginname','',Date-1);
UniApplication.Cookies.SetCookie('_pwd','',Date-1);
UniApplication.Restart;