All threads / Rails for Beginners Part 17: Login Form Discussion

Ask A Question


You’re not receiving notifications from this thread.

Rails for Beginners Part 17: Login Form Discussion

It would be great to show how to do login with both username and email as well.

mm... is the same with, just create the username in your model, and validate username instead of email.


I'm getting this error when I try to login:

BCrypt::Errors::InvalidHash in SessionsController#create

I copied the sessions_controller.rb file from the source code. I also created a new user successfully, but it did not fix the issue.

Probably because you created your user before you added has_secure_password. Try to delete the user from DB and create a new one and then try to log in.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 53,130+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2021 GoRails, LLC. All rights reserved.