Encrypted passwords and fixtures

maybe i’m not seeing the forest through the trees, but how might i go
about
representing encrypted passwords in fixtures? should i just encrypt
them at
the CL copy/paste into the fixture? Not sure if there’s a ‘proper’ way
to
do this.

Thanks.

On 12/11/05, Chris H. removed_email_address@domain.invalid wrote:

maybe i’m not seeing the forest through the trees, but how might i go about
representing encrypted passwords in fixtures? should i just encrypt them at
the CL copy/paste into the fixture? Not sure if there’s a ‘proper’ way to
do this.

You can include eRb tags in your YAML fixture files, so you can
actually do the encryption right in the fixture:

– BEGIN accounts.yml –
<% require ‘sha1’ %>
first:
id: 1
username: user_one
password: <%= SHA1::hexdigest ‘user_one_password’ %>
– END accounts.yml –

Obviously, modify that for whatever encryption scheme you’re using.


Regards,
John W.
http://johnwilger.com


Alice came to a fork in the road. “Which road do I take?” she asked.
“Where do you want to go?” responded the Cheshire cat.
“I don’t know,” Alice answered.
“Then,” said the cat, “it doesn’t matter.”

  • Lewis Carrol, Alice in Wonderland