Skip to content

Instantly share code, notes, and snippets.

@colbyr
Created June 9, 2015 01:21
Show Gist options
  • Save colbyr/d61f393c628175f58683 to your computer and use it in GitHub Desktop.
Save colbyr/d61f393c628175f58683 to your computer and use it in GitHub Desktop.
fix host logins
commit 50881d92b0f1f5b11d56fb8dbaeb49be5b7469db
Author: Colby Rabideau <crabideau@hubspot.com>
Date: Sat May 9 23:33:48 2015 -0400
fix host logins
* check facebook user id instead of the `nickname` field which seems to have disappeared and caused all this trouble in the first place
* update `aws-sdk` to `v1.64`
* update `omniauth-facebook` to `v1.6.0`
* update `nokogiri` (an `aws-sdk` dep that wouldn't build) to `v1.6`
diff --git a/.ruby-version b/.ruby-version
new file mode 100644
index 0000000..eca07e4
--- /dev/null
+++ b/.ruby-version
@@ -0,0 +1 @@
+2.1.2
diff --git a/Gemfile b/Gemfile
index 2c6b686..8722d27 100644
--- a/Gemfile
+++ b/Gemfile
@@ -42,12 +42,14 @@ gem 'unicorn'
# Use Capistrano for deployment
gem 'capistrano', group: :development
+gem 'nokogiri', '~> 1.6'
+
# Use debugger
# gem 'debugger', group: [:development, :test]
-gem 'omniauth-facebook'
+gem 'omniauth-facebook', '1.6.0'
gem 'awesome_print', group: :development
-gem 'aws-sdk' # S3 API
+gem 'aws-sdk', '~> 1.64'
gem 'paperclip' # file attachment syntax and callbacks
gem 's3_direct_upload' # direct upload form helper and assets
gem 'streamio-ffmpeg'
diff --git a/Gemfile.lock b/Gemfile.lock
index c89f8e9..d14e007 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -28,10 +28,11 @@ GEM
arel (4.0.0)
atomic (1.1.14)
awesome_print (1.2.0)
- aws-sdk (1.24.0)
+ aws-sdk (1.64.0)
+ aws-sdk-v1 (= 1.64.0)
+ aws-sdk-v1 (1.64.0)
json (~> 1.4)
- nokogiri (>= 1.4.4, < 1.6.0)
- uuidtools (~> 2.1)
+ nokogiri (>= 1.4.4)
builder (3.1.4)
capistrano (3.0.1)
i18n
@@ -50,11 +51,10 @@ GEM
coffee-script-source (1.6.3)
erubis (2.7.0)
execjs (2.0.2)
- faraday (0.8.8)
- multipart-post (~> 1.2.0)
- hashie (2.0.5)
+ faraday (0.9.1)
+ multipart-post (>= 1.2, < 3)
+ hashie (3.4.1)
hike (1.2.3)
- httpauth (0.2.0)
i18n (0.6.5)
iso8601 (0.4.1)
jbuilder (1.5.1)
@@ -67,42 +67,44 @@ GEM
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.0)
- jwt (0.1.8)
- multi_json (>= 1.5)
+ jwt (1.5.0)
kgio (2.8.1)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25)
+ mini_portile (0.6.2)
minitest (4.7.5)
- multi_json (1.8.0)
- multipart-post (1.2.0)
+ multi_json (1.11.0)
+ multi_xml (0.5.5)
+ multipart-post (2.0.0)
mysql (2.9.1)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.7.0)
- nokogiri (1.5.10)
- oauth2 (0.8.1)
- faraday (~> 0.8)
- httpauth (~> 0.1)
- jwt (~> 0.1.4)
- multi_json (~> 1.0)
+ nokogiri (1.6.5)
+ mini_portile (~> 0.6.0)
+ oauth2 (1.0.0)
+ faraday (>= 0.8, < 0.10)
+ jwt (~> 1.0)
+ multi_json (~> 1.3)
+ multi_xml (~> 0.5)
rack (~> 1.2)
- omniauth (1.1.4)
- hashie (>= 1.2, < 3)
- rack
- omniauth-facebook (1.4.1)
- omniauth-oauth2 (~> 1.1.0)
- omniauth-oauth2 (1.1.1)
- oauth2 (~> 0.8.0)
- omniauth (~> 1.0)
+ omniauth (1.2.2)
+ hashie (>= 1.2, < 4)
+ rack (~> 1.0)
+ omniauth-facebook (1.6.0)
+ omniauth-oauth2 (~> 1.1)
+ omniauth-oauth2 (1.3.0)
+ oauth2 (~> 1.0)
+ omniauth (~> 1.2)
paperclip (3.5.2)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
polyglot (0.3.3)
- rack (1.5.2)
+ rack (1.5.3)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.0.0)
@@ -174,7 +176,6 @@ GEM
kgio (~> 2.6)
rack
raindrops (~> 0.7)
- uuidtools (2.1.4)
will_paginate (3.0.5)
PLATFORMS
@@ -182,13 +183,14 @@ PLATFORMS
DEPENDENCIES
awesome_print
- aws-sdk
+ aws-sdk (~> 1.64)
capistrano
coffee-rails (~> 4.0.0)
jbuilder (~> 1.2)
jquery-rails
mysql
- omniauth-facebook
+ nokogiri (~> 1.6)
+ omniauth-facebook (= 1.6.0)
paperclip
rails (= 4.0.0)
ruby-duration
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index 2eeaa80..8c76980 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -1,8 +1,13 @@
class SessionsController < ApplicationController
def create
- allowed_users = ['jazzdan', 'colbyrabideau', 'shaunjennings']
- facebook_nickname = env["omniauth.auth"]['info']['nickname']
- if allowed_users.include? facebook_nickname
+ allowed_users = [
+ '1488780297', # colby
+ '637685629', # dan
+ '1232220076', # shaun
+ ]
+ facebook_id = env["omniauth.auth"]['uid']
+
+ if allowed_users.include? facebook_id
user = User.from_omniauth(env["omniauth.auth"])
session[:user_id] = user.id
redirect_to root_url, notice: "Signed in!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment