Skip to content
Extraits de code Groupes Projets
Valider c4ff07b0 rédigé par maxwell's avatar maxwell Validation de danielvincent
Parcourir les fichiers

twitter oauth dance complete

parent 31b3d739
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -9,6 +9,10 @@ gem "chef"
gem 'devise', '1.1.3'
gem 'devise-mongo_mapper', :git => 'git://github.com/collectiveidea/devise-mongo_mapper'
gem 'devise_invitable', '~> 0.3.4'
#Authentication
gem 'omniauth'
#Mongo
gem 'mongo_mapper', :branch => 'rails3', :git => 'git://github.com/jnunemaker/mongomapper.git'
gem 'bson_ext', '1.1'
......
......@@ -170,6 +170,9 @@ GEM
factory_girl_rails (1.0)
factory_girl (~> 1.3)
rails (>= 3.0.0.beta4)
faraday (0.4.6)
addressable (>= 2.1.1)
rack (>= 1.0.1)
ffi (0.6.3)
rake (>= 0.8.7)
gherkin (2.2.9)
......@@ -182,11 +185,20 @@ GEM
i18n (0.4.1)
json (1.4.6)
json_pure (1.4.6)
<<<<<<< HEAD
launchy (0.3.7)
configuration (>= 0.0.5)
rake (>= 0.8.1)
<<<<<<< HEAD
linecache19 (0.5.11)
ruby_core_source (>= 0.1.4)
=======
linecache (0.43)
=======
linecache19 (0.5.11)
ruby_core_source (>= 0.1.4)
>>>>>>> twitter oauth dance complete
>>>>>>> twitter oauth dance complete
mail (2.2.7)
activesupport (>= 2.3.6)
mime-types
......@@ -207,6 +219,8 @@ GEM
moneta (0.6.0)
mongo (1.1)
bson (>= 1.0.5)
multi_json (0.0.4)
net-ldap (0.1.1)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
......@@ -215,6 +229,7 @@ GEM
net-ssh-gateway (1.0.1)
net-ssh (>= 1.99.1)
nokogiri (1.4.3.1)
<<<<<<< HEAD
ohai (0.5.8)
extlib
json (>= 1.4.4, <= 1.4.6)
......@@ -222,15 +237,54 @@ GEM
mixlib-config
mixlib-log
systemu
=======
oa-basic (0.1.5)
multi_json (~> 0.0.2)
nokogiri (~> 1.4.2)
oa-core (= 0.1.5)
rest-client (~> 1.6.0)
oa-core (0.1.5)
rack (~> 1.1)
oa-enterprise (0.1.5)
net-ldap (~> 0.1.1)
nokogiri (~> 1.4.2)
oa-core (= 0.1.5)
pyu-ruby-sasl (~> 0.0.3.1)
rubyntlm (~> 0.1.1)
oa-oauth (0.1.5)
multi_json (~> 0.0.2)
nokogiri (~> 1.4.2)
oa-core (= 0.1.5)
oauth (~> 0.4.0)
oauth2 (~> 0.0.10)
oa-openid (0.1.5)
oa-core (= 0.1.5)
rack-openid (~> 1.1.1)
ruby-openid-apps-discovery
oauth (0.4.3)
oauth2 (0.0.13)
faraday (~> 0.4.1)
multi_json (>= 0.0.4)
omniauth (0.1.5)
oa-basic (= 0.1.5)
oa-core (= 0.1.5)
oa-enterprise (= 0.1.5)
oa-oauth (= 0.1.5)
oa-openid (= 0.1.5)
>>>>>>> twitter oauth dance complete
plucky (0.3.6)
mongo (~> 1.1)
polyglot (0.3.1)
pubsubhubbub (0.1.1)
em-http-request (>= 0.1.5)
eventmachine (>= 0.12.9)
pyu-ruby-sasl (0.0.3.2)
rack (1.2.1)
rack-mount (0.6.13)
rack (>= 1.0.0)
rack-openid (1.1.2)
rack (>= 0.4)
ruby-openid (>= 2.0.3)
rack-test (0.5.6)
rack (>= 1.0)
rails (3.0.1)
......@@ -269,8 +323,17 @@ GEM
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
<<<<<<< HEAD
ruby_core_source (0.1.4)
archive-tar-minitar (>= 0.5.2)
=======
ruby-openid (2.1.8)
ruby-openid-apps-discovery (1.2.0)
ruby-openid (>= 2.1.7)
ruby_core_source (0.1.4)
archive-tar-minitar (>= 0.5.2)
rubyntlm (0.1.1)
>>>>>>> twitter oauth dance complete
rubyzip (0.9.4)
selenium-webdriver (0.0.29)
childprocess (>= 0.0.7)
......@@ -325,6 +388,7 @@ DEPENDENCIES
mini_magick
mocha
mongo_mapper!
omniauth
pubsubhubbub
rails (>= 3.0.0)
redfinger!
......
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class OmniauthServicesController < ApplicationController
before_filter :authenticate_user!
def index
@services = current_user.services
end
def create
auth = request.env['omniauth.auth']
puts auth['extra']['access_token'].inspect
current_user.services.create(:provider => auth['provider'], :uid => auth['uid'])
flash[:notice] = "Authentication successful."
redirect_to omniauth_services_url
end
def destroy
@service = current_user.services.find(params[:id])
@service.destroy
flash[:notice] = "Successfully destroyed authentication."
redirect_to omniauth_services_url
end
end
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class OmniauthService
include MongoMapper::Document
belongs_to :user
key :provider, String
key :uid, String
end
......@@ -61,6 +61,8 @@ class User
many :raw_visible_posts, :in => :visible_post_ids, :class_name => 'Post'
many :aspects, :class_name => 'Aspect', :dependent => :destroy
many :services, :class_name => "OmniauthService"
#after_create :seed_aspects
before_destroy :unfriend_everyone, :remove_person
......
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
%h2
Services
%ul#stream
- for service in @services
%h3
= service.provider
%b
=service.uid
= link_to "disconnect", service, :confirm => "disconnect #{service.provider}?", :method => :delete
= link_to "Connect to twitter", "/auth/twitter"
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
def load_config_yaml filename
YAML.load(File.read(filename))
end
oauth_keys_file = "#{Rails.root}/config/oauth_keys.yml"
if File.exist? oauth_keys_file
SERVICES = load_config_yaml(oauth_keys_file)
SERVICES ||= load_config_yaml("#{oauth_keys_file}.example")
end
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter, SERVICES['twitter']['consumer_key'], SERVICES['twitter']['consumer_secret']
#provider :facebook, 'APP_ID', 'APP_SECRET'
end
twitter:
consumer_key: no69jTnL5SCOnWgk5XWqbQ
consumer_secret: 2DZyu8DA43AIeFsRVdz8OtAHLvCtPjdRKdNO3UZGqWM
twitter:
consumer_key: ""
consumer_secret: ""
......@@ -9,6 +9,9 @@ Diaspora::Application.routes.draw do
resources :requests, :except => [:edit, :update]
resources :photos, :except => [:index]
resources :albums
resources :omniauth_services
match '/auth/:provider/callback' => 'omniauth_services#create'
devise_for :users, :controllers => {:registrations => "registrations",
:password => "devise/passwords",
......@@ -18,7 +21,7 @@ Diaspora::Application.routes.draw do
match 'users/export', :to => 'users#export'
match 'users/import', :to => 'users#import'
match 'users/export_photos', :to => 'users#export_photos'
resources :users, :except => [:create, :new, :show]
resources :users, :except => [:create, :new, :show]
match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend'
match 'aspects/add_to_aspect',:to => 'aspects#add_to_aspect', :as => 'add_to_aspect'
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter