class User < ActiveRecord::Base
  acts_as_authentic do |config|
    config.crypto_provider = Authlogic::CryptoProviders::BCrypt
  end

  has_many :territorial_authorities, foreign_key: :coordinator_id

  scope :coordinators, -> { where(admin: false) }
  scope :unassigned_coordinators, -> {
    coordinators.
    joins('LEFT OUTER JOIN territorial_authorities ON territorial_authorities.coordinator_id = users.id').
    where('territorial_authorities.coordinator_id IS NULL')
  }

  validates :name, :email, presence: true

  def new_contacts
    Customer.contactable.for_districts(territorial_authorities.pluck(:id))
  end
end

class User < ActiveRecord::Base
  acts_as_authentic do |config|
    config.validates_length_of_password_field_options = { minimum: 4 }
    config.crypto_provider = Authlogic::CryptoProviders::BCrypt
  end

  has_many :territorial_authorities, foreign_key: :coordinator_id

  scope :coordinators, -> { where(admin: false) }
  scope :unassigned_coordinators, -> {
    coordinators.
    joins('LEFT OUTER JOIN territorial_authorities ON territorial_authorities.coordinator_id = users.id').
    where('territorial_authorities.coordinator_id IS NULL')
  }

  validates :name, :email, presence: true

  def new_contacts
    Customer.contactable.for_districts(territorial_authorities.pluck(:id))
  end
end

Rollback min password length to 4
Rollback min password length to 4

Authlogic v3.5 increased min password length from 4 to 8.
This breaks tests and seeding.

References:
https://github.com/binarylogic/authlogic/blob/master/CHANGELOG.md
