cloudfoundry-devise 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (210) hide show
  1. data/.gitignore +12 -0
  2. data/.travis.yml +13 -0
  3. data/CHANGELOG.rdoc +755 -0
  4. data/Gemfile +35 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.rdoc +366 -0
  7. data/Rakefile +34 -0
  8. data/app/controllers/devise/confirmations_controller.rb +46 -0
  9. data/app/controllers/devise/omniauth_callbacks_controller.rb +26 -0
  10. data/app/controllers/devise/passwords_controller.rb +50 -0
  11. data/app/controllers/devise/registrations_controller.rb +114 -0
  12. data/app/controllers/devise/sessions_controller.rb +49 -0
  13. data/app/controllers/devise/unlocks_controller.rb +34 -0
  14. data/app/helpers/devise_helper.rb +25 -0
  15. data/app/mailers/devise/mailer.rb +15 -0
  16. data/app/views/devise/confirmations/new.html.erb +12 -0
  17. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  18. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  19. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  20. data/app/views/devise/passwords/edit.html.erb +16 -0
  21. data/app/views/devise/passwords/new.html.erb +12 -0
  22. data/app/views/devise/registrations/edit.html.erb +25 -0
  23. data/app/views/devise/registrations/new.html.erb +18 -0
  24. data/app/views/devise/sessions/new.html.erb +17 -0
  25. data/app/views/devise/shared/_links.erb +25 -0
  26. data/app/views/devise/unlocks/new.html.erb +12 -0
  27. data/cloudfoundry-devise.gemspec +25 -0
  28. data/config/locales/en.yml +59 -0
  29. data/lib/devise.rb +453 -0
  30. data/lib/devise/controllers/helpers.rb +260 -0
  31. data/lib/devise/controllers/internal_helpers.rb +161 -0
  32. data/lib/devise/controllers/rememberable.rb +52 -0
  33. data/lib/devise/controllers/scoped_views.rb +33 -0
  34. data/lib/devise/controllers/shared_helpers.rb +26 -0
  35. data/lib/devise/controllers/url_helpers.rb +53 -0
  36. data/lib/devise/delegator.rb +16 -0
  37. data/lib/devise/encryptors/authlogic_sha512.rb +19 -0
  38. data/lib/devise/encryptors/base.rb +20 -0
  39. data/lib/devise/encryptors/clearance_sha1.rb +17 -0
  40. data/lib/devise/encryptors/restful_authentication_sha1.rb +22 -0
  41. data/lib/devise/encryptors/sha1.rb +25 -0
  42. data/lib/devise/encryptors/sha512.rb +25 -0
  43. data/lib/devise/failure_app.rb +149 -0
  44. data/lib/devise/hooks/activatable.rb +11 -0
  45. data/lib/devise/hooks/forgetable.rb +9 -0
  46. data/lib/devise/hooks/rememberable.rb +6 -0
  47. data/lib/devise/hooks/timeoutable.rb +24 -0
  48. data/lib/devise/hooks/trackable.rb +9 -0
  49. data/lib/devise/mailers/helpers.rb +86 -0
  50. data/lib/devise/mapping.rb +175 -0
  51. data/lib/devise/models.rb +91 -0
  52. data/lib/devise/models/authenticatable.rb +181 -0
  53. data/lib/devise/models/confirmable.rb +220 -0
  54. data/lib/devise/models/database_authenticatable.rb +122 -0
  55. data/lib/devise/models/encryptable.rb +72 -0
  56. data/lib/devise/models/lockable.rb +169 -0
  57. data/lib/devise/models/omniauthable.rb +23 -0
  58. data/lib/devise/models/recoverable.rb +136 -0
  59. data/lib/devise/models/registerable.rb +21 -0
  60. data/lib/devise/models/rememberable.rb +114 -0
  61. data/lib/devise/models/serializable.rb +43 -0
  62. data/lib/devise/models/timeoutable.rb +45 -0
  63. data/lib/devise/models/token_authenticatable.rb +72 -0
  64. data/lib/devise/models/trackable.rb +30 -0
  65. data/lib/devise/models/validatable.rb +62 -0
  66. data/lib/devise/modules.rb +30 -0
  67. data/lib/devise/omniauth.rb +28 -0
  68. data/lib/devise/omniauth/config.rb +45 -0
  69. data/lib/devise/omniauth/url_helpers.rb +33 -0
  70. data/lib/devise/orm/active_record.rb +44 -0
  71. data/lib/devise/orm/mongoid.rb +31 -0
  72. data/lib/devise/param_filter.rb +41 -0
  73. data/lib/devise/path_checker.rb +18 -0
  74. data/lib/devise/rails.rb +73 -0
  75. data/lib/devise/rails/routes.rb +385 -0
  76. data/lib/devise/rails/warden_compat.rb +120 -0
  77. data/lib/devise/schema.rb +109 -0
  78. data/lib/devise/strategies/authenticatable.rb +155 -0
  79. data/lib/devise/strategies/base.rb +15 -0
  80. data/lib/devise/strategies/database_authenticatable.rb +21 -0
  81. data/lib/devise/strategies/rememberable.rb +53 -0
  82. data/lib/devise/strategies/token_authenticatable.rb +57 -0
  83. data/lib/devise/test_helpers.rb +90 -0
  84. data/lib/devise/version.rb +3 -0
  85. data/lib/generators/active_record/devise_generator.rb +71 -0
  86. data/lib/generators/active_record/templates/migration.rb +29 -0
  87. data/lib/generators/active_record/templates/migration_existing.rb +26 -0
  88. data/lib/generators/devise/devise_generator.rb +22 -0
  89. data/lib/generators/devise/install_generator.rb +24 -0
  90. data/lib/generators/devise/orm_helpers.rb +31 -0
  91. data/lib/generators/devise/views_generator.rb +98 -0
  92. data/lib/generators/mongoid/devise_generator.rb +60 -0
  93. data/lib/generators/templates/README +32 -0
  94. data/lib/generators/templates/devise.rb +215 -0
  95. data/lib/generators/templates/markerb/confirmation_instructions.markerb +5 -0
  96. data/lib/generators/templates/markerb/reset_password_instructions.markerb +8 -0
  97. data/lib/generators/templates/markerb/unlock_instructions.markerb +7 -0
  98. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +15 -0
  99. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +19 -0
  100. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +15 -0
  101. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +22 -0
  102. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +17 -0
  103. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +15 -0
  104. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +15 -0
  105. data/test/controllers/helpers_test.rb +254 -0
  106. data/test/controllers/internal_helpers_test.rb +96 -0
  107. data/test/controllers/sessions_controller_test.rb +16 -0
  108. data/test/controllers/url_helpers_test.rb +59 -0
  109. data/test/delegator_test.rb +19 -0
  110. data/test/devise_test.rb +72 -0
  111. data/test/encryptors_test.rb +30 -0
  112. data/test/failure_app_test.rb +207 -0
  113. data/test/generators/active_record_generator_test.rb +47 -0
  114. data/test/generators/devise_generator_test.rb +39 -0
  115. data/test/generators/install_generator_test.rb +13 -0
  116. data/test/generators/mongoid_generator_test.rb +23 -0
  117. data/test/generators/views_generator_test.rb +52 -0
  118. data/test/helpers/devise_helper_test.rb +51 -0
  119. data/test/indifferent_hash.rb +33 -0
  120. data/test/integration/authenticatable_test.rb +590 -0
  121. data/test/integration/confirmable_test.rb +262 -0
  122. data/test/integration/database_authenticatable_test.rb +82 -0
  123. data/test/integration/http_authenticatable_test.rb +82 -0
  124. data/test/integration/lockable_test.rb +212 -0
  125. data/test/integration/omniauthable_test.rb +133 -0
  126. data/test/integration/recoverable_test.rb +287 -0
  127. data/test/integration/registerable_test.rb +335 -0
  128. data/test/integration/rememberable_test.rb +158 -0
  129. data/test/integration/timeoutable_test.rb +98 -0
  130. data/test/integration/token_authenticatable_test.rb +148 -0
  131. data/test/integration/trackable_test.rb +92 -0
  132. data/test/mailers/confirmation_instructions_test.rb +95 -0
  133. data/test/mailers/reset_password_instructions_test.rb +83 -0
  134. data/test/mailers/unlock_instructions_test.rb +77 -0
  135. data/test/mapping_test.rb +128 -0
  136. data/test/models/confirmable_test.rb +334 -0
  137. data/test/models/database_authenticatable_test.rb +167 -0
  138. data/test/models/encryptable_test.rb +67 -0
  139. data/test/models/lockable_test.rb +225 -0
  140. data/test/models/recoverable_test.rb +198 -0
  141. data/test/models/rememberable_test.rb +168 -0
  142. data/test/models/serializable_test.rb +38 -0
  143. data/test/models/timeoutable_test.rb +42 -0
  144. data/test/models/token_authenticatable_test.rb +49 -0
  145. data/test/models/trackable_test.rb +5 -0
  146. data/test/models/validatable_test.rb +113 -0
  147. data/test/models_test.rb +109 -0
  148. data/test/omniauth/config_test.rb +57 -0
  149. data/test/omniauth/url_helpers_test.rb +58 -0
  150. data/test/orm/active_record.rb +9 -0
  151. data/test/orm/mongoid.rb +14 -0
  152. data/test/rails_app/Rakefile +10 -0
  153. data/test/rails_app/app/active_record/admin.rb +6 -0
  154. data/test/rails_app/app/active_record/shim.rb +2 -0
  155. data/test/rails_app/app/active_record/user.rb +6 -0
  156. data/test/rails_app/app/controllers/admins/sessions_controller.rb +6 -0
  157. data/test/rails_app/app/controllers/admins_controller.rb +6 -0
  158. data/test/rails_app/app/controllers/application_controller.rb +8 -0
  159. data/test/rails_app/app/controllers/home_controller.rb +25 -0
  160. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +2 -0
  161. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +2 -0
  162. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +14 -0
  163. data/test/rails_app/app/controllers/users_controller.rb +23 -0
  164. data/test/rails_app/app/helpers/application_helper.rb +3 -0
  165. data/test/rails_app/app/mailers/users/mailer.rb +3 -0
  166. data/test/rails_app/app/mongoid/admin.rb +24 -0
  167. data/test/rails_app/app/mongoid/shim.rb +24 -0
  168. data/test/rails_app/app/mongoid/user.rb +45 -0
  169. data/test/rails_app/app/views/admins/index.html.erb +1 -0
  170. data/test/rails_app/app/views/admins/sessions/new.html.erb +2 -0
  171. data/test/rails_app/app/views/home/admin_dashboard.html.erb +1 -0
  172. data/test/rails_app/app/views/home/index.html.erb +1 -0
  173. data/test/rails_app/app/views/home/join.html.erb +1 -0
  174. data/test/rails_app/app/views/home/private.html.erb +1 -0
  175. data/test/rails_app/app/views/home/user_dashboard.html.erb +1 -0
  176. data/test/rails_app/app/views/layouts/application.html.erb +24 -0
  177. data/test/rails_app/app/views/users/index.html.erb +1 -0
  178. data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +1 -0
  179. data/test/rails_app/app/views/users/sessions/new.html.erb +1 -0
  180. data/test/rails_app/config.ru +4 -0
  181. data/test/rails_app/config/application.rb +41 -0
  182. data/test/rails_app/config/boot.rb +8 -0
  183. data/test/rails_app/config/database.yml +18 -0
  184. data/test/rails_app/config/environment.rb +5 -0
  185. data/test/rails_app/config/environments/development.rb +18 -0
  186. data/test/rails_app/config/environments/production.rb +33 -0
  187. data/test/rails_app/config/environments/test.rb +33 -0
  188. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  189. data/test/rails_app/config/initializers/devise.rb +197 -0
  190. data/test/rails_app/config/initializers/inflections.rb +2 -0
  191. data/test/rails_app/config/initializers/secret_token.rb +2 -0
  192. data/test/rails_app/config/routes.rb +87 -0
  193. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +71 -0
  194. data/test/rails_app/db/schema.rb +52 -0
  195. data/test/rails_app/lib/shared_admin.rb +10 -0
  196. data/test/rails_app/lib/shared_user.rb +26 -0
  197. data/test/rails_app/public/404.html +26 -0
  198. data/test/rails_app/public/422.html +26 -0
  199. data/test/rails_app/public/500.html +26 -0
  200. data/test/rails_app/public/favicon.ico +0 -0
  201. data/test/rails_app/script/rails +10 -0
  202. data/test/routes_test.rb +240 -0
  203. data/test/support/assertions.rb +27 -0
  204. data/test/support/helpers.rb +109 -0
  205. data/test/support/integration.rb +88 -0
  206. data/test/support/locale/en.yml +4 -0
  207. data/test/support/webrat/integrations/rails.rb +24 -0
  208. data/test/test_helper.rb +27 -0
  209. data/test/test_helpers_test.rb +134 -0
  210. metadata +295 -0
