Devise Password validation issue

38 views
Skip to first unread message

Sai Ch

unread,
Jul 27, 2016, 7:18:15 AM7/27/16
to Devise
Hi,

I am currently work on upgrade for rails 2.3.8 application into rails 5 application.

When I am trying to register a new user is working fine but when trying to login, it returns the following error.


BCrypt::Errors::InvalidHash - invalid hash:
  bcrypt (3.1.11) lib/bcrypt/password.rb:60:in `initialize'
  devise (4.2.0) lib/devise/encryptor.rb:14:in `compare'
  devise (4.2.0) lib/devise/models/database_authenticatable.rb:45:in `valid_password?'
  devise (4.2.0) lib/devise/strategies/database_authenticatable.rb:11:in `block in authenticate!'
  devise (4.2.0) lib/devise/models/authenticatable.rb:81:in `valid_for_authentication?'
  devise (4.2.0) lib/devise/strategies/authenticatable.rb:36:in `validate'
  devise (4.2.0) lib/devise/strategies/database_authenticatable.rb:11:in `authenticate!'
  warden (1.2.6) lib/warden/strategies/base.rb:53:in `_run!'
  warden (1.2.6) lib/warden/proxy.rb:358:in `block in _run_strategies_for'
  warden (1.2.6) lib/warden/proxy.rb:353:in `_run_strategies_for'
  warden (1.2.6) lib/warden/proxy.rb:323:in `_perform_authentication'
  warden (1.2.6) lib/warden/proxy.rb:127:in `authenticate!'
  devise (4.2.0) app/controllers/devise/sessions_controller.rb:17:in `create'

Here is my devise user table column names:

| Field                | Type         | Null | Key | Default | Extra          |
+----------------------+--------------+------+-----+---------+----------------+
| id                   | int(11)      | NO   | PRI | NULL    | auto_increment |
| email                | varchar(255) | NO   | UNI |         |                |
| encrypted_password   | varchar(128) | NO   |     |         |                |
| password_salt        | varchar(255) | NO   |     |         |                |
| confirmation_token   | varchar(255) | YES  | UNI | NULL    |                |
| confirmed_at         | datetime     | YES  |     | NULL    |                |
| confirmation_sent_at | datetime     | YES  |     | NULL    |                |
| reset_password_token | varchar(255) | YES  | UNI | NULL    |                |
| remember_token       | varchar(255) | YES  |     | NULL    |                |
| remember_created_at  | datetime     | YES  |     | NULL    |                |
| sign_in_count        | int(11)      | YES  |     | 0       |                |
| current_sign_in_at   | datetime     | YES  |     | NULL    |                |
| last_sign_in_at      | datetime     | YES  |     | NULL    |                |
| current_sign_in_ip   | varchar(255) | YES  |     | NULL    |                |
| last_sign_in_ip      | varchar(255) | YES  |     | NULL    |                |


Note: 

when I am checking into users data I had found encrypted_password and password_salt columns have values but there is no password_digest column name.
this is old application database. I need to connect old application database.

please suggest me anything.



Reply all
Reply to author
Forward
0 new messages