Unigui:how to redirect and close session?

Source: Internet
Author: User



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?





    • 0
    • Report
#2 Delphi Developer


Advanced Member


    • Moderators
    • 726 posts


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?


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.