Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
Alamoz opened this Issue · 9 comments

8 participants

@Alamoz

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

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!

@Hermanverschooten Hermanverschooten referenced this issue
Closed

Failing tests on master (Feb 28, 2014) #393

4 of 4 tasks complete
@ryanbooker

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

@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.

@AxisOfEval

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

@nathany

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

@tiegz
Collaborator

:thumbsup: fixed, scrypt is no longer needed.

@nathany

oh, gotcha. 3f6102f

@binarylogic
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
Something went wrong with that request. Please try again.