Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

How to generate encrypted password for integration test of friendship (Treebook app) ?

In the video, Jason's integration test fails because there's no password. So he generates an encrypted password (somehow) and pastes it into the users.yml file. How did he generate that encrypted password? He doesn't say, and I haven't been able to find it on the forums.

My test is still failing...

6 Answers

John,

Thanks!

That site didn't work, but that's 'cause it was looking for a bcrypt hash (not MD5). I used the site: http://bcrypthashgenerator.apphb.com/ and it worked!

Your response put me on the right track :)

Karim.

Hey Karim,

I have no idea what Jason used to do this, he never explained the tool he used. However, you could google a tool for this, or use something like:

http://www.randomkeygen.com

Hope this helps

Thanks for responding, John. I tried grabbing one of the encrypted passwords from the site but got an error when running the test - invalid hash.

I think the encrypted password has to be created based on the password input (in the tutorial's case, it was "testing"), and this site only provides secure passwords, not encrypted passwords based on password input. That's my understanding, anyways.

Hopefully Jason Seifer responds...

Hi Karim,

I think you are right. I am guessing you are referring to the Devise gem in this post? I think Devise may 'hash' the passwords using MD5 Hashing. If this is the case, you should be able to use this website:

http://www.md5hashgenerator.com/

Insert your password and it should return the MD5 Hash of your password.

Let me know if this works or not. If this isn't correct then I have no idea and we will need to hear from Jason.

Ah, glad you have it sorted now. I admit, I have never actually looked into how Devise hashes it's passwords, but you have just taught me something there :D

Glad your sorted, have fun with Ruby on Rails!

Hi there,

I'm having the same issue have used the site that Karim has suggested but I'm still getting the 302 response. Anyone out there has this issue?

Thanks, Mick