📄 modipass_unit.pas
字号:
unit modipass_unit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, cxLookAndFeelPainters,data_unit,
dxCore, dxButtons;
type
Tmodipass_form = class(TForm)
Label2: TLabel;
Label1: TLabel;
xg_btn: TdxButton;
qx_btn: TdxButton;
oldpass_edit: TEdit;
newpass_edit: TEdit;
procedure qx_btnClick(Sender: TObject);
procedure xg_btnClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
modipass_form: Tmodipass_form;
implementation
uses main_unit;
{$R *.dfm}
procedure Tmodipass_form.qx_btnClick(Sender: TObject);
begin
close;
end;
procedure Tmodipass_form.xg_btnClick(Sender: TObject);
begin
//--修改密码过程
if trim(newpass_edit.Text) ='' then //判断新密码是不是为空
begin
application.MessageBox('新密码不能为空','提示信息',64+mb_ok);
newpass_edit.SetFocus;
exit;
end;
data_form.usertable.Active :=false;
data_form.usertable.CommandText :='select * from usertable where user_name='+#39+main_form.admin_lab.Caption+#39+' and user_pass='+#39+trim(oldpass_edit.Text)+#39;
data_form.usertable.Active :=true;
if not data_form.usertable.IsEmpty then
begin
data_form.usertable.Edit;
data_form.usertable.FieldByName('user_pass').Text :=trim(newpass_edit.Text);
data_form.usertable.Post;
application.MessageBox('密码已经修改,请记住新密码','完成信息',64+mb_ok);
close;
end
else
begin
application.MessageBox('旧密码不正确,重新输入','提示信息',64+mb_ok);
oldpass_edit.Text :='';
newpass_edit.Text :='';
oldpass_edit.SetFocus;
end;
end;
procedure Tmodipass_form.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
newpass_edit.Text :='';
oldpass_edit.Text :='';
data_form.usertable.Active :=false;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -