[DUG] IADsUser Change Password

David O'Brien Dave at iccs.co.nz
Fri Jan 18 10:14:24 NZDT 2013


Thanks, SetPassword does work fine, but doesn't validate the users old
password, or check for the complexity requirements. ChangePassword does,
but doesn't appear to work.

 

Do you know of any way to validate a user's username and password? I
want them to have to put in their existing password before changing.

 

From: delphi-bounces at listserver.123.net.nz
[mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of David
Moorhouse
Sent: Thursday, 17 January 2013 8:46 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] IADsUser Change Password

 

Here's the code that I use to reset the password, having opened the ADS
connection using an "LDAP://" <LDAP://>  string.

 

var

  UserObject: IADsUser;

...

  if UserObject.AccountDisabled then

    begin

      FErrorMessages.Add(Format('Cannot reset password, AD user account
for %s is disabled', [FUserDN]));

      Exit(false);

    end;

    UserObject.SetPassword(FNewPassword);

    UserObject.SetInfo;      (* Complete the operation to update the
user object. *)

    UserObject := nil;

...

Hope this helps



D 



 

 

Subject: 

Re: [DUG] IADsUser Change Password

Date: 

Wed, 16 Jan 2013 19:46:27 +1300

From: 

David O'Brien <Dave at iccs.co.nz> <mailto:Dave at iccs.co.nz> 

Reply-To: 

NZ Borland Developers Group - Delphi List <delphi at listserver.123.net.nz>
<mailto:delphi at listserver.123.net.nz> 

To: 

NZ Borland Developers Group - Delphi List <delphi at listserver.123.net.nz>
<mailto:delphi at listserver.123.net.nz> 

Great thanks, I don't want to reset at next login, just change the
password, so that shouldn't be a problem.

From: delphi-bounces at listserver.123.net.nz
[mailto:delphi-bounces at listserver.123.net.nz] On Behalf Of David
Moorhouse
Sent: Wednesday, 16 January 2013 5:35 p.m.
To: delphi at listserver.123.net.nz
Subject: Re: [DUG] IADsUser Change Password

 

I've done something similar but ran into problems when I forced a
password change at the next login.  Some AD rules only allow one
password change per day !

I'll look at some code tomorrow for you.

D

On 16/01/13 17:02, David O'Brien wrote:

	I am attempting to put together an easy way for users to change
domain password when they are out of the office, (or if they have a
MAC).

	 

	IADSUser.Setpassword(NewPassword) works, but doesn't do any
checks.

	IADSUser.ChangePassword(OldPassword, NewPassword) checks that
the old password is correct but always fails the new password with "The
password does not meet the password policy requirements..." Doesn't
matter how complex I make the password.

	 

	Note: I can change the password normally on the domain without a
problem, so I know the passwords I am trying to change to are complex
enough.

	 

	Anyone played with this before?

	 

	I am using:

	Var

	  User: IADsUser: 

	 

	      ADsOpenObject( 'WinNT://' + edtUser.Text,
'[Administrator]', '[admin password]', 1, IADsUser, User) ;

	      User.ChangePassword(edtPass.Text, 'c0mpl!anse');

	 

	Regards,

	Dave.

	 

	
	
	
	
	
	

	_______________________________________________
	NZ Borland Developers Group - Delphi mailing list
	Post: delphi at listserver.123.net.nz
	Admin: http://delphi.org.nz/mailman/listinfo/delphi
	Unsubscribe: send an email to
delphi-request at listserver.123.net.nz with Subject: unsubscribe

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20130118/a11912b1/attachment-0001.html 


More information about the Delphi mailing list