Module: ActiveModel::OneTimePassword::ClassMethods
- Defined in:
- lib/active_model/one_time_password.rb
Instance Method Summary collapse
Instance Method Details
#has_one_time_password(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/active_model/one_time_password.rb', line 6 def has_one_time_password( = {}) cattr_accessor :otp_column_name self.otp_column_name = ([:column_name] || "otp_secret_key").to_s include InstanceMethodsOnActivation before_create { self.otp_column = ROTP::Base32.random_base32 } if respond_to?(:attributes_protected_by_default) def self.attributes_protected_by_default #:nodoc: super + [self.otp_column_name] end end end |