Sha256: d2535da8010579dbe66d7342a54d2abfc3e6c9dea2a4ddd1c1aa309a4ea6b106
Contents?: true
Size: 1018 Bytes
Versions: 3
Compression:
Stored size: 1018 Bytes
Contents
module Identity module Mixins module User extend ActiveSupport::Concern included do devise *Identity.devise_modules if Devise.omniauth_providers.any? devise :omniauthable, omniauth_providers: Devise.omniauth_providers end end module ClassMethods def from_omniauth!(auth) where(provider: auth.provider, uid: auth.uid).first_or_create! do |user| user.email = auth.provider == "twitter" ? "#{auth.info.nickname}_email@example.com" : auth.info.email user.password = Devise.friendly_token[0,20] end end def find_first_by_auth_conditions(tainted_conditions, opts = {}) super(tainted_conditions, send(Identity.active_scope.where_values_hash).merge(opts)) end def active result = where(active: true) result = result.where.not(confirmed_at: nil) if devise_modules.include?(:confirmable) result end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
anadea-identity-0.4.1 | lib/identity/mixins/user.rb |
anadea-identity-0.4.0 | lib/identity/mixins/user.rb |
anadea-identity-0.3.3 | lib/identity/mixins/user.rb |