devise_invitable 0.3.4 → 0.6.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 (63) hide show
  1. data/README.rdoc +124 -43
  2. data/app/controllers/devise/invitations_controller.rb +36 -9
  3. data/app/views/devise/invitations/new.html.erb +1 -1
  4. data/config/locales/en.yml +5 -3
  5. data/lib/devise_invitable/controllers/helpers.rb +1 -6
  6. data/lib/devise_invitable/inviter.rb +39 -0
  7. data/lib/devise_invitable/mailer.rb +4 -3
  8. data/lib/devise_invitable/model.rb +99 -41
  9. data/lib/devise_invitable/rails.rb +5 -2
  10. data/lib/devise_invitable/routes.rb +8 -5
  11. data/lib/devise_invitable/schema.rb +29 -2
  12. data/lib/devise_invitable/version.rb +3 -0
  13. data/lib/devise_invitable.rb +48 -6
  14. data/lib/generators/active_record/templates/migration.rb +15 -7
  15. data/lib/generators/devise_invitable/devise_invitable_generator.rb +4 -0
  16. data/lib/generators/devise_invitable/install_generator.rb +21 -2
  17. data/lib/generators/devise_invitable/views_generator.rb +11 -2
  18. data/lib/generators/mongoid/devise_invitable_generator.rb +8 -0
  19. metadata +63 -143
  20. data/.document +0 -5
  21. data/.gitignore +0 -22
  22. data/Gemfile +0 -3
  23. data/Gemfile.lock +0 -108
  24. data/Rakefile +0 -55
  25. data/VERSION +0 -1
  26. data/devise_invitable.gemspec +0 -146
  27. data/test/generators_test.rb +0 -45
  28. data/test/integration/invitable_test.rb +0 -109
  29. data/test/integration_tests_helper.rb +0 -58
  30. data/test/mailers/invitation_test.rb +0 -62
  31. data/test/model_tests_helper.rb +0 -41
  32. data/test/models/invitable_test.rb +0 -188
  33. data/test/models_test.rb +0 -31
  34. data/test/rails_app/app/controllers/admins_controller.rb +0 -6
  35. data/test/rails_app/app/controllers/application_controller.rb +0 -3
  36. data/test/rails_app/app/controllers/home_controller.rb +0 -4
  37. data/test/rails_app/app/controllers/users_controller.rb +0 -12
  38. data/test/rails_app/app/helpers/application_helper.rb +0 -2
  39. data/test/rails_app/app/models/octopussy.rb +0 -11
  40. data/test/rails_app/app/models/user.rb +0 -4
  41. data/test/rails_app/app/views/home/index.html.erb +0 -0
  42. data/test/rails_app/app/views/layouts/application.html.erb +0 -15
  43. data/test/rails_app/app/views/users/invitations/new.html.erb +0 -15
  44. data/test/rails_app/config/application.rb +0 -46
  45. data/test/rails_app/config/boot.rb +0 -13
  46. data/test/rails_app/config/database.yml +0 -22
  47. data/test/rails_app/config/environment.rb +0 -5
  48. data/test/rails_app/config/environments/development.rb +0 -26
  49. data/test/rails_app/config/environments/production.rb +0 -49
  50. data/test/rails_app/config/environments/test.rb +0 -35
  51. data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -7
  52. data/test/rails_app/config/initializers/devise.rb +0 -144
  53. data/test/rails_app/config/initializers/inflections.rb +0 -10
  54. data/test/rails_app/config/initializers/mime_types.rb +0 -5
  55. data/test/rails_app/config/initializers/secret_token.rb +0 -7
  56. data/test/rails_app/config/initializers/session_store.rb +0 -8
  57. data/test/rails_app/config/locales/en.yml +0 -5
  58. data/test/rails_app/config/routes.rb +0 -4
  59. data/test/rails_app/config.ru +0 -4
  60. data/test/rails_app/script/rails +0 -6
  61. data/test/routes_test.rb +0 -20
  62. data/test/test_helper.rb +0 -30
  63. /data/app/views/devise/mailer/{invitation.html.erb → invitation_instructions.html.erb} +0 -0
