heartcombo / devise

Flexible authentication solution for Rails with Warden.
http://blog.plataformatec.com.br/tag/devise/
MIT License
23.89k stars 5.54k forks source link

undefined method 'encryptor=' #5566

Closed cryptogopher closed 1 year ago

cryptogopher commented 1 year ago

Environment

Current behavior

When trying to run rails after $ rails generate devise:install and changing config/initializers/devise.rb I get error

$ bundle exec rails generate --help
Traceback (most recent call last):
...
[...]/config/initializers/devise.rb:241:in `block in <top (required)>': undefined method `encryptor=' for Devise:Module (NoMethodError)

Expected behavior

There should be no error.

It looks like encryptor= has been removed since 3.1.0 (https://github.com/heartcombo/devise/commit/7e96bac6a48abbf6ac761aab9c01e7efc838b5c1), but config template has not been updated.

config.encryptor should be removed from config template.

carlosantoniodasilva commented 1 year ago

config.encryptor is commented out in the template

You need devise-encryptable if you want to try that option though.

and changing config/initializers/devise.rb

What changes have you made? Maybe uncommented out that option by mistake?

cryptogopher commented 1 year ago

I uncommented it intentionally. First I set it to :sha512 - got error. Then I set it to :bcrypt - also got error.

It is indeed stated that I need additional gem when setting it to anything other than bcrypt. But when I set it to bcrypt the error was still there.

carlosantoniodasilva commented 1 year ago

Gotcha. You don't need the option to use bcrypt, that's used by default unless you install devise-encryptable and set that config to something else then. (otherwise it's just assumed bcrypt)