@@ -0,0 +1,2 @@
1
+ class Publisher::RegistrationsController < ApplicationController
2
+ end
@@ -0,0 +1,2 @@
1
+ class Publisher::SessionsController < ApplicationController
2
+ end
@@ -0,0 +1,14 @@
1
+ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
2
+ def facebook
3
+ data = env["omniauth.auth"]
4
+ session["devise.facebook_data"] = data["extra"]["user_hash"]
5
+ render :json => data
6
+ end
7
+
8
+ def sign_in_facebook
9
+ user = User.find_by_email('user@test.com')
10
+ user.remember_me = true
11
+ sign_in user
12
+ render :text => ""
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ class UsersController < ApplicationController
2
+ prepend_before_filter :current_user, :only => :exhibit
3
+ before_filter :authenticate_user!, :except => [:accept, :exhibit]
4
+ respond_to :html, :xml
5
+
6
+ def index
7
+ user_session[:cart] = "Cart"
8
+ respond_with(current_user)
9
+ end
10
+
11
+ def accept
12
+ @current_user = current_user
13
+ end
14
+
15
+ def exhibit
16
+ render :text => current_user ? "User is authenticated" : "User is not authenticated"
17
+ end
18
+
19
+ def expire
20
+ user_session['last_request_at'] = 31.minutes.ago.utc
21
+ render :text => 'User will be expired on next request'
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ # Methods added to this helper will be available to all templates in the application.
2
+ module ApplicationHelper
3
+ end
@@ -0,0 +1,3 @@
1
+ class Users::Mailer < Devise::Mailer
2
+ default :from => 'custom@example.com'
3
+ end
@@ -0,0 +1,24 @@
1
+ require 'shared_admin'
2
+
3
+ class Admin
4
+ include Mongoid::Document
5
+ include Shim
6
+ include SharedAdmin
7
+
8
+ ## Database authenticatable
9
+ field :email, :type => String, :null => true
10
+ field :encrypted_password, :type => String, :null => true
11
+
12
+ ## Recoverable
13
+ field :reset_password_token, :type => String
14
+ field :reset_password_sent_at, :type => Time
15
+
16
+ ## Rememberable
17
+ field :remember_created_at, :type => Time
18
+
19
+ ## Encryptable
20
+ field :password_salt, :type => String
21
+
22
+ ## Lockable
23
+ field :locked_at, :type => Time
24
+ end
@@ -0,0 +1,24 @@
1
+ module Shim
2
+ extend ::ActiveSupport::Concern
3
+
4
+ included do
5
+ include ::Mongoid::Timestamps
6
+ field :created_at, :type => DateTime
7
+ end
8
+
9
+ module ClassMethods
10
+ def last(options={})
11
+ options.delete(:order) if options[:order] == "id"
12
+ super(options)
13
+ end
14
+
15
+ def find_by_email(email)
16
+ first(:conditions => { :email => email })
17
+ end
18
+ end
19
+
20
+ # overwrite equality (because some devise tests use this for asserting model equality)
21
+ def ==(other)
22
+ other.is_a?(self.class) && _id == other._id
23
+ end
24
+ end
@@ -0,0 +1,45 @@
1
+ require 'shared_user'
2
+
3
+ class User
4
+ include Mongoid::Document
5
+ include Shim
6
+ include SharedUser
7
+
8
+ field :username, :type => String
9
+ field :facebook_token, :type => String
10
+
11
+ ## Database authenticatable
12
+ field :email, :type => String, :null => false, :default => ""
13
+ field :encrypted_password, :type => String, :null => false, :default => ""
14
+
15
+ ## Recoverable
16
+ field :reset_password_token, :type => String
17
+ field :reset_password_sent_at, :type => Time
18
+
19
+ ## Rememberable
20
+ field :remember_created_at, :type => Time
21
+
22
+ ## Trackable
23
+ field :sign_in_count, :type => Integer, :default => 0
24
+ field :current_sign_in_at, :type => Time
25
+ field :last_sign_in_at, :type => Time
26
+ field :current_sign_in_ip, :type => String
27
+ field :last_sign_in_ip, :type => String
28
+
29
+ ## Encryptable
30
+ # field :password_salt, :type => String
31
+
32
+ ## Confirmable
33
+ field :confirmation_token, :type => String
34
+ field :confirmed_at, :type => Time
35
+ field :confirmation_sent_at, :type => Time
36
+ # field :unconfirmed_email, :type => String # Only if using reconfirmable
37
+
38
+ ## Lockable
39
+ field :failed_attempts, :type => Integer, :default => 0 # Only if lock strategy is :failed_attempts
40
+ field :unlock_token, :type => String # Only if unlock strategy is :email or :both
41
+ field :locked_at, :type => Time
42
+
43
+ # Token authenticatable
44
+ field :authentication_token, :type => String
45
+ end
@@ -0,0 +1 @@
1
+ Welcome Admin!
@@ -0,0 +1,2 @@
1
+ Welcome to "sessions/new" view!
2
+ <%= render :file => "devise/sessions/new" %>
@@ -0,0 +1,24 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html>
4
+ <head>
5
+ <title>Devise Test App</title>
6
+ </head>
7
+ <body>
8
+ <div id="container">
9
+ <%- flash.each do |name, msg| -%>
10
+ <%= content_tag :div, msg, :id => "flash_#{name}" %>
11
+ <%- end -%>
12
+
13
+ <% if user_signed_in? -%>
14
+ <p>Hello User <%= current_user.email %>! You are signed in!</p>
15
+ <% end -%>
16
+
17
+ <% if admin_signed_in? -%>
18
+ <p>Hello Admin <%= current_admin.email %>! You are signed in!</p>
19
+ <% end -%>
20
+
21
+ <%= yield %>
22
+ </div>
23
+ </body>
24
+ </html>
@@ -0,0 +1 @@
1
+ Welcome User #<%= current_user.id %>!
@@ -0,0 +1 @@
1
+ Special user view
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run RailsApp::Application
@@ -0,0 +1,41 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "action_controller/railtie"
4
+ require "action_mailer/railtie"
5
+ require "active_resource/railtie"
6
+ require "rails/test_unit/railtie"
7
+
8
+ Bundler.require :default, DEVISE_ORM
9
+
10
+ begin
11
+ require "#{DEVISE_ORM}/railtie"
12
+ rescue LoadError
13
+ end
14
+
15
+ require "devise"
16
+
17
+ module RailsApp
18
+ class Application < Rails::Application
19
+ # Add additional load paths for your own custom dirs
20
+ config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers views).include?($1) }
21
+ config.autoload_paths += [ "#{config.root}/app/#{DEVISE_ORM}" ]
22
+
23
+ # Configure generators values. Many other options are available, be sure to check the documentation.
24
+ # config.generators do |g|
25
+ # g.orm :active_record
26
+ # g.template_engine :erb
27
+ # g.test_framework :test_unit, :fixture => true
28
+ # end
29
+
30
+ # Configure sensitive parameters which will be filtered from the log file.
31
+ config.filter_parameters << :password
32
+ config.assets.enabled = false
33
+
34
+ config.action_mailer.default_url_options = { :host => "localhost:3000" }
35
+
36
+ # This was used to break devise in some situations
37
+ config.to_prepare do
38
+ Devise::SessionsController.layout "application"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,8 @@
1
+ unless defined?(DEVISE_ORM)
2
+ DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
3
+ end
4
+
5
+ require 'rubygems'
6
+ require 'bundler/setup'
7
+
8
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,18 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: ":memory:"
15
+
16
+ production:
17
+ adapter: sqlite3
18
+ database: ":memory:"
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ RailsApp::Application.initialize!
@@ -0,0 +1,18 @@
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the webserver when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+ end
@@ -0,0 +1,33 @@
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # The production environment is meant for finished, "live" apps.
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # See everything in the log (default is :info)
13
+ # config.log_level = :debug
14
+
15
+ # Use a different logger for distributed setups
16
+ # config.logger = SyslogLogger.new
17
+
18
+ # Use a different cache store in production
19
+ # config.cache_store = :mem_cache_store
20
+
21
+ # Disable Rails's static asset server
22
+ # In production, Apache or nginx will already do this
23
+ config.serve_static_assets = false
24
+
25
+ # Enable serving of images, stylesheets, and javascripts from an asset server
26
+ # config.action_controller.asset_host = "http://assets.example.com"
27
+
28
+ # Disable delivery errors, bad email addresses will be ignored
29
+ # config.action_mailer.raise_delivery_errors = false
30
+
31
+ # Enable threaded mode
32
+ # config.threadsafe!
33
+ end
@@ -0,0 +1,33 @@
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Disable request forgery protection in test environment
18
+ config.action_controller.allow_forgery_protection = false
19
+
20
+ # Tell Action Mailer not to deliver emails to the real world.
21
+ # The :test delivery method accumulates sent emails in the
22
+ # ActionMailer::Base.deliveries array.
23
+ config.action_mailer.delivery_method = :test
24
+
25
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
26
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
27
+ # like if you have constraints or database-specific column types
28
+ # config.active_record.schema_format = :sql
29
+
30
+ config.action_dispatch.show_exceptions = false
31
+
32
+ config.active_support.deprecation = :stderr
33
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,197 @@
1
+ require "omniauth-facebook"
2
+ require "omniauth-openid"
3
+
4
+ # Use this hook to configure devise mailer, warden hooks and so forth. The first
5
+ # four configuration values can also be set straight in your models.
6
+ Devise.setup do |config|
7
+ # ==> Mailer Configuration
8
+ # Configure the e-mail address which will be shown in Devise::Mailer,
9
+ # note that it will be overwritten if you use your own mailer class with default "from" parameter.
10
+ config.mailer_sender = "please-change-me@config-initializers-devise.com"
11
+
12
+ # Configure the class responsible to send e-mails.
13
+ # config.mailer = "Devise::Mailer"
14
+
15
+ # Disable apply schema
16
+ config.apply_schema = false
17
+
18
+ # ==> ORM configuration
19
+ # Load and configure the ORM. Supports :active_record (default) and
20
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
21
+ # available as additional gems.
22
+ require "devise/orm/#{DEVISE_ORM}"
23
+
24
+ # ==> Configuration for any authentication mechanism
25
+ # Configure which keys are used when authenticating a user. By default is
26
+ # just :email. You can configure it to use [:username, :subdomain], so for
27
+ # authenticating a user, both parameters are required. Remember that those
28
+ # parameters are used only when authenticating and not when retrieving from
29
+ # session. If you need permissions, you should implement that in a before filter.
30
+ # You can also supply hash where the value is a boolean expliciting if authentication
31
+ # should be aborted or not if the value is not present. By default is empty.
32
+ # config.authentication_keys = [ :email ]
33
+
34
+ # Configure parameters from the request object used for authentication. Each entry
35
+ # given should be a request method and it will automatically be passed to
36
+ # find_for_authentication method and considered in your model lookup. For instance,
37
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
38
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
39
+ # config.request_keys = []
40
+
41
+ # Configure which authentication keys should be case-insensitive.
42
+ # These keys will be downcased upon creating or modifying a user and when used
43
+ # to authenticate or find a user. Default is :email.
44
+ config.case_insensitive_keys = [ :email ]
45
+
46
+ # Configure which authentication keys should have whitespace stripped.
47
+ # These keys will have whitespace before and after removed upon creating or
48
+ # modifying a user and when used to authenticate or find a user. Default is :email.
49
+ config.strip_whitespace_keys = [ :email ]
50
+
51
+ # Tell if authentication through request.params is enabled. True by default.
52
+ # config.params_authenticatable = true
53
+
54
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
55
+ config.http_authenticatable = true
56
+
57
+ # If http headers should be returned for AJAX requests. True by default.
58
+ # config.http_authenticatable_on_xhr = true
59
+
60
+ # The realm used in Http Basic Authentication. "Application" by default.
61
+ # config.http_authentication_realm = "Application"
62
+
63
+ # ==> Configuration for :database_authenticatable
64
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
65
+ # using other encryptors, it sets how many times you want the password re-encrypted.
66
+ config.stretches = Rails.env.test? ? 1 : 10
67
+
68
+ # ==> Configuration for :confirmable
69
+ # The time you want to give your user to confirm his account. During this time
70
+ # he will be able to access your application without confirming. Default is nil.
71
+ # When confirm_within is zero, the user won't be able to sign in without confirming.
72
+ # You can use this to let your user access some features of your application
73
+ # without confirming the account, but blocking it after a certain period
74
+ # (ie 2 days).
75
+ # config.confirm_within = 2.days
76
+
77
+ # Defines which key will be used when confirming an account
78
+ # config.confirmation_keys = [ :email ]
79
+
80
+ # ==> Configuration for :rememberable
81
+ # The time the user will be remembered without asking for credentials again.
82
+ # config.remember_for = 2.weeks
83
+
84
+ # If true, a valid remember token can be re-used between multiple browsers.
85
+ # config.remember_across_browsers = true
86
+
87
+ # If true, extends the user's remember period when remembered via cookie.
88
+ # config.extend_remember_period = false
89
+
90
+ # If true, uses the password salt as remember token. This should be turned
91
+ # to false if you are not using database authenticatable.
92
+ config.use_salt_as_remember_token = true
93
+
94
+ # ==> Configuration for :validatable
95
+ # Range for password length. Default is 6..128.
96
+ # config.password_length = 6..128
97
+
98
+ # Regex to use to validate the email address
99
+ # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
100
+
101
+ # ==> Configuration for :timeoutable
102
+ # The time you want to timeout the user session without activity. After this
103
+ # time the user will be asked for credentials again. Default is 30 minutes.
104
+ # config.timeout_in = 30.minutes
105
+
106
+ # ==> Configuration for :lockable
107
+ # Defines which strategy will be used to lock an account.
108
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
109
+ # :none = No lock strategy. You should handle locking by yourself.
110
+ # config.lock_strategy = :failed_attempts
111
+
112
+ # Defines which key will be used when locking and unlocking an account
113
+ # config.unlock_keys = [ :email ]
114
+
115
+ # Defines which strategy will be used to unlock an account.
116
+ # :email = Sends an unlock link to the user email
117
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
118
+ # :both = Enables both strategies
119
+ # :none = No unlock strategy. You should handle unlocking by yourself.
120
+ # config.unlock_strategy = :both
121
+
122
+ # Number of authentication tries before locking an account if lock_strategy
123
+ # is failed attempts.
124
+ # config.maximum_attempts = 20
125
+
126
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
127
+ # config.unlock_in = 1.hour
128
+
129
+ # ==> Configuration for :recoverable
130
+ #
131
+ # Defines which key will be used when recovering the password for an account
132
+ # config.reset_password_keys = [ :email ]
133
+
134
+ # Time interval you can reset your password with a reset password key.
135
+ # Don't put a too small interval or your users won't have the time to
136
+ # change their passwords.
137
+ config.reset_password_within = 2.hours
138
+
139
+ # ==> Configuration for :encryptable
140
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
141
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
142
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
143
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
144
+ # REST_AUTH_SITE_KEY to pepper)
145
+ config.encryptor = :sha512
146
+
147
+ # Setup a pepper to generate the encrypted password.
148
+ config.pepper = "d142367154e5beacca404b1a6a4f8bc52c6fdcfa3ccc3cf8eb49f3458a688ee6ac3b9fae488432a3bfca863b8a90008368a9f3a3dfbe5a962e64b6ab8f3a3a1a"
149
+
150
+ # ==> Configuration for :token_authenticatable
151
+ # Defines name of the authentication token params key
152
+ # config.token_authentication_key = :auth_token
153
+
154
+ # If true, authentication through token does not store user in session and needs
155
+ # to be supplied on each request. Useful if you are using the token as API token.
156
+ # config.stateless_token = false
157
+
158
+ # ==> Scopes configuration
159
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
160
+ # "users/sessions/new". It's turned off by default because it's slower if you
161
+ # are using only default views.
162
+ # config.scoped_views = false
163
+
164
+ # Configure the default scope given to Warden. By default it's the first
165
+ # devise role declared in your routes (usually :user).
166
+ # config.default_scope = :user
167
+
168
+ # Configure sign_out behavior.
169
+ # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
170
+ # The default is true, which means any logout action will sign out all active scopes.
171
+ # config.sign_out_all_scopes = true
172
+
173
+ # ==> Navigation configuration
174
+ # Lists the formats that should be treated as navigational. Formats like
175
+ # :html, should redirect to the sign in page when the user does not have
176
+ # access, but formats like :xml or :json, should return 401.
177
+ # If you have any extra navigational formats, like :iphone or :mobile, you
178
+ # should add them to the navigational formats lists. Default is [:html]
179
+ # config.navigational_formats = [:html, :iphone]
180
+
181
+ # The default HTTP method used to sign out a resource. Default is :get.
182
+ # config.sign_out_via = :get
183
+
184
+ # ==> OmniAuth
185
+ config.omniauth :facebook, 'APP_ID', 'APP_SECRET', :scope => 'email,offline_access'
186
+ config.omniauth :openid
187
+ config.omniauth :openid, :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'
188
+
189
+ # ==> Warden configuration
190
+ # If you want to use other strategies, that are not supported by Devise, or
191
+ # change the failure app, you can configure them inside the config.warden block.
192
+ #
193
+ # config.warden do |manager|
194
+ # manager.failure_app = AnotherApp
195
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
196
+ # end
197
+ end