diff --git a/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas b/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas
index a0e7db1..f62f7dc 100644
--- a/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas
+++ b/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas
@@ -14,7 +14,7 @@ type
['{DD963EEC-5880-4DE7-AF55-B5080B538D84}']
procedure Logoff;
- function StartLogin : Boolean;
+ function StartLogin (const AUsuario : String = ''; const APassword : String = ''): Boolean;
procedure VerUsuarios;
procedure VerPerfiles;
procedure VerUsuario(const AIDUser: Integer); overload;
@@ -121,7 +121,7 @@ type
destructor Destroy; override;
procedure Logoff;
- function StartLogin : Boolean;
+ function StartLogin (const AUsuario : String = ''; const APassword : String = ''): Boolean;
procedure VerUsuarios;
procedure VerPerfiles;
@@ -174,7 +174,7 @@ uses
uDAInterfaces, uDataTableUtils, uDialogUtils, uFactuGES_App, Dialogs,
uDateUtils, uROTypes, DateUtils, Controls, Windows, uIEditorLogin,
uIEditorUsuarios, uIEditorUsuario, uIEditorPerfilesUsuario,
- uIEditorPerfilUsuario, uEditorCambiarPassword;
+ uIEditorPerfilUsuario, uEditorCambiarPassword, uStringsUtils;
{ TUsuariosController }
@@ -856,22 +856,39 @@ begin
FUserControl.ShowUserManager;
end;
-function TUsuariosController.StartLogin : Boolean;
+function TUsuariosController.StartLogin (const AUsuario : String = '';
+ const APassword : String = ''): Boolean;
var
AEditor : IEditorLogin;
begin
Result := False;
AEditor := NIL;
- CreateEditor('EditorLogin', IEditorLogin, AEditor);
- if Assigned(AEditor) then
+ // Intentamos un login automático si hay datos en los parámetros
+ if not EsCadenaVacia(AUsuario) and not EsCadenaVacia(APassword) then
+ begin
+ ShowHourglassCursor;
try
- AEditor.Controller := Self;
- Result := (AEditor.ShowModal = mrOk);
+ Result := ComprobarUsuario(AUsuario, APassword);
finally
- AEditor.Release;
- AEditor := NIL;
+ HideHourglassCursor;
end;
+ end;
+
+ { Si los parámetros están vacíos o ComprobarUsuario ha fallado,
+ mostrar la pantalla de login }
+ if not Result then
+ begin
+ CreateEditor('EditorLogin', IEditorLogin, AEditor);
+ if Assigned(AEditor) then
+ try
+ AEditor.Controller := Self;
+ Result := (AEditor.ShowModal = mrOk);
+ finally
+ AEditor.Release;
+ AEditor := NIL;
+ end;
+ end;
end;
procedure TUsuariosController.FiltrarEmpresa(AUsuario: IBizUsuario);
diff --git a/Source/ApplicationBase/uFactuGES_App.pas b/Source/ApplicationBase/uFactuGES_App.pas
index c094037..7e383e6 100644
--- a/Source/ApplicationBase/uFactuGES_App.pas
+++ b/Source/ApplicationBase/uFactuGES_App.pas
@@ -8,6 +8,7 @@ uses
type
TAppFactuGES_Event = procedure;
+ TOnBeforeStartLogin_Event = procedure(var ANombreUsuario: String; var APassword: String);
IAppSplashForm = interface
['{9905DF57-4476-42E6-A7CD-B1479A84E220}']
@@ -32,6 +33,9 @@ type
function GetModuleManager : THostManager;
function GetTerminated: Boolean;
+ function GetOnBeforeStartLogin : TOnBeforeStartLogin_Event;
+ procedure SetOnBeforeStartLogin (AOnBeforeStartLogin : TOnBeforeStartLogin_Event);
+
function GetLoadModulesEvent : TAppFactuGES_Event;
procedure SetLoadModulesEvent (ALoadModulesEvent : TAppFactuGES_Event);
@@ -68,6 +72,7 @@ type
property DoMainFormEvent : TAppFactuGES_Event read GetDoMainFormEvent write SetDoMainFormEvent;
property DoLoadModulesEvent : TAppFactuGES_Event read GetLoadModulesEvent write SetLoadModulesEvent;
property DoRefreshMainFormEvent : TAppFactuGES_Event read GetDoRefreshMainFormEvent write SetDoRefreshMainFormEvent;
+ property OnBeforeStartLogin : TOnBeforeStartLogin_Event read GetOnBeforeStartLogin write SetOnBeforeStartLogin;
property Terminated : Boolean read GetTerminated;
end;
@@ -84,6 +89,7 @@ type
FDoMainFormEvent: TAppFactuGES_Event;
FDoLoadModulesEvent: TAppFactuGES_Event;
FDoRefreshMainFormEvent: TAppFactuGES_Event;
+ FOnBeforeStartLogin : TOnBeforeStartLogin_Event;
function GetMainForm: TCustomForm;
function GetEmpresasController: IEmpresasController;
@@ -108,11 +114,16 @@ type
function GetAppSplashForm : IAppSplashForm;
procedure SetAppSplashForm (AAppSplashForm : IAppSplashForm);
+ function GetOnBeforeStartLogin : TOnBeforeStartLogin_Event;
+ procedure SetOnBeforeStartLogin (AOnBeforeStartLogin : TOnBeforeStartLogin_Event);
+
procedure AfterLoadModule(Sender: TObject; AModuleInfo: TModuleInfo);
procedure RegisterModule(AModuleInfo : TModuleInfo);
+ procedure SetOnBeforesStartLogin(const Value: TOnBeforeStartLogin_Event);
protected
procedure DoMainForm;
procedure DoRefreshMainForm;
+ function DoLogin: Boolean;
procedure CargarModulos;
procedure ShowSplashForm;
@@ -144,6 +155,7 @@ type
property DoLoadModulesEvent : TAppFactuGES_Event read GetLoadModulesEvent write SetLoadModulesEvent;
property DoRefreshMainFormEvent : TAppFactuGES_Event read GetDoRefreshMainFormEvent write SetDoRefreshMainFormEvent;
property Terminated : Boolean read GetTerminated;
+ property OnBeforeStartLogin : TOnBeforeStartLogin_Event read GetOnBeforeStartLogin write SetOnBeforesStartLogin;
end;
var
@@ -216,6 +228,20 @@ begin
inherited;
end;
+function TAppFactuGES.DoLogin: Boolean;
+var
+ AUsuario,
+ APassword : String;
+begin
+ AUsuario := '';
+ APassword := '';
+
+ if Assigned(FOnBeforeStartLogin) then
+ FOnBeforeStartLogin(AUsuario, APassword);
+
+ Result := UsuariosController.StartLogin(AUsuario, APassword);
+end;
+
procedure TAppFactuGES.DoMainForm;
begin
if not Assigned(FDoMainFormEvent) then
@@ -292,6 +318,11 @@ begin
Result := FHostManager;
end;
+function TAppFactuGES.GetOnBeforeStartLogin: TOnBeforeStartLogin_Event;
+begin
+ Result := FOnBeforeStartLogin;
+end;
+
function TAppFactuGES.GetTerminated: Boolean;
begin
Result := FTerminated;
@@ -339,7 +370,7 @@ end;
procedure TAppFactuGES.Run;
begin
- if UsuariosController.StartLogin then
+ if DoLogin then
begin
ShowHourglassCursor;
ShowSplashForm;
@@ -427,6 +458,18 @@ begin
FDoLoadModulesEvent := ALoadModulesEvent;
end;
+procedure TAppFactuGES.SetOnBeforesStartLogin(
+ const Value: TOnBeforeStartLogin_Event);
+begin
+
+end;
+
+procedure TAppFactuGES.SetOnBeforeStartLogin(
+ AOnBeforeStartLogin: TOnBeforeStartLogin_Event);
+begin
+ FOnBeforeStartLogin := AOnBeforeStartLogin;
+end;
+
procedure TAppFactuGES.ShowSplashForm;
begin
if not Assigned(FAppSplashForm) then
diff --git a/Source/Cliente/FactuGES.dpr b/Source/Cliente/FactuGES.dpr
index b105df3..e443745 100644
--- a/Source/Cliente/FactuGES.dpr
+++ b/Source/Cliente/FactuGES.dpr
@@ -1,6 +1,7 @@
program FactuGES;
uses
+ ExceptionLog,
Forms,
Windows,
SysUtils,
diff --git a/Source/Cliente/FactuGES.dproj b/Source/Cliente/FactuGES.dproj
index 9276bf9..c136bd1 100644
--- a/Source/Cliente/FactuGES.dproj
+++ b/Source/Cliente/FactuGES.dproj
@@ -48,6 +48,7 @@
True
True
2
+ EUREKALOG;EUREKALOG_VER6
Delphi.Personality
@@ -79,7 +80,7 @@