devise_invitable 1.1.8 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. data/CHANGELOG +5 -0
  2. data/README.rdoc +39 -12
  3. data/app/controllers/devise/invitations_controller.rb +20 -6
  4. data/app/controllers/devise_invitable/registrations_controller.rb +2 -2
  5. data/app/views/devise/mailer/invitation_instructions.html.erb +1 -1
  6. data/lib/devise_invitable/mailer.rb +3 -7
  7. data/lib/devise_invitable/model.rb +53 -59
  8. data/lib/devise_invitable/parameter_sanitizer.rb +11 -0
  9. data/lib/devise_invitable/rails.rb +1 -0
  10. data/lib/devise_invitable/version.rb +1 -1
  11. data/lib/devise_invitable.rb +1 -0
  12. data/lib/generators/active_record/templates/migration.rb +3 -2
  13. data/test/functional/controller_helpers_test.rb +39 -0
  14. data/test/functional/registrations_controller_test.rb +59 -0
  15. data/test/generators/views_generator_test.rb +40 -0
  16. data/test/generators_test.rb +34 -0
  17. data/test/integration/invitation_remove_test.rb +29 -0
  18. data/test/integration/invitation_test.rb +222 -0
  19. data/test/integration_tests_helper.rb +48 -0
  20. data/test/mailers/invitation_mail_test.rb +69 -0
  21. data/test/model_tests_helper.rb +33 -0
  22. data/test/models/invitable_test.rb +558 -0
  23. data/test/models_test.rb +74 -0
  24. data/test/orm/active_record.rb +4 -0
  25. data/test/orm/mongoid.rb +20 -0
  26. data/test/rails_app/Rakefile +7 -0
  27. data/test/rails_app/app/controllers/admins_controller.rb +6 -0
  28. data/test/rails_app/app/controllers/application_controller.rb +10 -0
  29. data/test/rails_app/app/controllers/free_invitations_controller.rb +6 -0
  30. data/test/rails_app/app/controllers/home_controller.rb +4 -0
  31. data/test/rails_app/app/controllers/users_controller.rb +12 -0
  32. data/test/rails_app/app/helpers/application_helper.rb +2 -0
  33. data/test/rails_app/app/models/admin.rb +23 -0
  34. data/test/rails_app/app/models/octopussy.rb +15 -0
  35. data/test/rails_app/app/models/user.rb +56 -0
  36. data/test/rails_app/app/views/admins/new.html.erb +12 -0
  37. data/test/rails_app/app/views/free_invitations/new.html.erb +12 -0
  38. data/test/rails_app/app/views/home/index.html.erb +0 -0
  39. data/test/rails_app/app/views/layouts/application.html.erb +16 -0
  40. data/test/rails_app/app/views/users/invitations/new.html.erb +15 -0
  41. data/test/rails_app/config/application.rb +24 -0
  42. data/test/rails_app/config/boot.rb +11 -0
  43. data/test/rails_app/config/database.yml +22 -0
  44. data/test/rails_app/config/environment.rb +5 -0
  45. data/test/rails_app/config/environments/development.rb +25 -0
  46. data/test/rails_app/config/environments/production.rb +49 -0
  47. data/test/rails_app/config/environments/test.rb +33 -0
  48. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  49. data/test/rails_app/config/initializers/devise.rb +213 -0
  50. data/test/rails_app/config/initializers/inflections.rb +10 -0
  51. data/test/rails_app/config/initializers/mime_types.rb +5 -0
  52. data/test/rails_app/config/initializers/secret_token.rb +7 -0
  53. data/test/rails_app/config/initializers/session_store.rb +8 -0
  54. data/test/rails_app/config/initializers/wrap_parameters.rb +14 -0
  55. data/test/rails_app/config/locales/devise.en.yml +57 -0
  56. data/test/rails_app/config/locales/en.yml +14 -0
  57. data/test/rails_app/config/routes.rb +9 -0
  58. data/test/rails_app/config.ru +4 -0
  59. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +39 -0
  60. data/test/rails_app/mongoid.yml +10 -0
  61. data/test/rails_app/script/rails +6 -0
  62. data/test/routes_test.rb +20 -0
  63. data/test/test_helper.rb +24 -0
  64. metadata +135 -47
  65. data/app/controllers/devise_invitable/registrations_controller.rb~ +0 -15
  66. data/lib/devise_invitable/controllers/helpers.rb~ +0 -21
  67. data/lib/devise_invitable/controllers/registrations.rb~ +0 -21
  68. data/lib/devise_invitable/model.rb~ +0 -224
  69. data/lib/devise_invitable/rails.rb~ +0 -21
  70. data/lib/devise_invitable.rb~ +0 -65
