Setting a password for a user with ruby

How do you change a user password in ruby console?

An easy way to set a user password is

  rake admin:create

You have the option of making them an admin. You can look at the source for that take task to see how to do it in ruby.

6 Likes
user.password = password

The code looks like password is plain text.
Does the assignment set the hash?

1 Like

Yes when we save passwords we only save the hash and salt.

5 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.