Class: LinkedRails::Auth::OtpAttempt
- Inherits:
-
OtpBase
- Object
- ApplicationRecord
- OtpBase
- LinkedRails::Auth::OtpAttempt
show all
- Defined in:
- app/models/linked_rails/auth/otp_attempt.rb
Instance Attribute Summary
Attributes inherited from OtpBase
#encoded_session, #otp_attempt
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from OtpBase
iri_template, owner_for_otp, singular_iri_template
Methods included from OtpHelper
#handle_expired_session, #owner_from_session, #session_from_param
Class Method Details
22
23
24
|
# File 'app/models/linked_rails/auth/otp_attempt.rb', line 22
def form_class
LinkedRails.otp_attempt_form_class
end
|
.requested_singular_resource(params, user_context) ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'app/models/linked_rails/auth/otp_attempt.rb', line 30
def requested_singular_resource(params, user_context)
owner = owner_for_otp(params, user_context)
return if owner.blank?
attempt = LinkedRails.otp_attempt_class.find_by(owner: owner) || LinkedRails.otp_attempt_class.new
attempt.encoded_session = params[:session]
attempt
end
|
.singular_route_key ⇒ Object
26
27
28
|
# File 'app/models/linked_rails/auth/otp_attempt.rb', line 26
def singular_route_key
'u/otp_attempt'
end
|
Instance Method Details
#raise_on_persisting(_opts = {}) ⇒ Object
6
7
8
|
# File 'app/models/linked_rails/auth/otp_attempt.rb', line 6
def raise_on_persisting(_opts = {})
raise "#{self.class.name} should not be persisted"
end
|
#save ⇒ Object
15
16
17
18
19
|
# File 'app/models/linked_rails/auth/otp_attempt.rb', line 15
def save
validate_otp_attempt
errors.empty?
end
|