Module: Devise::Models::Imapable
- Defined in:
- lib/devise_imapable/model.rb
Overview
Imapable Module, responsible for validating the user credentials via an imap server.
Examples:
User.authenticate('[email protected]', 'password123') # returns authenticated user or nil
User.find(1).valid_password?('password123') # returns true/false
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#clean_up_passwords ⇒ Object
Set password to nil.
-
#valid_imap_authentication?(password) ⇒ Boolean
Checks if a resource is valid upon authentication.
Class Method Details
.included(base) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/devise_imapable/model.rb', line 13 def self.included(base) base.class_eval do extend ClassMethods attr_accessor :password end end |
Instance Method Details
#clean_up_passwords ⇒ Object
Set password to nil
22 23 24 |
# File 'lib/devise_imapable/model.rb', line 22 def clean_up_passwords self.password = nil end |
#valid_imap_authentication?(password) ⇒ Boolean
Checks if a resource is valid upon authentication.
27 28 29 |
# File 'lib/devise_imapable/model.rb', line 27 def valid_imap_authentication?(password) Devise::ImapAdapter.valid_credentials?(self.email, password) end |