Activedirectory change password

Hi all, I’m currently using Jusin Mecham’s activedirectory-0.9.3
plugin. Does anyone know how can I implement change password against
active directory? as a matter of fact, is there a way to update all
other info in active directory in rails?

paul wrote:

Hi all, I’m currently using Jusin Mecham’s activedirectory-0.9.3
plugin. Does anyone know how can I implement change password against
active directory? as a matter of fact, is there a way to update all
other info in active directory in rails?

A change_password method has been added to the ActiveDirectory::User
class in the activedirectory svn repository:

http://code.google.com/p/ruby-activedirectory/source

I don’t think there is any way to change other attributes yet.


Phil Ross
http://tzinfo.rubyforge.org/ – DST-aware timezone library for Ruby

Hi Phil, Just manage to see your message. I tried out your code today
and got the following message, any idea?

a.change_password(‘mynewpass’)
LDAP::ResultError: No Such Attribute
from
c:/ruby/lib/ruby/gems/1.8/gems/activedirectory-1.0.0/lib/active_di
ectory/user.rb:153:in modify' from c:/ruby/lib/ruby/gems/1.8/gems/activedirectory-1.0.0/lib/active_di ectory/user.rb:153:inchange_password’
from (irb):6

your code is

def change_password(new_password)
hash = {
‘unicodePwd’ => [
ActiveDirectory::Datatypes::UnicodePassword.to_remote(new_password) ],
‘lockoutTime’ => [ ‘0’ ],
‘userAccountControl’ => [ UAC_NORMAL_ACCOUNT.to_s ]
}
Base.connection.raw.modify(dn,hash)
end