heapsource / active_model_otp

Adds methods to set and authenticate against one time passwords (Two-Factor Authentication). Inspired in AM::SecurePassword
MIT License
769 stars 81 forks source link

The option auto_increment (for ActiveModel::OneTimePassword#authenticate_code/otp_code) is not working #58

Closed flavono123 closed 5 years ago

flavono123 commented 5 years ago
irb(main):003:0> user.respond_to?(:new_record)
=> false
irb(main):004:0> user.respond_to?(:new_record?)
=> true

Since instances of ActiveRecord::Persistence have a method #new_record? not #new_record

https://github.com/heapsource/active_model_otp/blob/3280ecd766e741d6bb348ae541707d8ecb212542/lib/active_model/one_time_password.rb#L52 https://github.com/heapsource/active_model_otp/blob/3280ecd766e741d6bb348ae541707d8ecb212542/lib/active_model/one_time_password.rb#L69