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

OTP_counter migration error #30

Closed markusklooth closed 5 years ago

markusklooth commented 8 years ago

There should be a note for the otp_counter migration to set default:0 and null:false. Since if otp_counter is equal to nil and you try to fetch the otp_code in the following code:

def otp_code(options = {})
  if otp_counter_based
    if options[:auto_increment]
      self.otp_counter += 1
      save if !new_record?
    end
   ...

An error will occur because you cannot add 1 to nil. self.otp_counter += 1

robertomiranda commented 8 years ago

I agree, have you considering open pull request for that??

robertomiranda commented 5 years ago

closed by #41