blob: 03ab2b44780464f0437c7bc2fcfe445541869a89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
class SessionsController < ApplicationController
def callback
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"],
consumer_version: Settings.collector.consumer_version)
account.update_connection
User.from_hash(id: account.user_id,
screen_name: auth["extra"]["raw_info"]["screen_name"],
name: auth["extra"]["raw_info"]["name"],
profile_image_url: auth["extra"]["raw_info"]["profile_image_url_https"],
protected: auth["extra"]["raw_info"]["protected"])
session[:account] = account
session[:user_id] = account.user_id
redirect_to root_path
end
def destroy
reset_session
redirect_to root_path
end
end
|