From 6c172fa5461ba8f0d2eb089d15f2ffaa4b8bdaa4 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 23 Feb 2008 18:44:48 +0000 Subject: [PATCH] =?UTF-8?q?Usuarios:=20permitir=20contrase=C3=B1as=20no=20?= =?UTF-8?q?seguras.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@137 f4e31baf-9722-1c47-927c-6f952f962d4b --- Source/ApplicationBase/ApplicationBase.dproj | 42 +++---------------- .../Controller/uUsuariosController.pas | 35 ++++++++++++---- 2 files changed, 34 insertions(+), 43 deletions(-) diff --git a/Source/ApplicationBase/ApplicationBase.dproj b/Source/ApplicationBase/ApplicationBase.dproj index c797904a..462eab2b 100644 --- a/Source/ApplicationBase/ApplicationBase.dproj +++ b/Source/ApplicationBase/ApplicationBase.dproj @@ -52,20 +52,6 @@ - - - - - - - - - - - - - - VCL for the Web Design Package for CodeGear RAD Studio CodeGear WebSnap Components @@ -81,12 +67,12 @@ MainSource - - - - - - + + + + + + @@ -174,22 +160,6 @@ - - - - - - - - - - - - - - - -
fEditorCambiarPassword
TCustomEditor diff --git a/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas b/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas index 74f86b35..6f4e9b02 100644 --- a/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas +++ b/Source/ApplicationBase/Usuarios/Controller/uUsuariosController.pas @@ -63,6 +63,10 @@ type function GetCriptografia : TUCCriptografia; 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 AddRight(idUser: Integer; ItemRight: TObject; FullPath: Boolean = True); overload; @@ -86,6 +90,7 @@ type FDataModule : IDataModuleUsuarios; FUserControl: TUserControl; FCurrentUser : IBizUsuario; + FUsarPasswordsSeguras : Boolean; function GetMaxIntentosLogin: Integer; procedure SetMaxIntentosLogin(const Value: Integer); @@ -109,6 +114,9 @@ type function GetCriptografia : TUCCriptografia; function CambiarPassword(const AIDUser: Integer; const ANewPassword: String): Boolean; overload; + + function GetUsarPasswordsSeguras: Boolean; + procedure SetUsarPasswordsSeguras(const Value: Boolean); public constructor Create; virtual; destructor Destroy; override; @@ -153,6 +161,7 @@ type function ValidarPassword(const APassword : string; const ALogin : String; const ANombre: String; out AMsg : String): boolean; + property UsarPasswordsSeguras : Boolean read GetUsarPasswordsSeguras write SetUsarPasswordsSeguras; property UserControl : TUserControl read FUserControl; property MaxIntentosLogin : Integer read GetMaxIntentosLogin write SetMaxIntentosLogin; property CurrentUser: IBizUsuario read GetCurrentUser; @@ -343,6 +352,7 @@ begin AsignarDataModule; FCurrentUser := NIL; FUserControl := TUserControl.Create(nil); + FUsarPasswordsSeguras := False; InicializarUserControl; end; @@ -487,10 +497,11 @@ end; function TUsuariosController.GetCurrentUser: IBizUsuario; begin if not Assigned(FCurrentUser) or (FCurrentUser.ID <> FUserControl.CurrentUser.UserID) then - begin FCurrentUser := BuscarUsuario(FUserControl.CurrentUser.UserID); - FCurrentUser.DataTable.Active := True; - end; + + if not FCurrentUser.Active then + FCurrentUser.Active := True; + Result := FCurrentUser; end; @@ -499,6 +510,11 @@ begin Result := FUserControl.Login.MaxLoginAttempts; end; +function TUsuariosController.GetUsarPasswordsSeguras: Boolean; +begin + Result := FUsarPasswordsSeguras; +end; + function TUsuariosController.GuardarPerfil(APerfil: IBizPerfilUsuario): Boolean; begin Result := False; @@ -660,6 +676,11 @@ begin FUserControl.Login.MaxLoginAttempts := Value; end; +procedure TUsuariosController.SetUsarPasswordsSeguras(const Value: Boolean); +begin + FUsarPasswordsSeguras := Value; +end; + procedure TUsuariosController._ShowChangePassword; begin FUserControl.ShowChangePassword; @@ -686,7 +707,7 @@ begin if (Length(Trim(APassword)) < FUserControl.UserPasswordChange.MinPasswordLength) then AMsg := Format(FUserControl.UserSettings.CommonMessages.ChangePasswordError.MinPasswordLength, [FUserControl.UserPasswordChange.MinPasswordLength]) 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 else Result := true; @@ -876,8 +897,8 @@ begin end; procedure TUsuariosController.FiltrarEmpresa(AUsuario: IBizUsuario); -{var - Condicion: TDAWhereExpression;} +var + Condicion: TDAWhereExpression; begin // AQUI HAY QUE TENER EN CUENTA QUE UN USUARIO PUEDE QUE NO TENGA ACCESO @@ -901,4 +922,4 @@ begin end; -end. \ No newline at end of file +end.