Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitter login #28

Open
wants to merge 6 commits into
base: anarchy
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ GITHUB_KEY=52f4f647f765ad7b78dd
GITHUB_SECRET=a18052145bdabfae861fe31955ebe0cab7dae62b
FACEBOOK_KEY=408689879210206
FACEBOOK_SECRET=ea27fa9c347d13edc8c55de0c7f4a6c5
TWITTER_KEY=fBSzkDthCjy4eLnBGHXXcQ
TWITTER_SECRET=KOXvEY5xRpk5ETFIuJo0hgFfF9rfYHDErUcsNBZqQY
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
script: "DISPLAY=:99.0 RAILS_ENV=test xvfb-run -a bundle exec rake setup:default db:schema:load test"
before_script: "RAILS_ENV=test bundle exec rake setup:default db:schema:load"
script: "DISPLAY=:99.0 RAILS_ENV=test xvfb-run -a bundle exec rake test"
rvm:
- 1.9.3
- rbx-19mode
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ gem 'sqlite3'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-github'
gem 'omniauth-twitter'
gem 'localeapp'
gem 'bbq', :github => 'drugpl/bbq'
gem 'cancan'

group :assets do
gem 'sass-rails', '~> 3.2.3'
Expand Down
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ GEM
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
nokogiri (1.5.6)
oauth (0.4.7)
oauth2 (0.8.0)
faraday (~> 0.8)
httpauth (~> 0.1)
Expand All @@ -144,9 +145,15 @@ GEM
omniauth-github (1.0.3)
omniauth (~> 1.0)
omniauth-oauth2 (~> 1.1)
omniauth-oauth (1.0.1)
oauth
omniauth (~> 1.0)
omniauth-oauth2 (1.1.1)
oauth2 (~> 0.8.0)
omniauth (~> 1.0)
omniauth-twitter (0.0.14)
multi_json (~> 1.3)
omniauth-oauth (~> 1.0)
pg (0.14.1)
polyglot (0.3.3)
rack (1.4.1)
Expand Down Expand Up @@ -235,6 +242,7 @@ DEPENDENCIES
omniauth
omniauth-facebook
omniauth-github
omniauth-twitter
pg
rails (= 3.2.9)
ri_cal
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ class ApplicationController < ActionController::Base
# end
# end

rescue_from CanCan::AccessDenied do |exception|
redirect_to root_url, :alert => exception.message
end

private
def current_user
@current_user ||= Person.find(session[:user_id]) if session[:user_id]
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/presentations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class PresentationsController < ApplicationController
respond_to :html, :json

authorize_resource :only => :create

def create
event = Event.find(params[:event_id])
@presentation = event.presentations.create(params[:presentation])
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/people_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def rss_url(person)
end

def profiles_auth_links(person)
blank_providers = ['github', 'facebook'].select do |provider|
blank_providers = ['github', 'facebook', 'twitter'].select do |provider|
person.send("#{provider}_uid").blank?
end.map do |provider|
link_to provider, "/auth/#{provider}"
Expand Down
1 change: 1 addition & 0 deletions config/initializers/omniauth.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET']
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
end

OmniAuth.config.logger = Rails.logger
28 changes: 18 additions & 10 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ en:
- Fri
- Sat
abbr_month_names:
-
- !!null
- Jan
- Feb
- Mar
Expand All @@ -35,7 +35,7 @@ en:
long: ! '%B %d, %Y'
short: ! '%b %d'
month_names:
-
- !!null
- January
- February
- March
Expand Down Expand Up @@ -95,9 +95,9 @@ en:
month: Month
second: Seconds
year: Year
errors: &errors
errors:
format: ! '%{attribute} %{message}'
messages:
messages: &14640780
accepted: must be accepted
blank: can't be blank
confirmation: doesn't match confirmation
Expand Down Expand Up @@ -125,7 +125,7 @@ en:
wrong_length:
one: is the wrong length (should be 1 character)
other: is the wrong length (should be %{count} characters)
template:
template: &14628980
body: ! 'There were problems with the following fields:'
header:
one: 1 error prohibited this %{model} from being saved
Expand Down Expand Up @@ -197,15 +197,23 @@ en:
short: ! '%d %b %H:%M'
event: ! '%A, %d %B %Y at %H:%M'
pm: pm
# remove these aliases after 'activemodel' and 'activerecord' namespaces are removed from Rails repository
activemodel:
errors:
<<: *errors
format: ! '%{attribute} %{message}'
messages: *14640780
template: *14628980
activerecord:
errors:
<<: *errors

format: ! '%{attribute} %{message}'
messages: *14640780
template: *14628980
events:
no_upcoming_event: No upcoming event. That's extremely unlikely!
keep_updated: Keep an eye for updates on %{source} and come back later.

i18n:
transliterate:
rule: {}
unauthorized:
default: You are not authorized to access this page.
create:
presentation: Your karma is too low to speak on DRUG
Loading