Code: D7
uses Windows;
function LoginAD(vUserID, vPWD, vDomainName: string): Boolean;
const LOGON_TYPE_NEW_CREDENTIALS = 9; //Work with difference Domain
function LoginAD(vUserID, vPWD, vDomainName: string): Boolean;
const LOGON_TYPE_NEW_CREDENTIALS = 9; //Work with difference Domain
var
hUser : THandle;
isFoundUser : Boolean;
begin
try
if fCount>5 then begin
ShowMessage('Sign-in is blocked Entered password too many times');
//Btn1.Enabled:= False;
Result:= False;
Exit;
end;
isFoundUser := LogonUser(PChar(vUserID),
PChar(vDomainName), //Domain name.
PChar(vPWD),
LOGON_TYPE_NEW_CREDENTIALS,
LOGON32_PROVIDER_DEFAULT,
hUser);
Result:= isFoundUser;
finally
if fCount<=5 then begin
if hUser>0 then begin
CloseHandle(hUser);
end
else
Inc(fCOUNT);
Result:= False;
end;
end;
end;
uses Windows;
function LoginAD(vUserID, vPWD, vDomainName: string): Boolean;
const LOGON_TYPE_NEW_CREDENTIALS = 9; //Work with difference Domain
function LoginAD(vUserID, vPWD, vDomainName: string): Boolean;
const LOGON_TYPE_NEW_CREDENTIALS = 9; //Work with difference Domain
var
hUser : THandle;
isFoundUser : Boolean;
begin
try
if fCount>5 then begin
ShowMessage('Sign-in is blocked Entered password too many times');
//Btn1.Enabled:= False;
Result:= False;
Exit;
end;
isFoundUser := LogonUser(PChar(vUserID),
PChar(vDomainName), //Domain name.
PChar(vPWD),
LOGON_TYPE_NEW_CREDENTIALS,
LOGON32_PROVIDER_DEFAULT,
hUser);
Result:= isFoundUser;
finally
if fCount<=5 then begin
if hUser>0 then begin
CloseHandle(hUser);
end
else
Inc(fCOUNT);
Result:= False;
end;
end;
end;
Comments
Post a Comment