Module: User::Omniauthable::ClassMethods
- Defined in:
- app/models/concerns/user/omniauthable.rb
Instance Method Summary collapse
Instance Method Details
#from_omniauth(auth) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/models/concerns/user/omniauthable.rb', line 6 def from_omniauth(auth) user = User.where(provider: auth.provider, uid: auth.uid).first unless user user = User.new user.provider = auth.provider user.uid = auth.uid user.first_name = auth.info.first_name user.last_name = auth.info.last_name user.email = auth.info.email user.lastfm_user_name = auth.info.nickname if user.provider == 'lastfm' user.save end user end |
#new_with_session(params, session) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'app/models/concerns/user/omniauthable.rb', line 23 def new_with_session(params, session) if session["devise.user_attributes"] new(session["devise.user_attributes"], without_protection: true) do |user| user.attributes = params user.valid? end else super end end |