Jump to content


Photo

Skip login form if url parameters were passed


  • Please log in to reply
4 replies to this topic

#1 Volk65

Volk65

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 63 posts
  • LocationMSK, Russia

Posted 22 February 2018 - 02:55 PM

Hi all!

 

How it works now:
1. You are prompted with a login form
2. User cookies are read
3. The login password fields are filled in
4. The user clicks on "OK"
5. There is a check in the database
6. If all is well, then Modalresult=mrOK

Is this possible(?):
1. Cookies are read before the login window is displayed
2. If url parameters were passed at startup (UniApplication.Parameters), it checks the user in DB with his / her cookies.
3. If the check does not pass (for example, cookies are not saved), the login window is displayed.
4. But, if the check user in DB = OK, the LOGIN WINDOW is NEVER DISPLAYED and opened from the Mainform

I was able to check the user and close the window. I used the "onaftershow" event. BUT, login window displays 0.5 seconds, after which the main window opens. But I want the login window never to be displayed. If the parameters have been passed and the user verification has passed.


  • 0

#2 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4991 posts

Posted 22 February 2018 - 05:05 PM

Hi,

 

You can use MainModule -> OnBeforeLogin event for this

 

Look at this demo example:

\FMSoft\Framework\uniGUI\Demos\Desktop\LoginForm Cookies

Best regards,


  • 0

#3 Volk65

Volk65

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 63 posts
  • LocationMSK, Russia

Posted 22 February 2018 - 06:07 PM

Hi

 

One small problem in MainModule - no property access Cookies:

PS:

implementation

{$R *.dfm}

uses
  uniGUIApplication, UniGUIVars, ServerModule, UType, Variants, uni_Data_Module,
  UProc, XCrypt2, UniGUIForm;

Attached Files


  • 0

#4 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 4991 posts

Posted 22 February 2018 - 06:47 PM

Have you seen the demo ?

procedure TUniMainModule.UniGUIMainModuleBeforeLogin(Sender: TObject;
  var Handled: Boolean);
var
  S1, S2 : string;
begin
  S1 := (Sender as TUniGUISession).UniApplication.Cookies.Values['_loginname'];
  S2 := (Sender as TUniGUISession).UniApplication.Cookies.Values['_pwd'];

  Handled := SameText(S1, 'demo') and SameText(S2, 'demo');

  if Handled then
    LoggedUser := S1;
end;

  • 0

#5 Volk65

Volk65

    Active Member

  • uniGUI Subscriber
  • PipPipPip
  • 63 posts
  • LocationMSK, Russia

Posted 22 February 2018 - 07:13 PM

A thousand apologies. :wacko2:

It work.


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users