Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validate NT password in code 1

Status
Not open for further replies.

Craftor

Programmer
Feb 1, 2001
420
NZ
Hi all

Is it possible to simulate a "Windows logon" in code e.g. the user enters their user name and password and the code logs in to the main server? If so how?

Thanks as always

Craftor :cool:

 
The only problem is that the LogonUser API needs certain privileges that can be hard to figure out. Rather download the unit SPPIValidatePassword from (Thanks Colin!)

Then, in your code, use the following function:

function IsValidUser(AUser, APass: string): boolean;
begin
// Assume a positive result
Result := true;
// Verify the username and password
try
SSPLogonUser('',AUser, APass);
except
Result := false;
end;
end;

Hope this helps. :)

Nico
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top