Permalink
Browse files

removed explicit save on validation to make compatable with mongomapper

  • Loading branch information...
1 parent e4de9e8 commit 545897e5af98882be85fb84b64fb86e49b864de0 bhbryant committed Sep 15, 2010
@@ -1,44 +1,44 @@
-# encoding: utf-8
-
-class DeviseOauth2AuthenticatableGenerator < Rails::Generator::Base #:nodoc:
-
- default_options :client_id => "YOUR_APP_API_ID",
- :client_key => "YOUR_APP_SECRET_KEY",
- :auth_server => "https://graph.facebook.com",
- :requested_scope => "email,offline_access,publish_stream"
-
- def manifest
- record do |m|
- # m.dependency 'xd_receiver', [], options.merge(:collision => :skip)
- m.template 'oauth2_config.yml', File.join(*%w[config oauth2_config.yml])
- # m.template 'devise.facebook_connectable.js', File.join(*%w[public javascripts devise.facebook_connectable.js])
- end
- end
-
- protected
-
- def add_options!(opt)
- opt.separator ''
- opt.separator 'Options:'
-
- opt.on('--id CLIENT_ID', "Application API ID.") do |v|
- options[:client_id] = v if v.present?
- end
-
- opt.on('--key SECRET_KEY', "Application Secret key.") do |v|
- options[:client_key] = v if v.present?
- end
- opt.on('--server AUTH_SERVER', "Authentication Server.") do |v|
- options[:auth_server] = v if v.present?
- end
- opt.on('--resources REQUESTED_RESOURCES', "Requested Resources.") do |v|
- options[:requested_scope] = v if v.present?
- end
- end
-
-
- def banner
- "Usage: #{$0} devise_oauth2_authenticatable [--id API_ID] [--key SECRET_KEY] [--server AUTH_SERVER] [--scope REQUESTED RESOURCES]"
- end
-
+# encoding: utf-8
+
+class DeviseOauth2AuthenticatableGenerator < Rails::Generator::Base #:nodoc:
+
+ default_options :client_id => "YOUR_APP_API_ID",
+ :client_key => "YOUR_APP_SECRET_KEY",
+ :auth_server => "https://graph.facebook.com",
+ :requested_scope => "email,offline_access,publish_stream"
+
+ def manifest
+ record do |m|
+ # m.dependency 'xd_receiver', [], options.merge(:collision => :skip)
+ m.template 'oauth2_config.yml', File.join(*%w[config oauth2_config.yml])
+ # m.template 'devise.facebook_connectable.js', File.join(*%w[public javascripts devise.facebook_connectable.js])
+ end
+ end
+
+ protected
+
+ def add_options!(opt)
+ opt.separator ''
+ opt.separator 'Options:'
+
+ opt.on('--id CLIENT_ID', "Application API ID.") do |v|
+ options[:client_id] = v if v.present?
+ end
+
+ opt.on('--key SECRET_KEY', "Application Secret key.") do |v|
+ options[:client_key] = v if v.present?
+ end
+ opt.on('--server AUTH_SERVER', "Authentication Server.") do |v|
+ options[:auth_server] = v if v.present?
+ end
+ opt.on('--resources REQUESTED_RESOURCES', "Requested Resources.") do |v|
+ options[:requested_scope] = v if v.present?
+ end
+ end
+
+
+ def banner
+ "Usage: #{$0} devise_oauth2_authenticatable [--id API_ID] [--key SECRET_KEY] [--server AUTH_SERVER] [--scope REQUESTED RESOURCES]"
+ end
+
end
@@ -1,23 +1,23 @@
-defaults: &defaults
- # Required.
- client_id: <%= options[:client_id] %>
- client_secret: <%= options[:client_key] %>
- authorization_server: <%= options[:auth_server] %>
- requested_scope: <%= options[:requested_scope] %>
-
-
-
-development:
- <<: *defaults
-
-test: &test
- <<: *defaults
-
-production: &production
- <<: *defaults
-
-# staging:
-# <<: *production
-#
-# cucumber:
+defaults: &defaults
+ # Required.
+ client_id: <%= options[:client_id] %>
+ client_secret: <%= options[:client_key] %>
+ authorization_server: <%= options[:auth_server] %>
+ requested_scope: <%= options[:requested_scope] %>
+
+
+
+development:
+ <<: *defaults
+
+test: &test
+ <<: *defaults
+
+production: &production
+ <<: *defaults
+
+# staging:
+# <<: *production
+#
+# cucumber:
# <<: *test
@@ -1,59 +1,59 @@
-# encoding: utf-8
-require 'devise'
-require 'oauth2'
-
-
-require 'devise_oauth2_authenticatable/model'
-require 'devise_oauth2_authenticatable/strategy'
-require 'devise_oauth2_authenticatable/schema'
-require 'devise_oauth2_authenticatable/routes'
-#require 'devise_oauth2_authenticatable/controller_filters'
-require 'devise_oauth2_authenticatable/view_helpers'
-
-
-module Devise
- # Specifies the name of the database column name used for storing
- # the oauth UID. Useful if this info should be saved in a
- # generic column if different authentication solutions are used.
- mattr_accessor :oauth2_uid_field
- @@oauth2_uid_field = :oauth2_uid
-
- # Specifies the name of the database column name used for storing
- # the user Facebook session key. Useful if this info should be saved in a
- # generic column if different authentication solutions are used.
- mattr_accessor :oauth2_token_field
- @@oauth2_token_field = :oauth2_token
-
- # Specifies if account should be created if no account exists for
- # a specified Facebook UID or not.
- mattr_accessor :oauth2_auto_create_account
- @@oauth2_auto_create_account = true
-
- def self.oauth2_client
- @@oauth2_client ||= OAuth2::Client.new(OAUTH2_CONFIG['client_id'], OAUTH2_CONFIG['client_secret'], :site => OAUTH2_CONFIG['authorization_server'])
- end
-
-
- def self.session_sign_in_url(request, mapping)
- url = URI.parse(request.url)
- url.path = "#{mapping.parsed_path}/#{mapping.path_names[:sign_in]}"
- url.query = nil
- url.to_s
- end
-
- def self.requested_scope
- @@requested_scope ||= OAUTH2_CONFIG['requested_scope']
- end
-
-end
-
-# Load core I18n locales: en
-#
-I18n.load_path.unshift File.join(File.dirname(__FILE__), *%w[devise_oauth2_authenticatable locales en.yml])
-
-# Add +:facebook_connectable+ strategies to defaults.
-#
-Devise.add_module(:oauth2_authenticatable,
- :strategy => true,
- :controller => :sessions,
+# encoding: utf-8
+require 'devise'
+require 'oauth2'
+
+
+require 'devise_oauth2_authenticatable/model'
+require 'devise_oauth2_authenticatable/strategy'
+require 'devise_oauth2_authenticatable/schema'
+require 'devise_oauth2_authenticatable/routes'
+#require 'devise_oauth2_authenticatable/controller_filters'
+require 'devise_oauth2_authenticatable/view_helpers'
+
+
+module Devise
+ # Specifies the name of the database column name used for storing
+ # the oauth UID. Useful if this info should be saved in a
+ # generic column if different authentication solutions are used.
+ mattr_accessor :oauth2_uid_field
+ @@oauth2_uid_field = :oauth2_uid
+
+ # Specifies the name of the database column name used for storing
+ # the user Facebook session key. Useful if this info should be saved in a
+ # generic column if different authentication solutions are used.
+ mattr_accessor :oauth2_token_field
+ @@oauth2_token_field = :oauth2_token
+
+ # Specifies if account should be created if no account exists for
+ # a specified Facebook UID or not.
+ mattr_accessor :oauth2_auto_create_account
+ @@oauth2_auto_create_account = true
+
+ def self.oauth2_client
+ @@oauth2_client ||= OAuth2::Client.new(OAUTH2_CONFIG['client_id'], OAUTH2_CONFIG['client_secret'], :site => OAUTH2_CONFIG['authorization_server'])
+ end
+
+
+ def self.session_sign_in_url(request, mapping)
+ url = URI.parse(request.url)
+ url.path = "#{mapping.parsed_path}/#{mapping.path_names[:sign_in]}"
+ url.query = nil
+ url.to_s
+ end
+
+ def self.requested_scope
+ @@requested_scope ||= OAUTH2_CONFIG['requested_scope']
+ end
+
+end
+
+# Load core I18n locales: en
+#
+I18n.load_path.unshift File.join(File.dirname(__FILE__), *%w[devise_oauth2_authenticatable locales en.yml])
+
+# Add +:facebook_connectable+ strategies to defaults.
+#
+Devise.add_module(:oauth2_authenticatable,
+ :strategy => true,
+ :controller => :sessions,
:model => 'devise_oauth2_authenticatable/model')
@@ -1,9 +1,9 @@
-en:
- devise:
- sessions:
- oauth2_invalid: "Could not login. Invalid account."
- oauth2_timeout: "OAuth2 session expired., please sign in again to continue."
- oauth2_authenticity_token: "Something went wrong. For security reasons, please sign in again." # Revise this message =)
- oauth2_actions:
- sign_in: "Sign in" # NOTE: Not used for the default Facebook Connect button.
+en:
+ devise:
+ sessions:
+ oauth2_invalid: "Could not login. Invalid account."
+ oauth2_timeout: "OAuth2 session expired., please sign in again to continue."
+ oauth2_authenticity_token: "Something went wrong. For security reasons, please sign in again." # Revise this message =)
+ oauth2_actions:
+ sign_in: "Sign in" # NOTE: Not used for the default Facebook Connect button.
sign_out: "Sign out"
Oops, something went wrong.

0 comments on commit 545897e

Please sign in to comment.