Class: Devise::Strategies::MagicLinkAuthenticatable
- Inherits:
-
Authenticatable
- Object
- Authenticatable
- Devise::Strategies::MagicLinkAuthenticatable
- Defined in:
- lib/devise/strategies/magic_link_authenticatable.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
undef :password undef :password=.
Instance Method Summary collapse
Instance Attribute Details
#token ⇒ Object
undef :password undef :password=
12 13 14 |
# File 'lib/devise/strategies/magic_link_authenticatable.rb', line 12 def token @token end |
Instance Method Details
#authenticate! ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/devise/strategies/magic_link_authenticatable.rb', line 22 def authenticate! resource_class = mapping.to begin resource, extra = resource_class.decode_passwordless_token(token, resource_class) rescue Devise::Passwordless::InvalidOrExpiredTokenError fail!(:magic_link_invalid) return end if validate(resource) remember_me(resource) resource.after_magic_link_authentication env['warden.magic_link_extra'] = extra.fetch('data', {}).delete('extra') success!(resource) else fail!(:magic_link_invalid) end end |
#valid_for_http_auth? ⇒ Boolean
14 15 16 |
# File 'lib/devise/strategies/magic_link_authenticatable.rb', line 14 def valid_for_http_auth? super && http_auth_hash[:token].present? end |
#valid_for_params_auth? ⇒ Boolean
18 19 20 |
# File 'lib/devise/strategies/magic_link_authenticatable.rb', line 18 def valid_for_params_auth? super && params_auth_hash[:token].present? end |