Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Redirect in form constructor
#1
Hi,

Since I migrated to IW15, something I was doing previously does not work anymore. In the WebApp main form (which is a login page), I was reading parameters from the URL in order to bypass the login view if the correct "auth_token" is provided trough the URL parameters. This detection was done directly in the login form constructor :


Code:
constructor TLoginView.Create(AOwner: TComponent);
var
...
begin
  if WebApplication.RunParams.Values['username'] <> '' then
  begin
    txtUserName.Text := WebApplication.RunParams.Values['username'];
    LUserCredentials := True;
  end;
  if WebApplication.RunParams.Values['auth_token'] <> '' then
  begin
      txtPassword.Text := AuthTokenToPassword(WebApplication.RunParams.Values['auth_token']);
      LPwdCredentials := True;
  end

  ...
  if tryLogin then
     with TMainView.Create(WebApplication) do Show;


This code does not work anymore in IW15. 

I tried using a timer and executing this code inside it, and it works. I suppose it is because the timer code is executed after the form is rendered and not in the form constructor. But is it the best way to handle a such redirection, or is there another recommended method ?

Best regards,

Adrien
Reply


Messages In This Thread
Redirect in form constructor - by Adrien - 03-16-2022, 08:42 AM
RE: Redirect in form constructor - by Adrien - 03-17-2022, 10:49 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)