class User < ActiveRecord::Base

  has_many :assignments, dependent: :destroy #=> many-to-many relation with roles
  has_many :roles, through: :assignments

  acts_as_authentic do |c|
    c.login_field = 'email'
    c.crypto_provider = Authlogic::CryptoProviders::Sha512
  end

  def generate_authentication_token
    token = loop do
      t = SecureRandom.base64.tr('+/=', 'Qrt')
      break t unless User.exists?(single_access_token: t)
    end
    self.update_attribute(:single_access_token, token)
  end
end

class User < ActiveRecord::Base

  has_many :assignments, dependent: :destroy #=> many-to-many relation with roles
  has_many :roles, through: :assignments

  acts_as_authentic do |c|
    c.login_field = 'email'
    #c.crypto_provider = Authlogic::CryptoProviders::Sha512
  end

  def generate_authentication_token
    token = loop do
      t = SecureRandom.base64.tr('+/=', 'Qrt')
      break t unless User.exists?(single_access_token: t)
    end
    self.update_attribute(:single_access_token, token)
  end
end

Disable Sha512 authlogic crypto provider
Disable Sha512 authlogic crypto provider
