Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authlogic 3.3.0 and 3.4.0 not working with Rails 4.0.x #400

Closed
Alamoz opened this issue Mar 4, 2014 · 9 comments
Closed

Authlogic 3.3.0 and 3.4.0 not working with Rails 4.0.x #400

Alamoz opened this issue Mar 4, 2014 · 9 comments

Comments

@Alamoz
Copy link

Alamoz commented Mar 4, 2014

Authlogic 3.3.0 and 3.4.0 not working with Rails 4.0.x. However, authlogic commit # e4b2990 does work with Rails 4.0.x.

Here is the output of the Rails 4.0.x logger when a user logs in:

F, [2014-03-04T07:25:09.640105 #28602] FATAL -- : NameError (uninitialized constant SCrypt): app/controllers/user_sessions_controller.rb:15:in `create'

So for now I'm specifying in Gemfile (thanks to @rhuppert for this info):

gem 'authlogic', github: 'binarylogic/authlogic', ref: 'e4b2990d6282f3f7b50249b4f639631aef68b939'

@danlaffan
Copy link
Contributor

Actually, there's an annoyingly simple solution to make this work on Rails 4.0.x.

You need these entries in your Gemfile:

gem 'authlogic', '~> 3.4.0'
gem 'scrypt'

Authlogic has changed its default encryption system from SHA512 to SCrypt. If you are an ongoing Authlogic user, you previously used Sha512, so you probably need / want to add two additional lines to your User model to transition to the new default encryption - SCrypt:

  acts_as_authentic do |c|
    if Rails.env.production?
      c.logged_in_timeout = 30.minutes
    else
      c.logged_in_timeout = 90.minutes
    end
    c.transition_from_crypto_providers = Authlogic::CryptoProviders::Sha512,
    c.crypto_provider = Authlogic::CryptoProviders::SCrypt
  end

If you don't want to upgrade to SCrypt, then you should just add this to your User.rb:

    c.crypto_provider = Authlogic::CryptoProviders::Sha512

Enjoy!

@nathany
Copy link
Contributor

nathany commented Mar 5, 2014

thanks @danlaffan

@ryanbooker
Copy link

Is there a reason Authlogic doesn't have a dependency on scrypt? Seems odd to have to manually include a gem that it requires.

@unixmonkey
Copy link

@ryanbooker I guess it makes sense, since it isn't actually required.

If you set c.crypto_provider = Authlogic::CryptoProviders::Sha512, then you don't need scrypt installed.

However, I agree that it is confusing, and I'm glad I found this issue.

youngbrioche added a commit to innoq/iqvoc that referenced this issue Apr 14, 2014
@AxisOfEval
Copy link

Since the issue has been solved, can this ticket be closed now?

@nathany
Copy link
Contributor

nathany commented Apr 28, 2014

Has it been solved? Maybe @danlaffan's comment needs to be put into the README/docs?

@tiegz
Copy link
Collaborator

tiegz commented Apr 28, 2014

👍 fixed, scrypt is no longer needed.

@nathany
Copy link
Contributor

nathany commented Apr 28, 2014

oh, gotcha. 3f6102f

@binarylogic
Copy link
Owner

Agree, thanks for your help on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants