# activedirectory change password

**URL:** <https://discuss.rubyonrails.org/t/activedirectory-change-password/6507>\
**Category:** rubyonrails-talk\
**Created:** [December 30, 2006, 2:30am UTC](https://discuss.rubyonrails.org/t/activedirectory-change-password/6507 "2006-12-30T02:30:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul3](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@paul3](https://discuss.rubyonrails.org/u/paul3)\
**Post date:** [December 30, 2006, 2:30am UTC](https://discuss.rubyonrails.org/t/activedirectory-change-password/6507/1 "2006-12-30T02:30:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Phil\_Ross](https://avatars.discourse-cdn.com/v4/letter/p/7ea924/32.png) [@Phil\_Ross](https://discuss.rubyonrails.org/u/Phil_Ross)\
**Post date:** [January 2, 2007, 12:21am UTC](https://discuss.rubyonrails.org/t/activedirectory-change-password/6507/2 "2007-01-02T00:21:50Z")

</div>

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](http://code.google.com/p/ruby-activedirectory/source)

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

---

<div class="post-metadata">

**Author:** ![paul3](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@paul3](https://discuss.rubyonrails.org/u/paul3)\
**Post date:** [January 17, 2007, 9:01am UTC](https://discuss.rubyonrails.org/t/activedirectory-change-password/6507/3 "2007-01-17T09:01:07Z")

</div>

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 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/gems/1.8/gems/activedirectory-1.0.0/lib/active\_di ectory/user.rb:153:in `modify' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from c:/ruby/lib/ruby/gems/1.8/gems/activedirectory-1.0.0/lib/active_di ectory/user.rb:153:in `change\_password' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from (irb):6

your code is

def change\_password(new\_password) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hash = { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'unicodePwd' =\> [ActiveDirectory::Datatypes::UnicodePassword.to\_remote(new\_password)], &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'lockoutTime' =\> ['0'], &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'userAccountControl' =\> [UAC\_NORMAL\_ACCOUNT.to\_s] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Base.connection.raw.modify(dn,hash) &nbsp;&nbsp;&nbsp;&nbsp;end
