aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorrhenium <rhenium@rhe.jp>2014-07-18 07:07:00 +0900
committerrhenium <rhenium@rhe.jp>2014-07-18 07:07:00 +0900
commite3bb22385b0b9256fec616e62440f6e2fe7c2096 (patch)
tree516748969a88297f39f8480d970a4b306dc14a62 /app
parent8de67b1c4884bc3b5ead576ecffe923a786cfb40 (diff)
downloadaclog-e3bb22385b0b9256fec616e62440f6e2fe7c2096.tar.gz
web: fix sessions#create
Diffstat (limited to 'app')
-rw-r--r--app/controllers/sessions_controller.rb10
-rw-r--r--app/models/account.rb1
2 files changed, 6 insertions, 5 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index cc4ccbd..ff8bc66 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -2,20 +2,20 @@ class SessionsController < ApplicationController
def create
auth = request.env["omniauth.auth"]
- account = Account.create_or_update(user_id: auth["uid"],
- oauth_token: auth["credentials"]["token"],
- oauth_token_secret: auth["credentials"]["secret"])
+ account = Account.register(user_id: auth["uid"],
+ oauth_token: auth["credentials"]["token"],
+ oauth_token_secret: auth["credentials"]["secret"])
begin
WorkerManager.update_account(account)
rescue Aclog::Exceptions::WorkerConnectionError
end
- User.create_or_update_bulk_from_json([
+ User.create_or_update_from_json(
{ id: account.user_id,
screen_name: auth["extra"]["raw_info"]["screen_name"],
name: auth["extra"]["raw_info"]["name"],
profile_image_url_https: auth["extra"]["raw_info"]["profile_image_url_https"],
- protected: auth["extra"]["raw_info"]["protected"] }])
+ protected: auth["extra"]["raw_info"]["protected"] })
session[:user_id] = account.user_id
diff --git a/app/models/account.rb b/app/models/account.rb
index 17a5296..7631160 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -22,6 +22,7 @@ class Account < ActiveRecord::Base
account.oauth_token_secret = hash[:oauth_token_secret]
account.status = :active
account.save! if account.changed?
+ account
end
# Returns a random active account.