devise_invitable 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/Gemfile.lock +108 -0
- data/README.rdoc +13 -1
- data/Rakefile +4 -3
- data/VERSION +1 -1
- data/app/controllers/{invitations_controller.rb → devise/invitations_controller.rb} +1 -1
- data/app/views/devise/invitations/edit.html.erb +14 -0
- data/app/views/devise/invitations/new.html.erb +12 -0
- data/app/views/{devise_mailer → devise/mailer}/invitation.html.erb +0 -0
- data/{lib/devise_invitable → config}/locales/en.yml +3 -0
- data/devise_invitable.gemspec +48 -35
- data/lib/devise_invitable.rb +4 -1
- data/lib/devise_invitable/controllers/helpers.rb +3 -2
- data/lib/devise_invitable/controllers/url_helpers.rb +21 -17
- data/lib/devise_invitable/mailer.rb +5 -7
- data/lib/devise_invitable/model.rb +5 -4
- data/lib/devise_invitable/rails.rb +13 -2
- data/lib/devise_invitable/routes.rb +6 -25
- data/lib/devise_invitable/schema.rb +2 -2
- data/test/integration/invitable_test.rb +31 -44
- data/test/integration_tests_helper.rb +22 -3
- data/test/mailers/invitation_test.rb +4 -4
- data/test/model_tests_helper.rb +1 -1
- data/test/models/invitable_test.rb +6 -6
- data/test/models_test.rb +1 -5
- data/test/rails_app/app/controllers/application_controller.rb +1 -8
- data/test/rails_app/app/helpers/application_helper.rb +0 -1
- data/test/rails_app/app/models/user.rb +1 -1
- data/test/rails_app/app/views/layouts/application.html.erb +15 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/config/application.rb +45 -0
- data/test/rails_app/config/boot.rb +13 -110
- data/test/rails_app/config/environment.rb +4 -43
- data/test/rails_app/config/environments/development.rb +22 -13
- data/test/rails_app/config/environments/production.rb +41 -20
- data/test/rails_app/config/environments/test.rb +35 -28
- data/test/rails_app/config/initializers/backtrace_silencers.rb +1 -1
- data/test/rails_app/config/initializers/devise.rb +82 -45
- data/test/rails_app/config/initializers/inflections.rb +10 -2
- data/test/rails_app/config/initializers/mime_types.rb +5 -0
- data/test/rails_app/config/initializers/secret_token.rb +7 -0
- data/test/rails_app/config/initializers/session_store.rb +2 -9
- data/test/rails_app/config/locales/en.yml +5 -0
- data/test/rails_app/config/routes.rb +3 -2
- data/test/routes_test.rb +4 -4
- data/test/test_helper.rb +7 -36
- metadata +85 -33
- data/app/views/invitations/edit.html.erb +0 -14
- data/app/views/invitations/new.html.erb +0 -12
- data/test/rails_app/config/initializers/new_rails_defaults.rb +0 -21
- data/test/rails_app/vendor/plugins/devise_invitable/init.rb +0 -1
@@ -1,110 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
def booted?
|
16
|
-
defined? Rails::Initializer
|
17
|
-
end
|
18
|
-
|
19
|
-
def pick_boot
|
20
|
-
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
-
end
|
22
|
-
|
23
|
-
def vendor_rails?
|
24
|
-
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
-
end
|
26
|
-
|
27
|
-
def preinitialize
|
28
|
-
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
-
end
|
30
|
-
|
31
|
-
def preinitializer_path
|
32
|
-
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
class Boot
|
37
|
-
def run
|
38
|
-
load_initializer
|
39
|
-
Rails::Initializer.run(:set_load_path)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
class VendorBoot < Boot
|
44
|
-
def load_initializer
|
45
|
-
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
-
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
-
Rails::GemDependency.add_frozen_gem_path
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
class GemBoot < Boot
|
52
|
-
def load_initializer
|
53
|
-
self.class.load_rubygems
|
54
|
-
load_rails_gem
|
55
|
-
require 'initializer'
|
56
|
-
end
|
57
|
-
|
58
|
-
def load_rails_gem
|
59
|
-
if version = self.class.gem_version
|
60
|
-
gem 'rails', version
|
61
|
-
else
|
62
|
-
gem 'rails'
|
63
|
-
end
|
64
|
-
rescue Gem::LoadError => load_error
|
65
|
-
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
66
|
-
exit 1
|
67
|
-
end
|
68
|
-
|
69
|
-
class << self
|
70
|
-
def rubygems_version
|
71
|
-
Gem::RubyGemsVersion rescue nil
|
72
|
-
end
|
73
|
-
|
74
|
-
def gem_version
|
75
|
-
if defined? RAILS_GEM_VERSION
|
76
|
-
RAILS_GEM_VERSION
|
77
|
-
elsif ENV.include?('RAILS_GEM_VERSION')
|
78
|
-
ENV['RAILS_GEM_VERSION']
|
79
|
-
else
|
80
|
-
parse_gem_version(read_environment_rb)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def load_rubygems
|
85
|
-
min_version = '1.3.2'
|
86
|
-
require 'rubygems'
|
87
|
-
unless rubygems_version >= min_version
|
88
|
-
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
89
|
-
exit 1
|
90
|
-
end
|
91
|
-
|
92
|
-
rescue LoadError
|
93
|
-
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
94
|
-
exit 1
|
95
|
-
end
|
96
|
-
|
97
|
-
def parse_gem_version(text)
|
98
|
-
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
99
|
-
end
|
100
|
-
|
101
|
-
private
|
102
|
-
def read_environment_rb
|
103
|
-
File.read("#{RAILS_ROOT}/config/environment.rb")
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
# All that for this:
|
110
|
-
Rails.boot!
|
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,44 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# Load the rails application
|
2
|
+
require File.expand_path('../application', __FILE__)
|
2
3
|
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
# Bootstrap the Rails environment, frameworks, and default configuration
|
7
|
-
require File.join(File.dirname(__FILE__), 'boot')
|
8
|
-
|
9
|
-
Rails::Initializer.run do |config|
|
10
|
-
# Settings in config/environments/* take precedence over those specified here.
|
11
|
-
# Application configuration should go into files in config/initializers
|
12
|
-
# -- all .rb files in that directory are automatically loaded.
|
13
|
-
|
14
|
-
# Add additional load paths for your own custom dirs
|
15
|
-
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
16
|
-
|
17
|
-
# Specify gems that this application depends on and have them installed with rake gems:install
|
18
|
-
# config.gem "bj"
|
19
|
-
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
|
20
|
-
# config.gem "sqlite3-ruby", :lib => "sqlite3"
|
21
|
-
# config.gem "aws-s3", :lib => "aws/s3"
|
22
|
-
# config.gem 'devise'
|
23
|
-
|
24
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
25
|
-
# :all can be used as a placeholder for all plugins not explicitly named
|
26
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
27
|
-
#config.plugin_paths += %W( #{RAILS_ROOT}/../../.. )
|
28
|
-
#config.plugins = [:devise_invitable]
|
29
|
-
|
30
|
-
# Skip frameworks you're not going to use. To use Rails without a database,
|
31
|
-
# you must remove the Active Record framework.
|
32
|
-
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
33
|
-
|
34
|
-
# Activate observers that should always be running
|
35
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
36
|
-
|
37
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
38
|
-
# Run "rake -D time" for a list of tasks for finding time zone names.
|
39
|
-
config.time_zone = 'UTC'
|
40
|
-
|
41
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
42
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
|
43
|
-
# config.i18n.default_locale = :en
|
44
|
-
end
|
4
|
+
# Initialize the rails application
|
5
|
+
RailsApp::Application.initialize!
|
@@ -1,17 +1,26 @@
|
|
1
|
-
|
1
|
+
RailsApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
3
|
|
3
|
-
# In the development environment your application's code is reloaded on
|
4
|
-
# every request. This slows down response time but is perfect for development
|
5
|
-
# since you don't have to restart the webserver when you make code changes.
|
6
|
-
config.cache_classes = false
|
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
|
7
8
|
|
8
|
-
# Log error messages when you accidentally call methods on nil.
|
9
|
-
config.whiny_nils = true
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
10
11
|
|
11
|
-
# Show full error reports and disable caching
|
12
|
-
config.
|
13
|
-
config.action_view.debug_rjs
|
14
|
-
config.action_controller.perform_caching
|
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
|
15
26
|
|
16
|
-
# Don't care if the mailer can't send
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
@@ -1,28 +1,49 @@
|
|
1
|
-
|
1
|
+
RailsApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
3
|
|
3
|
-
# The production environment is meant for finished, "live" apps.
|
4
|
-
# Code is not reloaded between requests
|
5
|
-
config.cache_classes = true
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
6
7
|
|
7
|
-
# Full error reports are disabled and caching is turned on
|
8
|
-
config.
|
9
|
-
config.action_controller.perform_caching
|
10
|
-
config.action_view.cache_template_loading = true
|
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
11
|
|
12
|
-
#
|
13
|
-
|
12
|
+
# Specifies the header that your server uses for sending files
|
13
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
14
|
|
15
|
-
#
|
16
|
-
# config.
|
15
|
+
# For nginx:
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
17
|
|
18
|
-
#
|
19
|
-
#
|
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
20
|
|
21
|
-
#
|
22
|
-
# config.
|
21
|
+
# See everything in the log (default is :info)
|
22
|
+
# config.log_level = :debug
|
23
23
|
|
24
|
-
#
|
25
|
-
# config.
|
24
|
+
# Use a different logger for distributed setups
|
25
|
+
# config.logger = SyslogLogger.new
|
26
26
|
|
27
|
-
#
|
28
|
-
# config.
|
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,28 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
# test
|
5
|
-
#
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
config.
|
15
|
-
config.
|
16
|
-
|
17
|
-
#
|
18
|
-
config.
|
19
|
-
|
20
|
-
#
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
#
|
26
|
-
|
27
|
-
|
28
|
-
#
|
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
|
@@ -3,5 +3,5 @@
|
|
3
3
|
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
4
|
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
5
|
|
6
|
-
# You can also remove all the silencers if you're trying
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
7
|
Rails.backtrace_cleaner.remove_silencers!
|
@@ -1,27 +1,20 @@
|
|
1
1
|
# Use this hook to configure devise mailer, warden hooks and so forth. The first
|
2
2
|
# four configuration values can also be set straight in your models.
|
3
3
|
Devise.setup do |config|
|
4
|
+
# ==> Mailer Configuration
|
4
5
|
# Configure the e-mail address which will be shown in DeviseMailer.
|
5
6
|
config.mailer_sender = "please-change-me@config-initializers-devise.com"
|
6
|
-
|
7
|
-
# Configure the content type of DeviseMailer mails (defaults to text/html")
|
8
|
-
# config.mailer_content_type = "text/plain"
|
9
|
-
|
10
|
-
# ==> Configuration for :authenticatable
|
11
|
-
# Invoke `rake secret` and use the printed value to setup a pepper to generate
|
12
|
-
# the encrypted password. By default no pepper is used.
|
13
|
-
# config.pepper = "rake secret output"
|
14
|
-
|
15
|
-
# Configure how many times you want the password is reencrypted. Default is 10.
|
16
|
-
# config.stretches = 10
|
17
|
-
|
18
|
-
# Define which will be the encryption algorithm. Supported algorithms are :sha1
|
19
|
-
# (default), :sha512 and :bcrypt. Devise also supports encryptors from others
|
20
|
-
# authentication tools as :clearance_sha1, :authlogic_sha512 (then you should set
|
21
|
-
# stretches above to 20 for default behavior) and :restful_authentication_sha1
|
22
|
-
# (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
|
23
|
-
# config.encryptor = :sha1
|
24
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
|
25
18
|
# Configure which keys are used when authenticating an user. By default is
|
26
19
|
# just :email. You can configure it to use [:username, :subdomain], so for
|
27
20
|
# authenticating an user, both parameters are required. Remember that those
|
@@ -29,33 +22,80 @@ Devise.setup do |config|
|
|
29
22
|
# session. If you need permissions, you should implement that in a before filter.
|
30
23
|
# config.authentication_keys = [ :email ]
|
31
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
|
+
|
32
34
|
# The realm used in Http Basic Authentication
|
33
35
|
# config.http_authentication_realm = "Application"
|
34
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
|
+
|
35
51
|
# ==> Configuration for :confirmable
|
36
|
-
# The time you want give
|
52
|
+
# The time you want to give your user to confirm his account. During this time
|
37
53
|
# he will be able to access your application without confirming. Default is nil.
|
54
|
+
# When confirm_within is zero, the user won't be able to sign in without confirming.
|
55
|
+
# You can use this to let your user access some features of your application
|
56
|
+
# without confirming the account, but blocking it after a certain period
|
57
|
+
# (ie 2 days).
|
38
58
|
# config.confirm_within = 2.days
|
39
59
|
|
40
60
|
# ==> Configuration for :rememberable
|
41
61
|
# The time the user will be remembered without asking for credentials again.
|
42
62
|
# config.remember_for = 2.weeks
|
43
63
|
|
64
|
+
# If true, a valid remember token can be re-used between multiple browsers.
|
65
|
+
# config.remember_across_browsers = true
|
66
|
+
|
67
|
+
# If true, extends the user's remember period when remembered via cookie.
|
68
|
+
# config.extend_remember_period = false
|
69
|
+
|
70
|
+
# ==> Configuration for :validatable
|
71
|
+
# Range for password length
|
72
|
+
# config.password_length = 6..20
|
73
|
+
|
74
|
+
# Regex to use to validate the email address
|
75
|
+
# config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
76
|
+
|
44
77
|
# ==> Configuration for :timeoutable
|
45
78
|
# The time you want to timeout the user session without activity. After this
|
46
79
|
# time the user will be asked for credentials again.
|
47
80
|
# config.timeout_in = 10.minutes
|
48
81
|
|
49
82
|
# ==> Configuration for :lockable
|
50
|
-
#
|
51
|
-
#
|
83
|
+
# Defines which strategy will be used to lock an account.
|
84
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
85
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
86
|
+
# config.lock_strategy = :failed_attempts
|
52
87
|
|
53
88
|
# Defines which strategy will be used to unlock an account.
|
54
89
|
# :email = Sends an unlock link to the user email
|
55
|
-
# :time =
|
56
|
-
# :both =
|
90
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
91
|
+
# :both = Enables both strategies
|
92
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
57
93
|
# config.unlock_strategy = :both
|
58
94
|
|
95
|
+
# Number of authentication tries before locking an account if lock_strategy
|
96
|
+
# is failed attempts.
|
97
|
+
# config.maximum_attempts = 20
|
98
|
+
|
59
99
|
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
60
100
|
# config.unlock_in = 1.hour
|
61
101
|
|
@@ -63,27 +103,30 @@ Devise.setup do |config|
|
|
63
103
|
# Defines name of the authentication token params key
|
64
104
|
# config.token_authentication_key = :auth_token
|
65
105
|
|
66
|
-
# ==>
|
67
|
-
# Load and configure the ORM. Supports :active_record (default), :mongo_mapper
|
68
|
-
# (requires mongo_ext installed) and :data_mapper (experimental).
|
69
|
-
# require 'devise/orm/mongo_mapper'
|
70
|
-
# config.orm = :mongo_mapper
|
71
|
-
|
106
|
+
# ==> Scopes configuration
|
72
107
|
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
73
|
-
# "sessions/
|
108
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
74
109
|
# are using only default views.
|
75
110
|
# config.scoped_views = true
|
76
111
|
|
77
|
-
#
|
78
|
-
#
|
79
|
-
# routes as "/sign_in" not possible, unless you tell Devise to use the default
|
80
|
-
# scope, setting true below.
|
81
|
-
# config.use_default_scope = true
|
82
|
-
|
83
|
-
# Configure the default scope used by Devise. By default it's the first devise
|
84
|
-
# role declared in your routes.
|
112
|
+
# Configure the default scope given to Warden. By default it's the first
|
113
|
+
# devise role declared in your routes.
|
85
114
|
# config.default_scope = :user
|
86
115
|
|
116
|
+
# Configure sign_out behavior.
|
117
|
+
# By default sign_out is scoped (i.e. /users/sign_out affects only :user scope).
|
118
|
+
# In case of sign_out_all_scopes set to true any logout action will sign out all active scopes.
|
119
|
+
# config.sign_out_all_scopes = false
|
120
|
+
|
121
|
+
# ==> Navigation configuration
|
122
|
+
# Lists the formats that should be treated as navigational. Formats like
|
123
|
+
# :html, should redirect to the sign in page when the user does not have
|
124
|
+
# access, but formats like :xml or :json, should return 401.
|
125
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
126
|
+
# should add them to the navigational formats lists. Default is [:html]
|
127
|
+
# config.navigational_formats = [:html, :iphone]
|
128
|
+
|
129
|
+
# ==> Warden configuration
|
87
130
|
# If you want to use other strategies, that are not (yet) supported by Devise,
|
88
131
|
# you can configure them inside the config.warden block. The example below
|
89
132
|
# allows you to setup OAuth, using http://github.com/roman/warden_oauth
|
@@ -94,12 +137,6 @@ Devise.setup do |config|
|
|
94
137
|
# twitter.consumer_key = <YOUR CONSUMER KEY>
|
95
138
|
# twitter.options :site => 'http://twitter.com'
|
96
139
|
# end
|
97
|
-
# manager.default_strategies.unshift :twitter_oauth
|
98
|
-
# end
|
99
|
-
|
100
|
-
# Configure default_url_options if you are using dynamic segments in :path_prefix
|
101
|
-
# for devise_for.
|
102
|
-
# config.default_url_options do
|
103
|
-
# { :locale => I18n.locale }
|
140
|
+
# manager.default_strategies(:scope => :user).unshift :twitter_oauth
|
104
141
|
# end
|
105
142
|
end
|