End of train commit
This commit is contained in:
@@ -20,6 +20,7 @@ class UserController < ApplicationController
|
||||
end
|
||||
|
||||
def obtain_token
|
||||
redirect_to user_omniauth_authorize_path('facebook') and return unless current_user.present?
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json do
|
||||
|
||||
+3
-2
@@ -28,14 +28,15 @@ class User
|
||||
|
||||
def self.find_for_facebook_oauth(auth_data, user)
|
||||
user = database.view(self.by_facebook(key: [auth_data.provider, auth_data.uid], limit: 1)).first
|
||||
|
||||
user || create(
|
||||
provider: auth_data.provider,
|
||||
uid: auth_data.uid,
|
||||
name: auth_data.info.nickname,
|
||||
email: auth_data.info.email,
|
||||
password: Devise.friendly_token[0,20],
|
||||
oauth_token: user.oauth_token = auth.credentials.token,
|
||||
oauth_expires_at: Time.at(auth_data.credentials.expires_at),
|
||||
oauth_token: auth_data.credentials.token,
|
||||
oauth_expires_at: auth_data.credentials.expires ? Time.at(auth_data.credentials.expires_at) : nil,
|
||||
auth_data: auth_data
|
||||
)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user