aihs_devise_invitable 0.4.rc
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +27 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +117 -0
- data/LICENSE +20 -0
- data/README.rdoc +187 -0
- data/Rakefile +57 -0
- data/app/controllers/devise/invitations_controller.rb +47 -0
- 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/invitation.html.erb +8 -0
- data/app/views/devise/mailer/invitation_instructions.html.erb +8 -0
- data/config/locales/en.yml +9 -0
- data/devise_invitable.gemspec +143 -0
- data/lib/devise_invitable.rb +16 -0
- data/lib/devise_invitable/controllers/helpers.rb +7 -0
- data/lib/devise_invitable/controllers/url_helpers.rb +24 -0
- data/lib/devise_invitable/mailer.rb +14 -0
- data/lib/devise_invitable/model.rb +130 -0
- data/lib/devise_invitable/rails.rb +13 -0
- data/lib/devise_invitable/routes.rb +13 -0
- data/lib/devise_invitable/schema.rb +33 -0
- data/lib/devise_invitable/version.rb +3 -0
- data/lib/generators/active_record/devise_invitable_generator.rb +13 -0
- data/lib/generators/active_record/templates/migration.rb +20 -0
- data/lib/generators/devise_invitable/devise_invitable_generator.rb +16 -0
- data/lib/generators/devise_invitable/install_generator.rb +35 -0
- data/lib/generators/devise_invitable/views_generator.rb +10 -0
- data/test/generators_test.rb +45 -0
- data/test/integration/invitation_test.rb +107 -0
- data/test/integration_tests_helper.rb +58 -0
- data/test/mailers/invitation_mail_test.rb +63 -0
- data/test/model_tests_helper.rb +41 -0
- data/test/models/invitable_test.rb +213 -0
- data/test/models_test.rb +32 -0
- data/test/rails_app/app/controllers/admins_controller.rb +6 -0
- data/test/rails_app/app/controllers/application_controller.rb +3 -0
- data/test/rails_app/app/controllers/home_controller.rb +4 -0
- data/test/rails_app/app/controllers/users_controller.rb +12 -0
- data/test/rails_app/app/helpers/application_helper.rb +2 -0
- data/test/rails_app/app/models/octopussy.rb +11 -0
- data/test/rails_app/app/models/user.rb +4 -0
- data/test/rails_app/app/views/home/index.html.erb +0 -0
- data/test/rails_app/app/views/layouts/application.html.erb +16 -0
- data/test/rails_app/app/views/users/invitations/new.html.erb +15 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/config/application.rb +46 -0
- data/test/rails_app/config/boot.rb +14 -0
- data/test/rails_app/config/database.yml +22 -0
- data/test/rails_app/config/environment.rb +5 -0
- data/test/rails_app/config/environments/development.rb +26 -0
- data/test/rails_app/config/environments/production.rb +49 -0
- data/test/rails_app/config/environments/test.rb +35 -0
- data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_app/config/initializers/devise.rb +174 -0
- data/test/rails_app/config/initializers/inflections.rb +10 -0
- 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 +8 -0
- data/test/rails_app/config/locales/en.yml +5 -0
- data/test/rails_app/config/routes.rb +4 -0
- data/test/rails_app/script/rails +6 -0
- data/test/routes_test.rb +20 -0
- data/test/test_helper.rb +31 -0
- metadata +222 -0
data/test/models_test.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test/test_helper'
|
2
|
+
|
3
|
+
class Invitable < ActiveRecord::Base
|
4
|
+
set_table_name 'users'
|
5
|
+
devise :database_authenticatable, :invitable, :encryptable, :invite_for => 5.days
|
6
|
+
end
|
7
|
+
|
8
|
+
class ModelsTest < ActiveSupport::TestCase
|
9
|
+
def include_module?(klass, mod)
|
10
|
+
klass.devise_modules.include?(mod) &&
|
11
|
+
klass.included_modules.include?(Devise::Models::const_get(mod.to_s.classify))
|
12
|
+
end
|
13
|
+
|
14
|
+
def assert_include_modules(klass, *modules)
|
15
|
+
modules.each do |mod|
|
16
|
+
assert include_module?(klass, mod), "#{klass} not include #{mod}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
test 'add invitable module only' do
|
21
|
+
assert_include_modules Invitable, :invitable
|
22
|
+
end
|
23
|
+
|
24
|
+
test 'set a default value for invite_for' do
|
25
|
+
assert_equal 5.days, Invitable.invite_for
|
26
|
+
end
|
27
|
+
|
28
|
+
test 'invitable attributes' do
|
29
|
+
assert_not_nil Invitable.columns_hash['invitation_token']
|
30
|
+
assert_not_nil Invitable.columns_hash['invitation_sent_at']
|
31
|
+
end
|
32
|
+
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,11 @@
|
|
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, :encryptable
|
5
|
+
end
|
6
|
+
elsif DEVISE_ORM == :mongoid
|
7
|
+
class Octopussy
|
8
|
+
include Mongoid::Document
|
9
|
+
devise :database_authenticatable, :validatable, :confirmable, :encryptable
|
10
|
+
end
|
11
|
+
end
|
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,46 @@
|
|
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
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
|
4
|
+
# Set up gems listed in the Gemfile.
|
5
|
+
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
|
6
|
+
begin
|
7
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
8
|
+
require 'bundler'
|
9
|
+
Bundler.setup
|
10
|
+
rescue Bundler::GemNotFound => e
|
11
|
+
STDERR.puts e.message
|
12
|
+
STDERR.puts "Try running `bundle install`."
|
13
|
+
exit!
|
14
|
+
end if File.exist?(gemfile)
|
@@ -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,26 @@
|
|
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
|
+
|
@@ -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,35 @@
|
|
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
|
@@ -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,174 @@
|
|
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
|
+
# You can also supply hash where the value is a boolean expliciting if authentication
|
24
|
+
# should be aborted or not if the value is not present. By default is empty.
|
25
|
+
# config.authentication_keys = [ :email ]
|
26
|
+
|
27
|
+
# Configure parameters from the request object used for authentication. Each entry
|
28
|
+
# given should be a request method and it will automatically be passed to
|
29
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
30
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
31
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
32
|
+
# config.request_keys = []
|
33
|
+
|
34
|
+
# Tell if authentication through request.params is enabled. True by default.
|
35
|
+
# config.params_authenticatable = true
|
36
|
+
|
37
|
+
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
38
|
+
# config.http_authenticatable = false
|
39
|
+
|
40
|
+
# If http headers should be returned for AJAX requests. True by default.
|
41
|
+
# config.http_authenticatable_on_xhr = true
|
42
|
+
|
43
|
+
# The realm used in Http Basic Authentication. "Application" by default.
|
44
|
+
# config.http_authentication_realm = "Application"
|
45
|
+
|
46
|
+
# ==> Configuration for :database_authenticatable
|
47
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
48
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
49
|
+
config.stretches = 10
|
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
|
+
# If true, uses the password salt as remember token. This should be turned
|
77
|
+
# to false if you are not using database authenticatable.
|
78
|
+
config.use_salt_as_remember_token = true
|
79
|
+
|
80
|
+
# ==> Configuration for :validatable
|
81
|
+
# Range for password length. Default is 6..20.
|
82
|
+
# config.password_length = 6..20
|
83
|
+
|
84
|
+
# Regex to use to validate the email address
|
85
|
+
# config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
86
|
+
|
87
|
+
# ==> Configuration for :timeoutable
|
88
|
+
# The time you want to timeout the user session without activity. After this
|
89
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
90
|
+
# config.timeout_in = 30.minutes
|
91
|
+
|
92
|
+
# ==> Configuration for :lockable
|
93
|
+
# Defines which strategy will be used to lock an account.
|
94
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
95
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
96
|
+
# config.lock_strategy = :failed_attempts
|
97
|
+
|
98
|
+
# Defines which strategy will be used to unlock an account.
|
99
|
+
# :email = Sends an unlock link to the user email
|
100
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
101
|
+
# :both = Enables both strategies
|
102
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
103
|
+
# config.unlock_strategy = :both
|
104
|
+
|
105
|
+
# Number of authentication tries before locking an account if lock_strategy
|
106
|
+
# is failed attempts.
|
107
|
+
# config.maximum_attempts = 20
|
108
|
+
|
109
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
110
|
+
# config.unlock_in = 1.hour
|
111
|
+
|
112
|
+
# ==> Configuration for :encryptable
|
113
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
114
|
+
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
115
|
+
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
116
|
+
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
117
|
+
# REST_AUTH_SITE_KEY to pepper)
|
118
|
+
config.encryptor = :sha1
|
119
|
+
|
120
|
+
# Setup a pepper to generate the encrypted password.
|
121
|
+
config.pepper = "c9ed39f2a5faea59e2f9634cd5466703ead30a1fe25ab08cad00fe4d41d23467401fd731eaca1b1326d97b3065217daa81a18368ecc435978e6e868442b753ac"
|
122
|
+
|
123
|
+
# ==> Configuration for :token_authenticatable
|
124
|
+
# Defines name of the authentication token params key
|
125
|
+
# config.token_authentication_key = :auth_token
|
126
|
+
|
127
|
+
# If true, authentication through token does not store user in session and needs
|
128
|
+
# to be supplied on each request. Useful if you are using the token as API token.
|
129
|
+
# config.stateless_token = false
|
130
|
+
|
131
|
+
# ==> Scopes configuration
|
132
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
133
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
134
|
+
# are using only default views.
|
135
|
+
# config.scoped_views = false
|
136
|
+
|
137
|
+
# Configure the default scope given to Warden. By default it's the first
|
138
|
+
# devise role declared in your routes (usually :user).
|
139
|
+
# config.default_scope = :user
|
140
|
+
|
141
|
+
# Configure sign_out behavior.
|
142
|
+
# Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
|
143
|
+
# The default is true, which means any logout action will sign out all active scopes.
|
144
|
+
# config.sign_out_all_scopes = true
|
145
|
+
|
146
|
+
# ==> Navigation configuration
|
147
|
+
# Lists the formats that should be treated as navigational. Formats like
|
148
|
+
# :html, should redirect to the sign in page when the user does not have
|
149
|
+
# access, but formats like :xml or :json, should return 401.
|
150
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
151
|
+
# should add them to the navigational formats lists. Default is [:html]
|
152
|
+
# config.navigational_formats = [:html, :iphone]
|
153
|
+
|
154
|
+
# The default HTTP method used to sign out a resource. Default is :get.
|
155
|
+
# config.sign_out_via = :get
|
156
|
+
|
157
|
+
# ==> OAuth2
|
158
|
+
# Add a new OAuth2 provider. Check the README for more information on setting
|
159
|
+
# up on your models and hooks. By default this is not set.
|
160
|
+
# config.oauth :github, 'APP_ID', 'APP_SECRET',
|
161
|
+
# :site => 'https://github.com/',
|
162
|
+
# :authorize_path => '/login/oauth/authorize',
|
163
|
+
# :access_token_path => '/login/oauth/access_token',
|
164
|
+
# :scope => %w(user public_repo)
|
165
|
+
|
166
|
+
# ==> Warden configuration
|
167
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
168
|
+
# change the failure app, you can configure them inside the config.warden block.
|
169
|
+
#
|
170
|
+
# config.warden do |manager|
|
171
|
+
# manager.failure_app = AnotherApp
|
172
|
+
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
173
|
+
# end
|
174
|
+
end
|