I am trying to turn #registerable off in devise and just register users through console and seed data however I am having an issue with sign in.
- I created a user via the console: User.create!(email: '[email protected]', password: 'password', username: 'username')
- It passes validation and gets saved to the database
- I cannot sign in (through the website form) with this user when I provide the email: [email protected] and password: password
This is the password though, in console:
u = User.find_by_email('[email protected]') u => #<User id: 6, email: "[email protected]", encrypted_password: "$2a$10$xd0PMJ.qDDu6VtFd6i2EM.bQ0h1rvODyzaqFdzo3Uo4C...", username: "user", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, created_at: "2013-09-30 01:25:16", updated_at: "2013-09-30 01:25:16"> u.valid_password? 'password' => true
I've tried multiple users and I've tried creating it with db/seed.rb. Again, it does get into the database and everything looks fine. It just won't sign in. I've also tried adding the password_confirmation field with a matching password, no dice.
If I turn on :registerable in the user model, goto the sign up page, sign a user up, I can log in with that user (created through the form).
My only thought is that there is some kind of difference in the way the encrypted password is being generated? But that does not hold because I can run the same find_by_email/valid_password check on the web created user.
Any help would be greatly appreciated?
Edit:
I am not using Confirmable, here is my Devise attributes:
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatablen
Edit2 Now I can not login with my web created accounts. I need to do more debugging.