Jump to content

redirect and close session


delagoutte
 Share

Recommended Posts

Hello,

i would have 2 unigui app.

 

the first app is a simple authentification app and second will 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 an other server with some parameters( sended with post method) and session on auth app will close.

the main app read "post parameters" and begin a user session. on close or on timeout in the main app the user will be redirect to the auth app.

 

To sum up,

how can i do a redirect with parameters (post method) and close current session ?

 

Link to comment
Share on other sites

the auth app redirect paul  to an other server with some parameters( sended with post method) and session on auth app will close.

the main app read "post parameters" and begin a user session. on close or on timeout in the main app the user will be redirect to the auth app.

 

To sum up,

how can i do a redirect with parameters (post method) and close current session ?

 

Hi,

 

I think there are several ways to redirect to another server with some parameters from the first app, for example, 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 will close...

 

I think here too, there are several ways

maybe you can use the timer in the first app after the call redirection ??:

procedure TMainForm.UniTimer1Timer(Sender: TObject);
begin
  UniSession.Terminate();
end;

second app:

 

firstly, need to analyze the demo project:

C:\Program Files (x86)\FMSoft\Framework\uniGUI\Demos\Desktop\URLParameters...

..on close or on timeout in the main app the user will be redirect to the auth app...

 

UniServerModule.ServerMessages.TerminateTemplate..:

 

http://forums.unigui.com/index.php?/topic/2189-redirect-at-close/&do=findComment&comment=28523

<html>
<script>
function redirect() {
    location.href = "http://localhost:8077"; // first app url
}
 window.onpaint = redirect();
</script>
<body bgcolor="#dfe8f6">
</body>
</html>

Try...

 

Best regards.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...