⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modifypasswordf.pas

📁 极具实用价值的文件管理系统
💻 PAS
字号:
{ *********************************************************************** }
{ Unit Name: ModifyPasswordF                                                       
{ Purpose: ModifyPasswordF  
{ Author: Cyclone
{ History:
{         2005-3-20 23:47:33 Create the function
{ *********************************************************************** }

unit ModifyPasswordF;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DialogBaseF, Buttons, CycSpeedButton, ExtCtrls, StdCtrls,
  CycLabel, CycPanel, CycEdit;

type
  TfmModifyPassword = class(TfmDialogBase)
    Label13: TCycLabel;
    Label14: TCycLabel;
    Label15: TCycLabel;
    edtOldPassword: TCycEdit;
    edtNewPassword1: TCycEdit;
    edtNewPassword2: TCycEdit;
    procedure btnOKClick(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmModifyPassword: TfmModifyPassword;

implementation

uses PubFuns, MainD;

{$R *.dfm}

procedure TfmModifyPassword.btnOKClick(Sender: TObject);
begin
  if Decrypt(pSysUserPassword, PassContext) <> edtOldPassword.Text then
  begin
    ShowError('Old password is wrong!');
    edtOldPassword.SetFocus;
    Exit;
  end;
  if edtNewPassword1.Text <> edtNewPassword2.Text then
  begin
    ShowError('Confirm new password not equal to new password!');
    edtNewPassword2.SetFocus;
    Exit;
  end;
  with dmMain.dsSystemUser do
  begin
    if RecordCount > 0 then
    begin
      Edit;
      FieldByName('Password').AsString := Encrypt(edtNewPassword1.Text, PassContext);
      Post;
      edtOldPassword.Text := '';
      edtNewPassword1.Text := '';
      edtNewPassword2.Text := '';
      ShowInformation('Password has modified!');
    end;
  end;
  inherited;
end;

procedure TfmModifyPassword.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if Key = VK_RETURN then //ENTER
  begin
    if ActiveControl = edtNewPassword2 then
      btnOK.Click
    else
      inherited;
  end
  else
    inherited;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -