Usuarios: permitir contraseñas no seguras.

git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@137 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
David Arranz 2008-02-23 18:44:48 +00:00
parent eddd06e826
commit 6c172fa546
2 changed files with 34 additions and 43 deletions

View File

@ -52,20 +52,6 @@
<Excluded_Packages Name="$(BDS)\Bin\dclintraweb_90_100.bpl">VCL for the Web Design Package for CodeGear RAD Studio</Excluded_Packages> <Excluded_Packages Name="$(BDS)\Bin\dclintraweb_90_100.bpl">VCL for the Web Design Package for CodeGear RAD Studio</Excluded_Packages>
<Excluded_Packages Name="$(BDS)\bin\dclwebsnap100.bpl">CodeGear WebSnap Components</Excluded_Packages> <Excluded_Packages Name="$(BDS)\bin\dclwebsnap100.bpl">CodeGear WebSnap Components</Excluded_Packages>
@ -81,12 +67,12 @@
<DelphiCompile Include="ApplicationBase.dpk"> <DelphiCompile Include="ApplicationBase.dpk">
<MainSource>MainSource</MainSource> <MainSource>MainSource</MainSource>
</DelphiCompile> </DelphiCompile>
<DCCReference Include="..\Modulos\Contabilidad\Base.dcp" /> <DCCReference Include="..\Base.dcp" />
<DCCReference Include="..\Modulos\Contabilidad\dbrtl.dcp" /> <DCCReference Include="..\dbrtl.dcp" />
<DCCReference Include="..\Modulos\Contabilidad\GUIBase.dcp" /> <DCCReference Include="..\GUIBase.dcp" />
<DCCReference Include="..\Modulos\Contabilidad\JvJansD11R.dcp" /> <DCCReference Include="..\JvJansD11R.dcp" />
<DCCReference Include="..\Modulos\Contabilidad\rtl.dcp" /> <DCCReference Include="..\rtl.dcp" />
<DCCReference Include="..\Modulos\Contabilidad\vcl.dcp" /> <DCCReference Include="..\vcl.dcp" />
<DCCReference Include="Ejercicios\Controller\uEjerciciosController.pas" /> <DCCReference Include="Ejercicios\Controller\uEjerciciosController.pas" />
<DCCReference Include="Ejercicios\Controller\View\uIEditorEjercicio.pas" /> <DCCReference Include="Ejercicios\Controller\View\uIEditorEjercicio.pas" />
<DCCReference Include="Ejercicios\Controller\View\uIEditorEjercicios.pas" /> <DCCReference Include="Ejercicios\Controller\View\uIEditorEjercicios.pas" />
@ -174,22 +160,6 @@
<DCCReference Include="Usuarios\Model\schUsuariosClient_Intf.pas" /> <DCCReference Include="Usuarios\Model\schUsuariosClient_Intf.pas" />
<DCCReference Include="Usuarios\Model\schUsuariosServer_Intf.pas" /> <DCCReference Include="Usuarios\Model\schUsuariosServer_Intf.pas" />
<DCCReference Include="Usuarios\Model\uBizUsuarios.pas" /> <DCCReference Include="Usuarios\Model\uBizUsuarios.pas" />
<DCCReference Include="Usuarios\Views\PBase.dcp" />
<DCCReference Include="Usuarios\Views\PlBase.dcp" />
<DCCReference Include="Usuarios\Views\PluBase.dcp" />
<DCCReference Include="Usuarios\Views\PlugBase.dcp" />
<DCCReference Include="Usuarios\Views\PlugiBase.dcp" />
<DCCReference Include="Usuarios\Views\PluginBase.dcp" />
<DCCReference Include="Usuarios\Views\PluginSBase.dcp" />
<DCCReference Include="Usuarios\Views\PluginSDBase.dcp" />
<DCCReference Include="Usuarios\Views\PluginSDKBase.dcp" />
<DCCReference Include="Usuarios\Views\PluginSDK_Base.dcp" />
<DCCReference Include="Usuarios\Views\PluginSDK_D11.dcp" />
<DCCReference Include="Usuarios\Views\PluginSDK_D11Base.dcp" />
<DCCReference Include="Usuarios\Views\PluginSDK_D11R.dcp" />
<DCCReference Include="Usuarios\Views\PluginSDK_D11RBase.dcp" />
<DCCReference Include="Usuarios\Views\PluginSDK_D1Base.dcp" />
<DCCReference Include="Usuarios\Views\PluginSDK_DBase.dcp" />
<DCCReference Include="Usuarios\Views\uEditorCambiarPassword.pas"> <DCCReference Include="Usuarios\Views\uEditorCambiarPassword.pas">
<Form>fEditorCambiarPassword</Form> <Form>fEditorCambiarPassword</Form>
<DesignClass>TCustomEditor</DesignClass> <DesignClass>TCustomEditor</DesignClass>

