Module: DovecotCramMD5Password

Extended by:
ActiveSupport::Concern
Included in:
PostfixAdmin::Admin, PostfixAdmin::Mailbox
Defined in:
lib/postfix_admin/concerns/dovecot_cram_md5_password.rb

Instance Method Summary collapse

Instance Method Details

#authenticate(unencrypted_password) ⇒ Object



27
28
29
# File 'lib/postfix_admin/concerns/dovecot_cram_md5_password.rb', line 27

def authenticate(unencrypted_password)
  password == DovecotCrammd5.calc(unencrypted_password) && self
end

#password_unencrypted=(unencrypted_password) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/postfix_admin/concerns/dovecot_cram_md5_password.rb', line 18

def password_unencrypted=(unencrypted_password)
  if unencrypted_password.nil?
    self.password = nil
  elsif !unencrypted_password.empty?
    @password_unencrypted = unencrypted_password
    self.password = DovecotCrammd5.calc(unencrypted_password)
  end
end