Module: Devise::Models::Revokable::ClassMethods

Defined in:
lib/devise_revokable/model.rb

Instance Method Summary collapse

Instance Method Details

#revocation_tokenObject



80
81
82
# File 'lib/devise_revokable/model.rb', line 80

def revocation_token
  generate_token(:revocation_token)
end

#revoke_by_token(token) ⇒ Object



74
75
76
77
78
# File 'lib/devise_revokable/model.rb', line 74

def revoke_by_token(token)
  revokable = find_or_initialize_with_error_by(:revocation_token, token, :revocation_token_invalid)
  revokable.revoke! if revokable.persisted?
  revokable
end

#send_revocation_instructions(attributes = {}) ⇒ Object



68
69
70
71
72
# File 'lib/devise_revokable/model.rb', line 68

def send_revocation_instructions(attributes = {})
  revokable = find_or_initialize_with_error_by(:email, attributes[:email], :not_found)
  revokable.send(:send_revocation_instructions) if revokable.persisted?
  revokable
end