Jump to content
uniGUI Discussion Forums

Skip login form if url parameters were passed

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.

Share this post

Link to post
Share on other sites



You can use MainModule -> OnBeforeLogin event for this


Look at this demo example:

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

Best regards,

Share this post

Link to post
Share on other sites



One small problem in MainModule - no property access Cookies:



{$R *.dfm}

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


Share this post

Link to post
Share on other sites

Have you seen the demo ?

procedure TUniMainModule.UniGUIMainModuleBeforeLogin(Sender: TObject;
  var Handled: Boolean);
  S1, S2 : string;
  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;

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now