loyal_devise 2.1.2

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