Module: AuthlogicMotp::Session::Methods
- Defined in:
- lib/authlogic_motp/session.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/authlogic_motp/session.rb', line 19 def self.included(klass) klass.class_eval do attr_accessor :otp_login attr_accessor :otp_password validate :validate_by_otp, :if => :authenticating_with_otp? end end |
Instance Method Details
#credentials ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/authlogic_motp/session.rb', line 28 def credentials if authenticating_with_otp? details = {} details[:otp_login] = send(login_field) details[:otp_password] = '<protected>' details else super end end |
#credentials=(value) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/authlogic_motp/session.rb', line 39 def credentials=(value) super values = value.is_a?(Array) ? value : [value] hash = values.first.is_a?(Hash) ? values.first.with_indifferent_access : nil if !hash.nil? self.otp_login = hash[:otp_login] if hash.key?(:otp_login) self.otp_password = hash[:otp_password] if hash.key?(:otp_password) end end |