Jump to content

Skip login form if url parameters were passed


Volk65

Recommended Posts

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.

Link to comment
Share on other sites

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;

post-4024-0-76097100-1519322818_thumb.png

Link to comment
Share on other sites

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;
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...