Hello,
I would have 2 Unigui apps.
The first app is a simple authentification app and second'll be the main app.
I ' d like to have the following scenario.
User "Paul" arrive on the Auth app
Paul set his login and password.
The Auth app redirect Paul to a other server with some parameters (sended with Post method) and session on Auth app would Close.
The main app read "Post parameters" and begin a user session. On close or on timeout in the main app the user would be redirect to the Auth app.
To sum up,
How can I do a redirect with parameters (Post method) and close the current session?
#2 Delphi Developer
Advanced Member
Posted September 2015-05:43 AM
Delagoutte, on Sept 2015-11:47 PM, said:
The Auth app redirect Paul to a other server with some parameters (sended with Post method) and session on Auth app would Close.
The main app read "Post parameters" and begin a user session. On close or on timeout in the main app the user would be redirect to the Auth app.
To sum up,
How can I do a redirect with parameters (Post method) and close the current session?
Hi
I think there is several ways to redirect to another server with some parametersfrom the first app, for Exa Mple, one of these:
First app:
procedure TMainForm.UniButton1Click(Sender: TObject);
begin
UniSession.AddJS(
‘var f = document.createElement("form"); ‘+
‘f.action="http://localhost:8079"; ‘+ // the second app url
‘f.method="POST"; ‘+
‘var i=document.createElement("input"); ‘+ // username
‘i.type="hidden"; ‘+
‘i.name="username"; ‘+
‘i.value="login"; ‘+
‘f.appendChild(i); ‘+
‘var i2=document.createElement("input"); ‘+ // password
‘i2.type="hidden"; ‘+
‘i2.name="password"; ‘+
‘i2.value="pwd"; ‘+
‘f.appendChild(i2); ‘+
‘document.body.appendChild(f); ‘+
‘f.submit(); ‘
);
end;
.. and session on Auth app would close ...
I think here too, there is several ways maybe you can use the timer on the first app after th E Call redirection??:
procedure TMainForm.UniTimer1Timer(Sender: TObject);
begin
UniSession.Terminate();
end;
Second app:
Firstly, need to analyze the demo project:
C:Files(x86)\fmsoft\framework\unigui\demos\desktop\urlparameters...
.. On close or on timeout in the main app the user would be redirect to the Auth app ...
UniServerModule.ServerMessages.TerminateTemplate.:
http://forums.unigui...ose/#entry28523
<html>
<script>
function redirect() {
location.href = "http://localhost:8077"; // first app url
}
window.onpaint = redirect();
</script>
<body bgcolor="#dfe8f6">
</body>
</html>
Try ...
Best regards.
Unigui:how to redirect and close session?