UNIGUI:How to redirect and close session?

本文探讨了如何在uniGUI应用程序中实现从认证应用到主应用的带参数重定向,使用POST方法传递参数并在重定向后关闭当前会话。通过创建表单元素并设置其属性,可以将用户信息发送到另一个服务器,同时利用定时器组件来终止源应用的会话。

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 ?

 

  • 0

#2 Delphi Developer

Advanced Member

  • Moderators
  • 726 posts

Posted 04 September 2015 - 05:43 AM

delagoutte, on 03 Sept 2015 - 11:47 PM, said:

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...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.

  • 0

转载于:https://www.cnblogs.com/wxb-km/p/4788408.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值