procedure TSYSTEMLOGINDIALOG.Logon(AutoSelect: Boolean);
事件中不是验证吗?验证成功后,我再进行,位数等验证
procedure TSYSTEMLOGINDIALOG.Logon(AutoSelect: Boolean);
const
ErrMsg01 = '用户名或密码错误,或者该用户没有分配岗位或已被其他用户代理';
var
lDetailForm : TMODIFYPASSWORDFORM;{记得在窗体前面加T}
begin
if edtUserName.Text = '' then
begin
edtUserName.SetFocus;
Dialogs.MessageDlg('请输入用户', TMsgDlgType.mtError, [TMsgDlgBtn.mbOK] , 0);
Exit;
end;
if AutoSelect and (ActiveControl = edtUserName) then
begin
edtPassword.SetFocus;
edtPassword.SelectAll;
Exit;
end;
if not UpdatePositions then
begin
JSDialogs.ShowWarning(ErrMsg01, '登录');
Exit;
end;
if not IsSystemManager(edtUserName.Text) then
if DeputiedPosition then //系统管理员System帐户没有岗位这里不能验证是否被代理了
Exit;
if not CanAutoPosition and (cbPosition.ItemIndex = -1) then
raise Exception.Create('请选择岗位');
ModalResult := Business.Forms.Controls.mrOK;
SaveSettings;
if PswRz(edtPassword.Text)<>'OK' then
begin
JSDialogs.ShowWarning('您的密码'+PswRz(edtPassword.Text)+'请修改!', '登录');
begin
TModifyPasswordForm.ChangePassword(TSystemCore.Operator);
{lDetailForm := TMODIFYPASSWORDFORM.Create(Context);
try
lDetailForm.ShowModal;
finally
lDetailForm.Free;
end;}
end ;
end;
if cbPosition.ItemIndex = -1 then
begin
LocalPersonMember := nil;
end
else
LocalPersonMember := cbPosition.Items.Objects[cbPosition.ItemIndex] as TPersonMember;
// SendLogonMessage;
end; |