aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrhenium <rhenium@rhe.jp>2014-09-03 07:03:18 +0900
committerrhenium <rhenium@rhe.jp>2014-09-03 07:03:18 +0900
commit22057cb575105ab666b6c2cd668b9612a831574b (patch)
treea2772b4d8bf120b4aebfc7a58d095432a5afd614
parent927981f9161e0443951ef8c6f0acd17b86dddce9 (diff)
downloadaclog-22057cb575105ab666b6c2cd668b9612a831574b.tar.gz
web: sessions#create: refactor
-rw-r--r--app/controllers/sessions_controller.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index c865e13..d6eb3be 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -2,9 +2,9 @@ class SessionsController < ApplicationController
def create
auth = request.env["omniauth.auth"]
- account = Account.register(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
@@ -12,10 +12,10 @@ class SessionsController < ApplicationController
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"] })
+ 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 })
session[:user_id] = account.user_id