bitzesty / devise_zxcvbn

Devise plugin to reject weak passwords using zxcvbn
MIT License
194 stars 38 forks source link

NoMethodError - undefined method `feedback' for #<Zxcvbn::Score:0x007fb4390a17a8> #25

Closed AhmedNadar closed 7 years ago

AhmedNadar commented 7 years ago

When I attempt to create a user account using Devise, I got he following error

NoMethodError - undefined method `feedback' for #<Zxcvbn::Score:0x007fd26cc99ca8>:
  devise_zxcvbn (2.1.2) lib/devise_zxcvbn/model.rb:37:in `zxcvbn_feedback'
  devise_zxcvbn (2.1.2) lib/devise_zxcvbn/model.rb:29:in `i18n_variables'
  devise_zxcvbn (2.1.2) lib/devise_zxcvbn/model.rb:23:in `not_weak_password'

The app use: Rails 5.0.1 ruby 2.3.1p112 'devise', '~> 4.2' 'devise_zxcvbn' and gem 'zxcvbn-ruby', require: 'zxcvbn'

Inside User.rb

devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, :confirmable, :lockable, :zxcvbnable

You can see the whole log here https://gist.github.com/AhmedNadar/afc096648d59897089bf3047275676f0

Within better error shell i got this:

>> @pass_score
=> #<Zxcvbn::Score:0x007fd6660aba60 
@entropy=14.288, @crack_time=1.0, @crack_time_display="instant", @score=0, 
@match_sequence=[#<Zxcvbn::Match matched_word="username11", token="username11", i=0, j=9, rank=2, pattern="dictionary", dictionary_name="user_inputs", base_entropy=1.0, uppercase_entropy=0.0, l33t_entropy=0, entropy=1.0>, #<Zxcvbn::Match i=10, j=13, token="1234", pattern="digits", entropy=13.28771237954945>], 
@password="paasswoord1234", @calc_time=0.005371412000386044>

Any idea what could cause that error? Thanks!

AhmedNadar commented 7 years ago

The issue was in gems order inside Gemfile.