module Ddr::Auth::User::ClassMethods

Public Instance Methods

find_by_user_key(key) click to toggle source
# File lib/ddr/auth/user.rb, line 20
def find_by_user_key(key)
  send("find_by_#{user_key_attribute}", key)
end
from_omniauth(auth) click to toggle source
# File lib/ddr/auth/user.rb, line 24
def from_omniauth(auth)
  user = find_by_user_key(auth.uid) ||
         new(user_key_attribute => auth.uid, :password => Devise.friendly_token)
  user.update!(email: auth.info.email,
               display_name: auth.info.name,
               first_name: auth.info.first_name,
               last_name: auth.info.last_name,
               nickname: auth.info.nickname)
  user
end