diff options
author | rhenium <rhenium@rhe.jp> | 2014-09-03 07:03:18 +0900 |
---|---|---|
committer | rhenium <rhenium@rhe.jp> | 2014-09-03 07:03:18 +0900 |
commit | 22057cb575105ab666b6c2cd668b9612a831574b (patch) | |
tree | a2772b4d8bf120b4aebfc7a58d095432a5afd614 | |
parent | 927981f9161e0443951ef8c6f0acd17b86dddce9 (diff) | |
download | aclog-22057cb575105ab666b6c2cd668b9612a831574b.tar.gz |
web: sessions#create: refactor
-rw-r--r-- | app/controllers/sessions_controller.rb | 14 |
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 |