rails authentication: authlogic to devise

Awesome post!!!!!

Nakshtra

Are you using authlogic for authentication purpose in your rails application and now want to switch to Devise?

Overview of Authlogic:

  user = User.find_by_email('test2@endpoint.com')
  actual_password = "password"
  digest = "#{actual_password}#{user.salt}"
  20.times { digest = Digest::SHA512.hexdigest(digest) }
  # compare digest and user.crypted_password here to verify password

Note that the stretches value for Authlogic defaults to 20, but it can be adjusted. Also note that Authlogic uses the SHA-512 hash function by default.
For password, it adds ‘password_hash’ and ‘password_salt’ columns, to store those encrypted values.

Devise: Devise uses ‘bcrypt’ algorithm and has ‘encrypted_password’  column.

Now the challenge was to migrate old users with their passwords, so that they can login with their existing email and password.

So its pretty much easy with following steps:

1. Have a look at devise documentation. Devise has provided a nice detailed documentation with proper steps and examples.
Devise Doc

2. In your gemfile

 gem…

View original post 288 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s