【delphi开源代码栏目提醒】:网学会员--在 delphi开源代码编辑为广大网友搜集整理了:ChangePassWordUnit.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.
上一篇:
ChangePasswordForm.pas
下一篇:
餐饮管理系统