app/models/person.rb
def authenticate_with_legacy_passwords(password)
    return false if password.blank?

    case password_digest
      when /^[0-9a-f]{40}$/ # sha1
        if Digest::SHA1.hexdigest(password) == password_digest
          update_attribute(:password, password)  #intentionally skip validations via update_attribute
          send_email(:account_created)
          return self
        else
          return false
        end

      else
        authenticate_without_legacy_passwords(password)
    end
  end
# support sha1 and mysql style passwords with auto-updating
support sha1 and mysql style passwords with auto-updating
support sha1 and mysql style passwords with auto - updating
def authenticate_with_legacy_passwords(password)
    return false if password.blank?
    case password_digest
      when /^[0-9a-f]{40}$/ 
        if Digest::SHA1.hexdigest(password) == password_digest
          update_attribute(:password, password)  
          send_email(:account_created)
          return self
        else
          return false
        end
      else
        authenticate_without_legacy_passwords(password)
    end
  end
def authenticate_with_legacy_passwords ( password ) return false if password . blank? case password_digest when / ^[0-9a-f]{40}$ / if Digest :: SHA1 . hexdigest ( password ) == password_digest update_attribute ( :password , password ) send_email ( :account_created ) return self else return false end else authenticate_without_legacy_passwords ( password ) end end
support sha1 and mysql style passwords with auto-updating
support sha1 and mysql style passwords with auto - updating
# sha1 #intentionally skip validations via update_attribute
password