Module: Devise::ImapAdapter
- Defined in:
- lib/devise_imapable/imap_adapter.rb
Overview
simple adapter for imap credential checking (i don’t like to add stuff like this directly to the model)
Class Method Summary collapse
Class Method Details
.valid_credentials?(username, password) ⇒ Boolean
9 10 11 12 13 14 15 16 17 |
# File 'lib/devise_imapable/imap_adapter.rb', line 9 def self.valid_credentials?(username, password) imap = Net::IMAP.new(::Devise.imap_server) imap.authenticate("cram-md5", username, password) true rescue Net::IMAP::ResponseError => e false ensure imap.disconnect end |