@@ -0,0 +1,4 @@
1
+ class HomeController < ApplicationController
2
+ def index
3
+ end
4
+ end
@@ -0,0 +1,12 @@
1
+ class UsersController < ApplicationController
2
+ before_filter :authenticate_user!
3
+
4
+ def index
5
+ user_session[:cart] = "Cart"
6
+ end
7
+
8
+ def expire
9
+ user_session['last_request_at'] = 31.minutes.ago.utc
10
+ render :text => 'User will be expired on next request'
11
+ end
12
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,23 @@
1
+ class Admin < PARENT_MODEL_CLASS
2
+ if DEVISE_ORM == :mongoid
3
+ include Mongoid::Document
4
+ include Mongoid::Attributes::Dynamic if defined?(Mongoid::Attributes::Dynamic)
5
+ ## Database authenticatable
6
+ field :email, :type => String, :default => ""
7
+ field :encrypted_password, :type => String, :default => ""
8
+ validates_presence_of :email
9
+ validates_presence_of :encrypted_password, :if => :password_required?
10
+
11
+ ## Confirmable
12
+ field :confirmation_token, :type => String
13
+ field :confirmed_at, :type => Time
14
+ field :confirmation_sent_at, :type => Time
15
+ field :unconfirmed_email, :type => String # Only if using reconfirmable
16
+
17
+ end
18
+
19
+
20
+
21
+ devise :database_authenticatable, :validatable, :registerable
22
+ include DeviseInvitable::Inviter
23
+ end
@@ -0,0 +1,15 @@
1
+ # This model is here for the generators' specs
2
+ class Octopussy < PARENT_MODEL_CLASS
3
+ if DEVISE_ORM == :mongoid
4
+ include Mongoid::Document
5
+ include Mongoid::Attributes::Dynamic if defined?(Mongoid::Attributes::Dynamic)
6
+
7
+ ## Database authenticatable
8
+ field :email, :type => String, :default => ""
9
+ field :encrypted_password, :type => String, :default => ""
10
+ validates_presence_of :email
11
+ validates_presence_of :encrypted_password, :if => :password_required?
12
+
13
+ end
14
+ devise :database_authenticatable, :validatable, :confirmable
15
+ end
@@ -0,0 +1,56 @@
1
+ class User < PARENT_MODEL_CLASS
2
+ if DEVISE_ORM == :mongoid
3
+ include Mongoid::Document
4
+ include Mongoid::Attributes::Dynamic if defined?(Mongoid::Attributes::Dynamic)
5
+
6
+ ## Database authenticatable
7
+ field :email, :type => String, :default => ""
8
+ field :encrypted_password, :type => String, :default => ""
9
+
10
+ ## Recoverable
11
+ field :reset_password_token, :type => String
12
+ field :reset_password_sent_at, :type => Time
13
+
14
+ ## Confirmable
15
+ field :confirmation_token, :type => String
16
+ field :confirmed_at, :type => Time
17
+ field :confirmation_sent_at, :type => Time
18
+ field :unconfirmed_email, :type => String # Only if using reconfirmable
19
+
20
+ ## Invitable
21
+ field :invitation_token, :type => String
22
+ field :invitation_created_at, :type => Time
23
+ field :invitation_sent_at, :type => Time
24
+ field :invitation_accepted_at, :type => Time
25
+ field :invitation_limit, :type => Integer
26
+ field :invited_by_id, :type => Integer
27
+ field :invited_by_type, :type => String
28
+
29
+
30
+ field :username
31
+ validates_presence_of :email
32
+ validates_presence_of :encrypted_password, :if => :password_required?
33
+ end
34
+
35
+ devise :database_authenticatable, :registerable, :validatable, :confirmable, :invitable, :recoverable
36
+
37
+ attr_accessor :callback_works, :bio, :token
38
+ validates :username, :length => { :maximum => 20 }
39
+
40
+ attr_accessor :testing_accepting_or_not_invited
41
+ validates :username, :presence => true, :if => :testing_accepting_or_not_invited_validator?
42
+ validates :bio, :presence => true, :if => :invitation_accepted?
43
+
44
+ def testing_accepting_or_not_invited_validator?
45
+ testing_accepting_or_not_invited && accepting_or_not_invited?
46
+ end
47
+
48
+ after_invitation_accepted do |object|
49
+ object.callback_works = true
50
+ end
51
+
52
+ def send_devise_notification(method, raw, *args)
53
+ Thread.current[:token] = raw
54
+ super
55
+ end
56
+ end
@@ -0,0 +1,12 @@
1
+ <h2>Send invitation</h2>
2
+
3
+ <%= form_for resource, :as => resource_name, :url => admin_path do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <p><%= f.label :email %><br />
7
+ <%= f.text_field :email %></p>
8
+
9
+ <p><%= f.submit "Send an invitation" %></p>
10
+ <% end %>
11
+
12
+ <%= link_to "Home", after_sign_in_path_for(resource_name) %><br />
@@ -0,0 +1,12 @@
1
+ <h2>Send invitation</h2>
2
+
3
+ <%= form_for resource, :as => resource_name, :url => free_invitation_path do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <p><%= f.label :email %><br />
7
+ <%= f.text_field :email %></p>
8
+
9
+ <p><%= f.submit "Send an invitation" %></p>
10
+ <% end %>
11
+
12
+ <%= link_to "Home", after_sign_in_path_for(resource_name) %><br />
File without changes
@@ -0,0 +1,16 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>RailsApp</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= content_tag :p, flash[:notice], :id => 'notice' unless flash[:notice].blank? %>
12
+ <%= content_tag :p, flash[:alert], :id => 'alert' unless flash[:alert].blank? %>
13
+ <%= yield %>
14
+
15
+ </body>
16
+ </html>
@@ -0,0 +1,15 @@
1
+ <h2>Send an invitation</h2>
2
+
3
+ <%= form_for resource, :as => resource_name, :url => invitation_path(resource_name), :html => { :method => :post } do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <p><%= f.label :username %></p>
7
+ <p><%= f.text_field :username %></p>
8
+
9
+ <p><%= f.label :email %></p>
10
+ <p><%= f.text_field :email %></p>
11
+
12
+ <p><%= f.submit "Send an invitation" %></p>
13
+ <% end %>
14
+
15
+ <%= link_to "Home", after_sign_in_path_for(resource_name) %><br />
@@ -0,0 +1,24 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "action_controller/railtie"
4
+ require "action_mailer/railtie"
5
+ require "rails/test_unit/railtie"
6
+
7
+ Bundler.require(:default, DEVISE_ORM) if defined?(Bundler)
8
+
9
+ begin
10
+ require "#{DEVISE_ORM}/railtie"
11
+ rescue LoadError
12
+ end
13
+ PARENT_MODEL_CLASS = DEVISE_ORM == :active_record ? ActiveRecord::Base : Object
14
+ Mongoid.load!(File.expand_path('../../mongoid.yml', __FILE__)) if DEVISE_ORM == :mongoid && Mongoid::VERSION < '3.0.0'
15
+
16
+ require "devise"
17
+ require "devise_invitable"
18
+
19
+ module RailsApp
20
+ class Application < Rails::Application
21
+ config.filter_parameters << :password
22
+ config.action_mailer.default_url_options = { :host => "localhost:3000" }
23
+ end
24
+ end
@@ -0,0 +1,11 @@
1
+ unless defined?(DEVISE_ORM)
2
+ DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
3
+ end
4
+
5
+ begin
6
+ require File.expand_path("../../../../.bundle/environment", __FILE__)
7
+ rescue LoadError
8
+ require 'rubygems'
9
+ require 'bundler'
10
+ Bundler.setup :default, :test, DEVISE_ORM
11
+ end
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: ":memory:"
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
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -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,25 @@
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
+
19
+ # Print deprecation notices to the Rails logger
20
+ config.active_support.deprecation = :log
21
+
22
+ # Only use best-standards-support built into browsers
23
+ config.action_dispatch.best_standards_support = :builtin
24
+ end
25
+
@@ -0,0 +1,49 @@
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
+ # Specifies the header that your server uses for sending files
13
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
+
15
+ # For nginx:
16
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
+
18
+ # If you have no front-end server that supports something like X-Sendfile,
19
+ # just comment this out and Rails will serve the files
20
+
21
+ # See everything in the log (default is :info)
22
+ # config.log_level = :debug
23
+
24
+ # Use a different logger for distributed setups
25
+ # config.logger = SyslogLogger.new
26
+
27
+ # Use a different cache store in production
28
+ # config.cache_store = :mem_cache_store
29
+
30
+ # Disable Rails's static asset server
31
+ # In production, Apache or nginx will already do this
32
+ config.serve_static_assets = false
33
+
34
+ # Enable serving of images, stylesheets, and javascripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+ # Disable delivery errors, bad email addresses will be ignored
38
+ # config.action_mailer.raise_delivery_errors = false
39
+
40
+ # Enable threaded mode
41
+ # config.threadsafe!
42
+
43
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
+ # the I18n.default_locale when a translation can not be found)
45
+ config.i18n.fallbacks = true
46
+
47
+ # Send deprecation notices to registered listeners
48
+ config.active_support.deprecation = :notify
49
+ 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
+ config.eager_load = false
10
+
11
+ # Show full error reports and disable caching
12
+ config.consider_all_requests_local = true
13
+ config.action_controller.perform_caching = false
14
+
15
+ # Raise exceptions instead of rendering exception templates
16
+ config.action_dispatch.show_exceptions = 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
+ # Print deprecation notices to the stderr
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,213 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # The secret key used by Devise. Devise uses this key to generate
5
+ # random tokens. Changing this key will render invalid all existing
6
+ # confirmation, reset password and unlock tokens in the database.
7
+ config.secret_key = 'e5151770530bba4c845256482be72bf598f723bebc057f4b8c15a7e63d7ffb61e7b8a0615e92a78127498ac509c43589b39bd13df397a4a2a7b3796c836e6ef8'
8
+
9
+ # ==> Mailer Configuration
10
+ # Configure the e-mail address which will be shown in Devise::Mailer,
11
+ # note that it will be overwritten if you use your own mailer class
12
+ # with default "from" parameter.
13
+ config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
14
+
15
+ # Configure the class responsible to send e-mails.
16
+ # config.mailer = "Devise::Mailer"
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. The 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 a hash where the value is a boolean determining whether
31
+ # or not authentication should be aborted when the value is not present.
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 the
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
+ # It can be set to an array that will enable params authentication only for the
53
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
54
+ # enable it only for database (email + password) authentication.
55
+ # config.params_authenticatable = true
56
+
57
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
58
+ # It can be set to an array that will enable http authentication only for the
59
+ # given strategies, for example, `config.http_authenticatable = [:token]` will
60
+ # enable it only for token authentication.
61
+ # config.http_authenticatable = false
62
+
63
+ # If http headers should be returned for AJAX requests. True by default.
64
+ # config.http_authenticatable_on_xhr = true
65
+
66
+ # The realm used in Http Basic Authentication. "Application" by default.
67
+ # config.http_authentication_realm = "Application"
68
+
69
+ # It will change confirmation, password recovery and other workflows
70
+ # to behave the same regardless if the e-mail provided was right or wrong.
71
+ # Does not affect registerable.
72
+ # config.paranoid = true
73
+
74
+ # By default Devise will store the user in session. You can skip storage for
75
+ # :http_auth and :token_auth by adding those symbols to the array below.
76
+ # Notice that if you are skipping storage for all authentication paths, you
77
+ # may want to disable generating routes to Devise's sessions controller by
78
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
79
+ config.skip_session_storage = [:http_auth]
80
+
81
+ # ==> Configuration for :database_authenticatable
82
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
83
+ # using other encryptors, it sets how many times you want the password re-encrypted.
84
+ #
85
+ # Limiting the stretches to just one in testing will increase the performance of
86
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
87
+ # a value less than 10 in other environments.
88
+ config.stretches = Rails.env.test? ? 1 : 10
89
+
90
+ # Setup a pepper to generate the encrypted password.
91
+ # config.pepper = "e31589192aeea8807cb7d8686b0f8484d6cbfaaa65443d45144519ed1d4ffbc6ccb73b21a69ece276d94f2cac95d83990d824f36f301d6f585ededd1bf90d67d"
92
+
93
+ # ==> Configuration for :confirmable
94
+ # A period that the user is allowed to access the website even without
95
+ # confirming his account. For instance, if set to 2.days, the user will be
96
+ # able to access the website for two days without confirming his account,
97
+ # access will be blocked just in the third day. Default is 0.days, meaning
98
+ # the user cannot access the website without confirming his account.
99
+ # config.allow_unconfirmed_access_for = 2.days
100
+
101
+ # If true, requires any email changes to be confirmed (exctly the same way as
102
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
103
+ # db field (see migrations). Until confirmed new email is stored in
104
+ # unconfirmed email column, and copied to email column on successful confirmation.
105
+ config.reconfirmable = true
106
+
107
+ # Defines which key will be used when confirming an account
108
+ # config.confirmation_keys = [ :email ]
109
+
110
+ # ==> Configuration for :rememberable
111
+ # The time the user will be remembered without asking for credentials again.
112
+ # config.remember_for = 2.weeks
113
+
114
+ # If true, extends the user's remember period when remembered via cookie.
115
+ # config.extend_remember_period = false
116
+
117
+ # :secure => true in order to force SSL only cookies.
118
+ # config.cookie_options = {}
119
+
120
+ # ==> Configuration for :validatable
121
+ # Range for password length. Default is 6..128.
122
+ # config.password_length = 6..128
123
+
124
+ # Email regex used to validate email formats. It simply asserts that
125
+ # an one (and only one) @ exists in the given string. This is mainly
126
+ # to give user feedback and not to assert the e-mail validity.
127
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
128
+
129
+ # ==> Configuration for :timeoutable
130
+ # The time you want to timeout the user session without activity. After this
131
+ # time the user will be asked for credentials again. Default is 30 minutes.
132
+ # config.timeout_in = 30.minutes
133
+
134
+ # ==> Configuration for :lockable
135
+ # Defines which strategy will be used to lock an account.
136
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
137
+ # :none = No lock strategy. You should handle locking by yourself.
138
+ # config.lock_strategy = :failed_attempts
139
+
140
+ # Defines which key will be used when locking and unlocking an account
141
+ # config.unlock_keys = [ :email ]
142
+
143
+ # Defines which strategy will be used to unlock an account.
144
+ # :email = Sends an unlock link to the user email
145
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
146
+ # :both = Enables both strategies
147
+ # :none = No unlock strategy. You should handle unlocking by yourself.
148
+ # config.unlock_strategy = :both
149
+
150
+ # Number of authentication tries before locking an account if lock_strategy
151
+ # is failed attempts.
152
+ # config.maximum_attempts = 20
153
+
154
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
155
+ # config.unlock_in = 1.hour
156
+
157
+ # ==> Configuration for :recoverable
158
+ #
159
+ # Defines which key will be used when recovering the password for an account
160
+ # config.reset_password_keys = [ :email ]
161
+
162
+ # Time interval you can reset your password with a reset password key.
163
+ # Don't put a too small interval or your users won't have the time to
164
+ # change their passwords.
165
+ config.reset_password_within = 6.hours
166
+
167
+ # ==> Configuration for :token_authenticatable
168
+ # Defines name of the authentication token params key
169
+ # config.token_authentication_key = :auth_token
170
+
171
+ # ==> Scopes configuration
172
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
173
+ # "users/sessions/new". It's turned off by default because it's slower if you
174
+ # are using only default views.
175
+ # config.scoped_views = false
176
+
177
+ # Configure the default scope given to Warden. By default it's the first
178
+ # devise role declared in your routes (usually :user).
179
+ # config.default_scope = :user
180
+
181
+ # Configure sign_out behavior.
182
+ # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
183
+ # The default is true, which means any logout action will sign out all active scopes.
184
+ # config.sign_out_all_scopes = true
185
+
186
+ # ==> Navigation configuration
187
+ # Lists the formats that should be treated as navigational. Formats like
188
+ # :html, should redirect to the sign in page when the user does not have
189
+ # access, but formats like :xml or :json, should return 401.
190
+ #
191
+ # If you have any extra navigational formats, like :iphone or :mobile, you
192
+ # should add them to the navigational formats lists.
193
+ #
194
+ # The "*/*" below is required to match Internet Explorer requests.
195
+ # config.navigational_formats = ["*/*", :html]
196
+
197
+ # The default HTTP method used to sign out a resource. Default is :delete.
198
+ config.sign_out_via = :delete
199
+
200
+ # ==> OmniAuth
201
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
202
+ # up on your models and hooks.
203
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
204
+
205
+ # ==> Warden configuration
206
+ # If you want to use other strategies, that are not supported by Devise, or
207
+ # change the failure app, you can configure them inside the config.warden block.
208
+ #
209
+ # config.warden do |manager|
210
+ # manager.intercept_401 = false
211
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
212
+ # end
213
+ end
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ RailsApp::Application.config.secret_token = 'e997edf9d7eba5cf89a76a046fa53f5d66261d22cfcf29e3f538c75ad2d175b106bd5d099f44f6ce34ad3b3162d71cfaa37d2d4f4b38645288331427b4c2a607'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ RailsApp::Application.config.session_store :cookie_store, :key => '_test_app_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rake db:sessions:create")
8
+ # RailsApp::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters(:format => [:json])
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end