Class: NoPassword::Email::Challenge
- Inherits:
-
Link::Challenge
- Object
- Link::Base
- Link::Challenge
- NoPassword::Email::Challenge
- Defined in:
- lib/nopassword/email/challenge.rb
Overview
Email-specific challenge that aliases identifier as email for convenience.
Constant Summary
Constants inherited from Link::Challenge
Link::Challenge::DEFAULT_TTL, Link::Challenge::TOKEN_SIZE
Instance Attribute Summary collapse
-
#authentication ⇒ Object
readonly
Returns the value of attribute authentication.
Instance Method Summary collapse
-
#email ⇒ Object
Convenience accessor - email is stored as identifier.
- #email=(value) ⇒ Object
-
#initialize(session, authentication: nil) ⇒ Challenge
constructor
A new instance of Challenge.
- #save ⇒ Object
Methods inherited from Link::Challenge
Methods inherited from Link::Base
#delete, delete, #persisted?, #save!, #save_without_validation, update
Constructor Details
#initialize(session, authentication: nil) ⇒ Challenge
Returns a new instance of Challenge.
10 11 12 13 |
# File 'lib/nopassword/email/challenge.rb', line 10 def initialize(session, authentication: nil, **) @authentication = authentication super(session, **) end |
Instance Attribute Details
#authentication ⇒ Object (readonly)
Returns the value of attribute authentication.
5 6 7 |
# File 'lib/nopassword/email/challenge.rb', line 5 def authentication @authentication end |
Instance Method Details
#email ⇒ Object
Convenience accessor - email is stored as identifier
16 17 18 |
# File 'lib/nopassword/email/challenge.rb', line 16 def email identifier end |
#email=(value) ⇒ Object
20 21 22 |
# File 'lib/nopassword/email/challenge.rb', line 20 def email=(value) self.identifier = value end |
#save ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/nopassword/email/challenge.rb', line 24 def save return false unless valid? # Sync email back to authentication before saving if authentication authentication.email = email authentication.save_without_validation end super end |