@@ -1,188 +0,0 @@
1
- require 'test/test_helper'
2
- require 'test/model_tests_helper'
3
-
4
- class InvitableTest < ActiveSupport::TestCase
5
-
6
- def setup
7
- setup_mailer
8
- end
9
-
10
- test 'should not generate invitation token after creating a record' do
11
- assert_nil new_user.invitation_token
12
- end
13
-
14
- test 'should regenerate invitation token each time' do
15
- user = new_user
16
- 3.times do
17
- token = user.invitation_token
18
- user.invite!
19
- assert_not_equal token, user.invitation_token
20
- end
21
- end
22
-
23
- test 'should test invitation sent at with invite_for configuration value' do
24
- user = create_user_with_invitation('token')
25
-
26
- User.stubs(:invite_for).returns(nil)
27
- user.invitation_sent_at = Time.now.utc
28
- assert user.valid_invitation?
29
-
30
- User.stubs(:invite_for).returns(nil)
31
- user.invitation_sent_at = 1.year.ago
32
- assert user.valid_invitation?
33
-
34
- User.stubs(:invite_for).returns(0)
35
- user.invitation_sent_at = Time.now.utc
36
- assert user.valid_invitation?
37
-
38
- User.stubs(:invite_for).returns(0)
39
- user.invitation_sent_at = 1.day.ago
40
- assert user.valid_invitation?
41
-
42
- User.stubs(:invite_for).returns(1.day)
43
- user.invitation_sent_at = Time.now.utc
44
- assert user.valid_invitation?
45
-
46
- User.stubs(:invite_for).returns(1.day)
47
- user.invitation_sent_at = 1.day.ago
48
- assert !user.valid_invitation?
49
- end
50
-
51
- test 'should never generate the same invitation token for different users' do
52
- invitation_tokens = []
53
- 3.times do
54
- user = new_user
55
- user.invite!
56
- token = user.invitation_token
57
- assert !invitation_tokens.include?(token)
58
- invitation_tokens << token
59
- end
60
- end
61
-
62
- test 'should set password and password confirmation from params' do
63
- create_user_with_invitation('valid_token', :password => nil, :password_confirmation => nil)
64
- user = User.accept_invitation!(:invitation_token => 'valid_token', :password => '123456789', :password_confirmation => '123456789')
65
- assert user.valid_password?('123456789')
66
- end
67
-
68
- test 'should set password and save the record' do
69
- user = create_user_with_invitation('valid_token', :password => nil, :password_confirmation => nil)
70
- old_encrypted_password = user.encrypted_password
71
- user = User.accept_invitation!(:invitation_token => 'valid_token', :password => '123456789', :password_confirmation => '123456789')
72
- assert_not_equal old_encrypted_password, user.encrypted_password
73
- end
74
-
75
- test 'should clear invitation token while setting the password' do
76
- user = new_user
77
- user.skip_confirmation!
78
- user.update_attribute(:invitation_token, 'valid_token')
79
- assert_present user.invitation_token
80
- assert user.accept_invitation!
81
- assert_nil user.invitation_token
82
- end
83
-
84
- test 'should not clear invitation token if record is invalid' do
85
- user = new_user
86
- user.skip_confirmation!
87
- user.update_attribute(:invitation_token, 'valid_token')
88
- assert_present user.invitation_token
89
- User.any_instance.stubs(:valid?).returns(false)
90
- User.accept_invitation!(:invitation_token => 'valid_token', :password => '123456789', :password_confirmation => '987654321')
91
- user.reload
92
- assert_present user.invitation_token
93
- end
94
-
95
- test 'should reset invitation token and send invitation by email' do
96
- user = new_user
97
- assert_difference('ActionMailer::Base.deliveries.size') do
98
- token = user.invitation_token
99
- user.invite!
100
- assert_not_equal token, user.invitation_token
101
- end
102
- end
103
-
104
- test 'should return a record with invitation token and no errors to send invitation by email' do
105
- invited_user = User.invite!(:email => "valid@email.com")
106
- assert invited_user.errors.blank?
107
- assert_present invited_user.invitation_token
108
- assert_equal 'valid@email.com', invited_user.email
109
- assert invited_user.persisted?
110
- end
111
-
112
- test 'should set all attributes with no errors' do
113
- invited_user = User.invite!(:email => "valid@email.com", :username => 'first name')
114
- assert invited_user.errors.blank?
115
- assert_equal 'first name', invited_user.username
116
- assert invited_user.persisted?
117
- end
118
-
119
- test 'should return a record with errors if user was found by e-mail' do
120
- user = create_user_with_invitation('')
121
- user.update_attribute(:invitation_token, nil)
122
- invited_user = User.invite!(:email => user.email)
123
- assert_equal invited_user, user
124
- assert_equal ['has already been taken'], invited_user.errors[:email]
125
- end
126
-
127
- test 'should return a new record with errors if e-mail is blank' do
128
- invited_user = User.invite!(:email => '')
129
- assert invited_user.new_record?
130
- assert_equal ["can't be blank"], invited_user.errors[:email]
131
- end
132
-
133
- test 'should return a new record with errors if e-mail is invalid' do
134
- invited_user = User.invite!(:email => 'invalid_email')
135
- assert invited_user.new_record?
136
- assert_equal ["is invalid"], invited_user.errors[:email]
137
- end
138
-
139
- test 'should set all attributes with errors if e-mail is invalid' do
140
- invited_user = User.invite!(:email => "invalid_email.com", :username => 'first name')
141
- assert invited_user.new_record?
142
- assert_equal 'first name', invited_user.username
143
- assert invited_user.errors.present?
144
- end
145
-
146
- test 'should find a user to set his password based on invitation_token' do
147
- user = new_user
148
- user.invite!
149
-
150
- invited_user = User.accept_invitation!(:invitation_token => user.invitation_token)
151
- assert_equal invited_user, user
152
- end
153
-
154
- test 'should return a new record with errors if no invitation_token is found' do
155
- invited_user = User.accept_invitation!(:invitation_token => 'invalid_token')
156
- assert invited_user.new_record?
157
- assert_equal ['is invalid'], invited_user.errors[:invitation_token]
158
- end
159
-
160
- test 'should return a new record with errors if invitation_token is blank' do
161
- invited_user = User.accept_invitation!(:invitation_token => '')
162
- assert invited_user.new_record?
163
- assert_equal ["can't be blank"], invited_user.errors[:invitation_token]
164
- end
165
-
166
- test 'should return record with errors if invitation_token has expired' do
167
- user = create_user_with_invitation('valid_token')
168
- user.update_attribute(:invitation_sent_at, 1.day.ago)
169
- User.stubs(:invite_for).returns(10.hours)
170
- invited_user = User.accept_invitation!(:invitation_token => 'valid_token')
171
- assert_equal user, invited_user
172
- assert_equal ["is invalid"], invited_user.errors[:invitation_token]
173
- end
174
-
175
- test 'should set successfully user password given the new password and confirmation' do
176
- user = new_user(:password => nil, :password_confirmation => nil)
177
- user.invite!
178
-
179
- invited_user = User.accept_invitation!(
180
- :invitation_token => user.invitation_token,
181
- :password => 'new_password',
182
- :password_confirmation => 'new_password'
183
- )
184
- user.reload
185
-
186
- assert user.valid_password?('new_password')
187
- end
188
- end
data/test/models_test.rb DELETED
@@ -1,31 +0,0 @@
1
- require 'test/test_helper'
2
-
3
- class Invitable < User
4
- devise :database_authenticatable, :invitable, :invite_for => 5.days
5
- end
6
-
7
- class ActiveRecordTest < ActiveSupport::TestCase
8
- def include_module?(klass, mod)
9
- klass.devise_modules.include?(mod) &&
10
- klass.included_modules.include?(Devise::Models::const_get(mod.to_s.classify))
11
- end
12
-
13
- def assert_include_modules(klass, *modules)
14
- modules.each do |mod|
15
- assert include_module?(klass, mod), "#{klass} not include #{mod}"
16
- end
17
- end
18
-
19
- test 'add invitable module only' do
20
- assert_include_modules Invitable, :invitable
21
- end
22
-
23
- test 'set a default value for invite_for' do
24
- assert_equal 5.days, Invitable.invite_for
25
- end
26
-
27
- test 'invitable attributes' do
28
- assert_not_nil Invitable.columns_hash['invitation_token']
29
- assert_not_nil Invitable.columns_hash['invitation_sent_at']
30
- end
31
- end
@@ -1,6 +0,0 @@
1
- class AdminsController < ApplicationController
2
- before_filter :authenticate_admin!
3
-
4
- def index
5
- end
6
- end
@@ -1,3 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- protect_from_forgery
3
- end
@@ -1,4 +0,0 @@
1
- class HomeController < ApplicationController
2
- def index
3
- end
4
- end
@@ -1,12 +0,0 @@
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
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,11 +0,0 @@
1
- # This model is here for the generators' specs
2
- if DEVISE_ORM == :active_record
3
- class Octopussy < ActiveRecord::Base
4
- devise :database_authenticatable, :validatable, :confirmable
5
- end
6
- elsif DEVISE_ORM == :mongoid
7
- class Octopussy
8
- include Mongoid::Document
9
- devise :database_authenticatable, :validatable, :confirmable
10
- end
11
- end
@@ -1,4 +0,0 @@
1
- class User < ActiveRecord::Base
2
- devise :database_authenticatable, :confirmable, :invitable, :validatable
3
- attr_accessible :username, :email, :password, :password_confirmation
4
- end
File without changes
@@ -1,15 +0,0 @@
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
- <%= yield %>
13
-
14
- </body>
15
- </html>
@@ -1,15 +0,0 @@
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 />
@@ -1,46 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
- DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym unless defined? DEVISE_ORM
3
-
4
- require 'rails/all'
5
-
6
- # If you have a Gemfile, require the gems listed there, including any gems
7
- # you've limited to :test, :development, or :production.
8
- Bundler.require(:default, Rails.env) if defined?(Bundler)
9
-
10
- require 'devise'
11
- require 'devise_invitable'
12
-
13
- module RailsApp
14
- class Application < Rails::Application
15
- # Settings in config/environments/* take precedence over those specified here.
16
- # Application configuration should go into files in config/initializers
17
- # -- all .rb files in that directory are automatically loaded.
18
-
19
- # Custom directories with classes and modules you want to be autoloadable.
20
- # config.autoload_paths += %W(#{config.root}/extras)
21
-
22
- # Only load the plugins named here, in the order given (default is alphabetical).
23
- # :all can be used as a placeholder for all plugins not explicitly named.
24
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
25
-
26
- # Activate observers that should always be running.
27
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
28
-
29
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
30
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
31
- # config.time_zone = 'Central Time (US & Canada)'
32
-
33
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
34
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
35
- # config.i18n.default_locale = :de
36
-
37
- # JavaScript files you want as :defaults (application.js is always included).
38
- # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
39
-
40
- # Configure the default encoding used in templates for Ruby 1.9.
41
- config.encoding = "utf-8"
42
-
43
- # Configure sensitive parameters which will be filtered from the log file.
44
- config.filter_parameters += [:password]
45
- end
46
- end
@@ -1,13 +0,0 @@
1
- require 'rubygems'
2
-
3
- # Set up gems listed in the Gemfile.
4
- gemfile = File.expand_path('../../Gemfile', __FILE__)
5
- begin
6
- ENV['BUNDLE_GEMFILE'] = gemfile
7
- require 'bundler'
8
- Bundler.setup
9
- rescue Bundler::GemNotFound => e
10
- STDERR.puts e.message
11
- STDERR.puts "Try running `bundle install`."
12
- exit!
13
- end if File.exist?(gemfile)
@@ -1,22 +0,0 @@
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
@@ -1,5 +0,0 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the rails application
5
- RailsApp::Application.initialize!
@@ -1,26 +0,0 @@
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_view.debug_rjs = 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
-
20
- # Print deprecation notices to the Rails logger
21
- config.active_support.deprecation = :log
22
-
23
- # Only use best-standards-support built into browsers
24
- config.action_dispatch.best_standards_support = :builtin
25
- end
26
-
@@ -1,49 +0,0 @@
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
@@ -1,35 +0,0 @@
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
- # Raise exceptions instead of rendering exception templates
18
- config.action_dispatch.show_exceptions = false
19
-
20
- # Disable request forgery protection in test environment
21
- config.action_controller.allow_forgery_protection = false
22
-
23
- # Tell Action Mailer not to deliver emails to the real world.
24
- # The :test delivery method accumulates sent emails in the
25
- # ActionMailer::Base.deliveries array.
26
- config.action_mailer.delivery_method = :test
27
-
28
- # Use SQL instead of Active Record's schema dumper when creating the test database.
29
- # This is necessary if your schema can't be completely dumped by the schema dumper,
30
- # like if you have constraints or database-specific column types
31
- # config.active_record.schema_format = :sql
32
-
33
- # Print deprecation notices to the stderr
34
- config.active_support.deprecation = :stderr
35
- end
@@ -1,7 +0,0 @@
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!
@@ -1,144 +0,0 @@
1
- # Use this hook to configure devise mailer, warden hooks and so forth. The first
2
- # four configuration values can also be set straight in your models.
3
- Devise.setup do |config|
4
- # ==> Mailer Configuration
5
- # Configure the e-mail address which will be shown in DeviseMailer.
6
- config.mailer_sender = "please-change-me@config-initializers-devise.com"
7
-
8
- # Configure the class responsible to send e-mails.
9
- # config.mailer = "Devise::Mailer"
10
-
11
- # ==> ORM configuration
12
- # Load and configure the ORM. Supports :active_record (default) and
13
- # :mongoid (bson_ext recommended) by default. Other ORMs may be
14
- # available as additional gems.
15
- require 'devise/orm/active_record'
16
-
17
- # ==> Configuration for any authentication mechanism
18
- # Configure which keys are used when authenticating an user. By default is
19
- # just :email. You can configure it to use [:username, :subdomain], so for
20
- # authenticating an user, both parameters are required. Remember that those
21
- # parameters are used only when authenticating and not when retrieving from
22
- # session. If you need permissions, you should implement that in a before filter.
23
- # config.authentication_keys = [ :email ]
24
-
25
- # Tell if authentication through request.params is enabled. True by default.
26
- # config.params_authenticatable = true
27
-
28
- # Tell if authentication through HTTP Basic Auth is enabled. True by default.
29
- # config.http_authenticatable = true
30
-
31
- # Set this to true to use Basic Auth for AJAX requests. True by default.
32
- # config.http_authenticatable_on_xhr = true
33
-
34
- # The realm used in Http Basic Authentication
35
- # config.http_authentication_realm = "Application"
36
-
37
- # ==> Configuration for :database_authenticatable
38
- # For bcrypt, this is the cost for hashing the password and defaults to 10. If
39
- # using other encryptors, it sets how many times you want the password re-encrypted.
40
- config.stretches = 10
41
-
42
- # Define which will be the encryption algorithm. Devise also supports encryptors
43
- # from others authentication tools as :clearance_sha1, :authlogic_sha512 (then
44
- # you should set stretches above to 20 for default behavior) and :restful_authentication_sha1
45
- # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
46
- config.encryptor = :sha1
47
-
48
- # Setup a pepper to generate the encrypted password.
49
- config.pepper = "c9ed39f2a5faea59e2f9634cd5466703ead30a1fe25ab08cad00fe4d41d23467401fd731eaca1b1326d97b3065217daa81a18368ecc435978e6e868442b753ac"
50
-
51
- # ==> Configuration for :invitable
52
- # Time interval where the invitation token is valid.
53
- # If invite_for is 0 or nil, the invitation will never expire.
54
- # Default: 0
55
- # config.invite_for = 2.weeks
56
-
57
- # ==> Configuration for :confirmable
58
- # The time you want to give your user to confirm his account. During this time
59
- # he will be able to access your application without confirming. Default is nil.
60
- # When confirm_within is zero, the user won't be able to sign in without confirming.
61
- # You can use this to let your user access some features of your application
62
- # without confirming the account, but blocking it after a certain period
63
- # (ie 2 days).
64
- # config.confirm_within = 2.days
65
-
66
- # ==> Configuration for :rememberable
67
- # The time the user will be remembered without asking for credentials again.
68
- # config.remember_for = 2.weeks
69
-
70
- # If true, a valid remember token can be re-used between multiple browsers.
71
- # config.remember_across_browsers = true
72
-
73
- # If true, extends the user's remember period when remembered via cookie.
74
- # config.extend_remember_period = false
75
-
76
- # ==> Configuration for :validatable
77
- # Range for password length
78
- # config.password_length = 6..20
79
-
80
- # Regex to use to validate the email address
81
- # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
82
-
83
- # ==> Configuration for :timeoutable
84
- # The time you want to timeout the user session without activity. After this
85
- # time the user will be asked for credentials again.
86
- # config.timeout_in = 10.minutes
87
-
88
- # ==> Configuration for :lockable
89
- # Defines which strategy will be used to lock an account.
90
- # :failed_attempts = Locks an account after a number of failed attempts to sign in.
91
- # :none = No lock strategy. You should handle locking by yourself.
92
- # config.lock_strategy = :failed_attempts
93
-
94
- # Defines which strategy will be used to unlock an account.
95
- # :email = Sends an unlock link to the user email
96
- # :time = Re-enables login after a certain amount of time (see :unlock_in below)
97
- # :both = Enables both strategies
98
- # :none = No unlock strategy. You should handle unlocking by yourself.
99
- # config.unlock_strategy = :both
100
-
101
- # Number of authentication tries before locking an account if lock_strategy
102
- # is failed attempts.
103
- # config.maximum_attempts = 20
104
-
105
- # Time interval to unlock the account if :time is enabled as unlock_strategy.
106
- # config.unlock_in = 1.hour
107
-
108
- # ==> Configuration for :token_authenticatable
109
- # Defines name of the authentication token params key
110
- # config.token_authentication_key = :auth_token
111
-
112
- # ==> Scopes configuration
113
- # Turn scoped views on. Before rendering "sessions/new", it will first check for
114
- # "users/sessions/new". It's turned off by default because it's slower if you
115
- # are using only default views.
116
- config.scoped_views = true
117
-
118
- # Configure sign_out behavior.
119
- # By default sign_out is scoped (i.e. /users/sign_out affects only :user scope).
120
- # In case of sign_out_all_scopes set to true any logout action will sign out all active scopes.
121
- # config.sign_out_all_scopes = false
122
-
123
- # ==> Navigation configuration
124
- # Lists the formats that should be treated as navigational. Formats like
125
- # :html, should redirect to the sign in page when the user does not have
126
- # access, but formats like :xml or :json, should return 401.
127
- # If you have any extra navigational formats, like :iphone or :mobile, you
128
- # should add them to the navigational formats lists. Default is [:html]
129
- # config.navigational_formats = [:html, :iphone]
130
-
131
- # ==> Warden configuration
132
- # If you want to use other strategies, that are not (yet) supported by Devise,
133
- # you can configure them inside the config.warden block. The example below
134
- # allows you to setup OAuth, using http://github.com/roman/warden_oauth
135
- #
136
- # config.warden do |manager|
137
- # manager.oauth(:twitter) do |twitter|
138
- # twitter.consumer_secret = <YOUR CONSUMER SECRET>
139
- # twitter.consumer_key = <YOUR CONSUMER KEY>
140
- # twitter.options :site => 'http://twitter.com'
141
- # end
142
- # manager.default_strategies(:scope => :user).unshift :twitter_oauth
143
- # end
144
- end