mirror of
http://gitlab.expertsoft.com.ua/git/expertcad
synced 2026-01-11 22:45:39 +02:00
119 lines
2.6 KiB
ObjectPascal
119 lines
2.6 KiB
ObjectPascal
unit U_MakeEditPass;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, U_LNG, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, StdCtrls, ExtCtrls, RzPanel, RzButton, Mask, RzEdit,
|
|
|
|
U_BaseCommon, U_BaseConstants, U_ProtectionBase, siComp, siLngLnk;
|
|
|
|
type
|
|
TF_MakeEditPass = class(TForm)
|
|
RzPanel1: TRzPanel;
|
|
RzGroupBox1: TRzGroupBox;
|
|
btOk: TRzBitBtn;
|
|
btCancel: TRzBitBtn;
|
|
pnCurrPass: TRzPanel;
|
|
Label1: TLabel;
|
|
edCurrPass: TRzEdit;
|
|
RzPanel2: TRzPanel;
|
|
RzGroupBox2: TRzGroupBox;
|
|
Label2: TLabel;
|
|
Label3: TLabel;
|
|
edNewPas: TRzEdit;
|
|
edNewPassRep: TRzEdit;
|
|
lng_Forms: TsiLangLinked;
|
|
procedure btOkClick(Sender: TObject);
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
private
|
|
GForm: TForm;
|
|
FCurrPass: String;
|
|
public
|
|
Constructor Create(AOwner: TComponent; AForm: TForm);
|
|
Destructor Destroy; override;
|
|
|
|
function Execute(ACurrPass: String): String;
|
|
end;
|
|
|
|
|
|
function GetNewPass(ACurrPass: String): String;
|
|
|
|
//var
|
|
// Form1: TForm1;
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
constructor TF_MakeEditPass.Create(AOwner: TComponent; AForm: TForm);
|
|
begin
|
|
GForm := AForm;
|
|
inherited Create(AOwner);
|
|
end;
|
|
|
|
destructor TF_MakeEditPass.Destroy;
|
|
begin
|
|
inherited;
|
|
end;
|
|
|
|
function TF_MakeEditPass.Execute(ACurrPass: String): String;
|
|
begin
|
|
Result := '';
|
|
try
|
|
FCurrPass := ACurrPass;
|
|
|
|
edCurrPass.Text := '';
|
|
edNewPas.Text := '';
|
|
edNewPassRep.Text := '';
|
|
|
|
pnCurrPass.Visible := ACurrPass <> '';
|
|
|
|
if ShowModal = mrOk then
|
|
Result := GetHash(edNewPas.Text);
|
|
except
|
|
on E: Exception do AddExceptionToLogEx('TF_MakeEditPass.Execute', E.Message);
|
|
end;
|
|
end;
|
|
|
|
procedure TF_MakeEditPass.btOkClick(Sender: TObject);
|
|
begin
|
|
if FCurrPass <> '' then
|
|
begin
|
|
if FCurrPass <> GetHash(edCurrPass.Text) then
|
|
begin
|
|
MessageModal(cMakeEditPass1, ApplicationName, MB_OK or MB_ICONEXCLAMATION);
|
|
ModalResult := mrNone;
|
|
end;
|
|
end;
|
|
if ModalResult <> mrNone then
|
|
if edNewPas.Text <> edNewPassRep.Text then
|
|
begin
|
|
MessageModal(cMakeEditPass2, ApplicationName, MB_OK or MB_ICONEXCLAMATION);
|
|
ModalResult := mrNone;
|
|
end;
|
|
end;
|
|
|
|
function GetNewPass(ACurrPass: String): String;
|
|
var
|
|
F_MakeEditPass: TF_MakeEditPass;
|
|
begin
|
|
Result := '';
|
|
F_MakeEditPass := TF_MakeEditPass.Create(nil, nil);
|
|
try
|
|
Result := F_MakeEditPass.Execute(ACurrPass);
|
|
finally
|
|
FreeAndNil(F_MakeEditPass);
|
|
end;
|
|
end;
|
|
|
|
procedure TF_MakeEditPass.FormShow(Sender: TObject);
|
|
begin
|
|
if FCurrPass <> '' then
|
|
edCurrPass.SetFocus
|
|
else
|
|
edNewPas.SetFocus;
|
|
end;
|
|
|
|
end. |