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

📄 changepasswordunit.pas

📁 这是一个用Delphi编写的物业管理系统源代码.
💻 PAS
字号:
unit ChangePassWordUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Buttons;

type
  TChangePasswordForm = class(TForm)
    Panel1: TPanel;
    BtOk: TBitBtn;
    Label3: TLabel;
    Label2: TLabel;
    Label1: TLabel;
    old: TEdit;
    new: TEdit;
    new2: TEdit;
    BtCancel: TBitBtn;
    procedure BtOkClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BtCancelClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  ChangePasswordForm: TChangePasswordForm;

implementation

uses Udm, Umain;

{$R *.dfm}

procedure TChangePasswordForm.BtOkClick(Sender: TObject);
begin
  if trim(old.Text) = '' then //旧密码输入不能够为空
  begin
    ShowMessage('请输入旧密码');
    old.SetFocus;
    exit;
  end;

  if trim(new.Text) = '' then //新密码输入不能够为空
  begin
    ShowMessage('请输入新密码');
    new.SetFocus;
    exit;
  end;
  if trim(new2.Text) = '' then
  begin //验证新密码输入不能够为空
    ShowMessage('请验证新密码');
    new2.SetFocus;
    exit;
  end;
  if new.Text <> new2.Text then
  begin //检验两次密码输入是否相同
    showmessage('请验证新密码');
    new2.SetFocus;
    exit;
  end;

  if adodm.tuser.Locate('用户编号', MainForm.auser.id, []) then
  begin
    if adodm.tuser.FieldByName('密码').Asstring <> trim(old.Text) then
   //检验是否输入的旧密码和新密码相同
    begin
      ShowMessage('原密码不对!请重新录入');
      old.SetFocus;
    end
    else
    begin
      adodm.tuser.Open;
      adodm.tuser.Edit;
      adodm.tuser.FieldByName('密码').Asstring := new.Text;
      //新密码提交
      adodm.tuser.Post;
    end;
  end
  else ShowMessage('当前用户信息被破坏,请重新录入后再进行修改');
  close;
end;

procedure TChangePasswordForm.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  action := cafree;
end;

procedure TChangePasswordForm.BtCancelClick(Sender: TObject);
begin
  Self.Close; //关闭窗体
end;

end.

⌨️ 快捷键说明

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