Module: Identity::Mixins::User::ClassMethods
- Defined in:
- lib/identity/mixins/user.rb
Instance Method Summary collapse
- #active ⇒ Object
- #find_first_by_auth_conditions(tainted_conditions, opts = {active: true}) ⇒ Object
- #from_omniauth!(auth) ⇒ Object
Instance Method Details
#active ⇒ Object
26 27 28 29 30 |
# File 'lib/identity/mixins/user.rb', line 26 def active result = where(active: true) result = result.where.not(confirmed_at: nil) if devise_modules.include?(:confirmable) result end |
#find_first_by_auth_conditions(tainted_conditions, opts = {active: true}) ⇒ Object
22 23 24 |
# File 'lib/identity/mixins/user.rb', line 22 def find_first_by_auth_conditions(tainted_conditions, opts={active: true}) super end |
#from_omniauth!(auth) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/identity/mixins/user.rb', line 15 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 protected]" : auth.info.email user.password = Devise.friendly_token[0,20] end end |