View File

@ -63,6 +63,10 @@ type
function GetCriptografia : TUCCriptografia; function GetCriptografia : TUCCriptografia;
property Criptografia: TUCCriptografia read GetCriptografia; property Criptografia: TUCCriptografia read GetCriptografia;
function GetUsarPasswordsSeguras: Boolean;
procedure SetUsarPasswordsSeguras(const Value: Boolean);
property UsarPasswordsSeguras : Boolean read GetUsarPasswordsSeguras write SetUsarPasswordsSeguras;
{ {
procedure ChangePassword(IDUser: Integer; NewPassword: String); procedure ChangePassword(IDUser: Integer; NewPassword: String);
procedure AddRight(idUser: Integer; ItemRight: TObject; FullPath: Boolean = True); overload; procedure AddRight(idUser: Integer; ItemRight: TObject; FullPath: Boolean = True); overload;
@ -86,6 +90,7 @@ type
FDataModule : IDataModuleUsuarios; FDataModule : IDataModuleUsuarios;
FUserControl: TUserControl; FUserControl: TUserControl;
FCurrentUser : IBizUsuario; FCurrentUser : IBizUsuario;
FUsarPasswordsSeguras : Boolean;
function GetMaxIntentosLogin: Integer; function GetMaxIntentosLogin: Integer;
procedure SetMaxIntentosLogin(const Value: Integer); procedure SetMaxIntentosLogin(const Value: Integer);
@ -109,6 +114,9 @@ type
function GetCriptografia : TUCCriptografia; function GetCriptografia : TUCCriptografia;
function CambiarPassword(const AIDUser: Integer; const ANewPassword: String): Boolean; overload; function CambiarPassword(const AIDUser: Integer; const ANewPassword: String): Boolean; overload;
function GetUsarPasswordsSeguras: Boolean;
procedure SetUsarPasswordsSeguras(const Value: Boolean);
public public
constructor Create; virtual; constructor Create; virtual;
destructor Destroy; override; destructor Destroy; override;
@ -153,6 +161,7 @@ type
function ValidarPassword(const APassword : string; const ALogin : String; function ValidarPassword(const APassword : string; const ALogin : String;
const ANombre: String; out AMsg : String): boolean; const ANombre: String; out AMsg : String): boolean;
property UsarPasswordsSeguras : Boolean read GetUsarPasswordsSeguras write SetUsarPasswordsSeguras;
property UserControl : TUserControl read FUserControl; property UserControl : TUserControl read FUserControl;
property MaxIntentosLogin : Integer read GetMaxIntentosLogin write SetMaxIntentosLogin; property MaxIntentosLogin : Integer read GetMaxIntentosLogin write SetMaxIntentosLogin;
property CurrentUser: IBizUsuario read GetCurrentUser; property CurrentUser: IBizUsuario read GetCurrentUser;
@ -343,6 +352,7 @@ begin
AsignarDataModule; AsignarDataModule;
FCurrentUser := NIL; FCurrentUser := NIL;
FUserControl := TUserControl.Create(nil); FUserControl := TUserControl.Create(nil);
FUsarPasswordsSeguras := False;
InicializarUserControl; InicializarUserControl;
end; end;
@ -487,10 +497,11 @@ end;
function TUsuariosController.GetCurrentUser: IBizUsuario; function TUsuariosController.GetCurrentUser: IBizUsuario;
begin begin
if not Assigned(FCurrentUser) or (FCurrentUser.ID <> FUserControl.CurrentUser.UserID) then if not Assigned(FCurrentUser) or (FCurrentUser.ID <> FUserControl.CurrentUser.UserID) then
begin
FCurrentUser := BuscarUsuario(FUserControl.CurrentUser.UserID); FCurrentUser := BuscarUsuario(FUserControl.CurrentUser.UserID);
FCurrentUser.DataTable.Active := True;
end; if not FCurrentUser.Active then
FCurrentUser.Active := True;
Result := FCurrentUser; Result := FCurrentUser;
end; end;
@ -499,6 +510,11 @@ begin
Result := FUserControl.Login.MaxLoginAttempts; Result := FUserControl.Login.MaxLoginAttempts;
end; end;
function TUsuariosController.GetUsarPasswordsSeguras: Boolean;
begin
Result := FUsarPasswordsSeguras;
end;
function TUsuariosController.GuardarPerfil(APerfil: IBizPerfilUsuario): Boolean; function TUsuariosController.GuardarPerfil(APerfil: IBizPerfilUsuario): Boolean;
begin begin
Result := False; Result := False;
@ -660,6 +676,11 @@ begin
FUserControl.Login.MaxLoginAttempts := Value; FUserControl.Login.MaxLoginAttempts := Value;
end; end;
procedure TUsuariosController.SetUsarPasswordsSeguras(const Value: Boolean);
begin
FUsarPasswordsSeguras := Value;
end;
procedure TUsuariosController._ShowChangePassword; procedure TUsuariosController._ShowChangePassword;
begin begin
FUserControl.ShowChangePassword; FUserControl.ShowChangePassword;
@ -686,7 +707,7 @@ begin
if (Length(Trim(APassword)) < FUserControl.UserPasswordChange.MinPasswordLength) then if (Length(Trim(APassword)) < FUserControl.UserPasswordChange.MinPasswordLength) then
AMsg := Format(FUserControl.UserSettings.CommonMessages.ChangePasswordError.MinPasswordLength, [FUserControl.UserPasswordChange.MinPasswordLength]) AMsg := Format(FUserControl.UserSettings.CommonMessages.ChangePasswordError.MinPasswordLength, [FUserControl.UserPasswordChange.MinPasswordLength])
else else
if Pos(LowerCase(APassword), 'abcdeasdfqwerzxcv1234567890321654987test' + LowerCase(ALogin) + LowerCase(AMsg)) > 0 then if FUsarPasswordsSeguras and (Pos(LowerCase(APassword), 'abcdeasdfqwerzxcv1234567890321654987test' + LowerCase(ALogin) + LowerCase(AMsg)) > 0) then
AMsg := FUserControl.UserSettings.CommonMessages.ChangePasswordError.InvalidNewPassword AMsg := FUserControl.UserSettings.CommonMessages.ChangePasswordError.InvalidNewPassword
else else
Result := true; Result := true;
@ -876,8 +897,8 @@ begin
end; end;
procedure TUsuariosController.FiltrarEmpresa(AUsuario: IBizUsuario); procedure TUsuariosController.FiltrarEmpresa(AUsuario: IBizUsuario);
{var var
Condicion: TDAWhereExpression;} Condicion: TDAWhereExpression;
begin begin
// AQUI HAY QUE TENER EN CUENTA QUE UN USUARIO PUEDE QUE NO TENGA ACCESO // AQUI HAY QUE TENER EN CUENTA QUE UN USUARIO PUEDE QUE NO TENGA ACCESO