Sha256: bcb8e6226092bad0d0de287b327306cc22ec98e926362be716e8dd3d3f210c5f

Contents?: true

Size: 746 Bytes

Versions: 1

Compression:

Stored size: 746 Bytes

Contents

module CmpaAuth
  module Models
    module Pessoa
      def self.included(receiver) #:nodoc:
        receiver.class_eval do
          
          include CmpaAuth::PortalConnection
          
          set_table_name :pessoas
        
          def lotacoes_temporarias_ativas
            ::LotacaoTemporaria.scoped(:conditions => {:fim => nil, :pessoa_id => id})
          end
          
          def senha=(pass)
            if pass != "senhaantiga" && pass.present?
              salt = [Array.new(6){rand(256).chr}.join].pack("m").chomp
              self.senha_salt = salt
              self.senha_hash = Digest::SHA256.hexdigest(pass + salt)
            end  
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cmpa_auth-1.0.5 lib/cmpa_auth/models/pessoa.rb