Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Retrieving user credentials from FireDAC login form


This question is answered.


Permlink Replies: 2 - Last Post: Apr 4, 2015 2:05 AM Last Post By: Dmitry Arefiev
Paulo Mariano

Posts: 29
Registered: 11/25/12
Retrieving user credentials from FireDAC login form  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 31, 2015 3:12 PM
Hello.

In a Delphi XE6 application that accesses an Informix database, the FireDAC login form is displayed when user credentials are not provided via the process that launches the application.
In this case, the username entered on the FireDAC login form can be retrieved from
FDManager.Connections[0].LoginDialog.ConnectionDef.UserName

Is it possible to retrieve the password as well?
Both username and password are required in other modules of the application.

Thank you in advance.
Linden ROTH

Posts: 467
Registered: 11/3/11
Re: Retrieving user credentials from FireDAC login form  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 31, 2015 3:32 PM   in response to: Paulo Mariano in response to: Paulo Mariano
Paulo Mariano wrote:
Hello.

In a Delphi XE6 application that accesses an Informix database, the FireDAC login form is displayed when user credentials are not provided via the process that launches the application.
In this case, the username entered on the FireDAC login form can be retrieved from
FDManager.Connections[0].LoginDialog.ConnectionDef.UserName

Is it possible to retrieve the password as well?
Both username and password are required in other modules of the application.

Thank you in advance.

Just write your own login form and pass the collected data on as required
--
Linden
"Mango" was Cool but "Wasabi" was Hotter but remember it's all in the "source"
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Retrieving user credentials from FireDAC login form
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 4, 2015 2:05 AM   in response to: Paulo Mariano in response to: Paulo Mariano
For security reasons FireDAC removes password from the application memory after logon.
Still the password will remain in memory when one of the following conditions is met:
* password was stored in TFDConnection.Params before connecting to a database;
* TFDConnection.ResourceOptions.AutoReconnect is True;
* a connection definition is pooled.

For first option you can use TFDGUIxLoginDialog component in manul mode. For that:
* drop TFDConnection, FDGUIxLoginDialog components;
* do not link components:
* use the code like that:
  FDConnection1.Params.Add('DriverID=SQLite');
  FDConnection1.Params.Add('Database=c:\demo.sdb');
 
  FDGUIxLoginDialog1.ConnectionDef := FDConnection1.ResultConnectionDef;
  if FDGUIxLoginDialog1.Execute(nil) then begin
    FDConnection1.LoginPrompt := False;
    FDConnection1.Connected := True;
  end;


--
With best regards,
Dmitry Arefiev / FireDAC Architect
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02