Sha256: f440071505c398057bb563532a1ef268edeb807a2a22792abd3d350d9c0e31c0

Contents?: true

Size: 645 Bytes

Versions: 1

Compression:

Stored size: 645 Bytes

Contents

# include MuckAuth::Models::MuckUser
module MuckAuth
  module Models
    module MuckUser
      extend ActiveSupport::Concern
    
      included do
        has_many :authentications
        accepts_nested_attributes_for :authentications, :allow_destroy => true
      end
      
      def apply_omniauth(omniauth)
        self.email = omniauth['user_info']['email'] if email.blank?
        authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'], :raw_auth => omniauth.to_json)
      end
      
      def password_required?
        (authentications.empty? || !password.blank?) && super
      end
      
    end 
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
muck-auth-3.1.0 lib/muck-auth/models/user.rb