zoukankan      html  css  js  c++  java
  • UNIGUI:How to redirect and close session?

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

    ..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
  • 相关阅读:
    开采镍矿与冶炼加工镍的上市公司一览(转载)
    2010年螺纹期货基本走势分析(个人分析原创文章)
    从松柏那转载的ajax类
    推荐30个可以养站的博客(转载)
    年报掘金:机构增仓路线图曝光(20100306转载)
    一个人过习惯了,两个人不知道怎么过。。。
    各大搜索引擎的网站登录入口(转载)
    志向
    主力做庄骗术
    网上发现襄阳市场,说是正品,初步推断举步维艰
  • 原文地址:https://www.cnblogs.com/wxb-km/p/4788408.html
Copyright © 2011-2022 走看看