Module: Devise::Models::Certifiable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/devise_certifiable/model.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #active_for_authentication? ⇒ Boolean
- #certified? ⇒ Boolean
- #certify!(certification_authority) ⇒ Object
- #inactive_message ⇒ Object
-
#request_certification ⇒ Object
Deliver certification request to certification authority.
Instance Method Details
#active_for_authentication? ⇒ Boolean
42 43 44 |
# File 'lib/devise_certifiable/model.rb', line 42 def active_for_authentication? super && certified? end |
#certified? ⇒ Boolean
28 29 30 |
# File 'lib/devise_certifiable/model.rb', line 28 def certified? !!certified_at end |
#certify!(certification_authority) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/devise_certifiable/model.rb', line 13 def certify!() unless_certified do unless .blank? self.certification_token = nil self.certified_at = Time.now self.certified_by = save(:validate => false) send_confirmation_instructions if confirmation_required? else self.errors.add(:certified_by, :certification_authority_missing) false end end end |
#inactive_message ⇒ Object
46 47 48 |
# File 'lib/devise_certifiable/model.rb', line 46 def !certified? ? :uncertified : super end |
#request_certification ⇒ Object
Deliver certification request to certification authority
33 34 35 36 37 38 39 40 |
# File 'lib/devise_certifiable/model.rb', line 33 def request_certification if self.respond_to?(:invite!) && self.invitation_token.present? certify!(self.invited_by) else generate_certification_token! if self.certification_token.nil? ::Devise.mailer.certification_request(self).deliver end end |