bento 0.0.1
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.
- data/README.rdoc +62 -0
- data/lib/bento.rb +6 -0
- data/lib/bento/controllers/account_scopable.rb +22 -0
- data/lib/bento/controllers/helpers.rb +17 -0
- data/lib/bento/models/account.rb +59 -0
- data/lib/bento/rails.rb +4 -0
- data/lib/bento/version.rb +3 -0
- data/lib/generators/active_record/bento_generator.rb +29 -0
- data/lib/generators/active_record/templates/add_migration.rb +9 -0
- data/lib/generators/active_record/templates/create_migration.rb +18 -0
- data/lib/generators/bento/bento_generator.rb +13 -0
- data/lib/generators/bento/orm_helpers.rb +22 -0
- data/lib/generators/bento/views_generator.rb +14 -0
- data/spec/bento/controllers/helpers_spec.rb +4 -0
- data/spec/bento/models/account_spec.rb +125 -0
- data/spec/proof_of_concepts_spec.rb +17 -0
- data/spec/rails_app/Rakefile +7 -0
- data/spec/rails_app/app/controllers/all_projects_controller.rb +6 -0
- data/spec/rails_app/app/controllers/application_controller.rb +4 -0
- data/spec/rails_app/app/controllers/custom_accounts_controller.rb +9 -0
- data/spec/rails_app/app/controllers/home_controller.rb +4 -0
- data/spec/rails_app/app/controllers/projects_controller.rb +6 -0
- data/spec/rails_app/app/models/account.rb +10 -0
- data/spec/rails_app/app/models/project.rb +4 -0
- data/spec/rails_app/app/models/user.rb +8 -0
- data/spec/rails_app/app/views/custom_accounts/new.html.erb +10 -0
- data/spec/rails_app/app/views/home/index.html.erb +1 -0
- data/spec/rails_app/app/views/layouts/application.html.erb +29 -0
- data/spec/rails_app/app/views/projects/_all_projects.html.erb +9 -0
- data/spec/rails_app/app/views/projects/_current_account_projects.html.erb +9 -0
- data/spec/rails_app/app/views/projects/_form.html.erb +5 -0
- data/spec/rails_app/app/views/projects/edit.html.erb +1 -0
- data/spec/rails_app/app/views/projects/index.html.erb +7 -0
- data/spec/rails_app/app/views/projects/new.html.erb +1 -0
- data/spec/rails_app/config.ru +4 -0
- data/spec/rails_app/config/application.rb +43 -0
- data/spec/rails_app/config/boot.rb +15 -0
- data/spec/rails_app/config/database.yml +22 -0
- data/spec/rails_app/config/environment.rb +6 -0
- data/spec/rails_app/config/environments/development.rb +28 -0
- data/spec/rails_app/config/environments/production.rb +49 -0
- data/spec/rails_app/config/environments/test.rb +35 -0
- data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_app/config/initializers/devise.rb +142 -0
- data/spec/rails_app/config/initializers/inaccessible_attributes.rb +13 -0
- data/spec/rails_app/config/initializers/inflections.rb +10 -0
- data/spec/rails_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_app/config/initializers/secret_token.rb +7 -0
- data/spec/rails_app/config/initializers/session_store.rb +8 -0
- data/spec/rails_app/config/locales/devise.en.yml +39 -0
- data/spec/rails_app/config/locales/en.yml +5 -0
- data/spec/rails_app/config/routes.rb +9 -0
- data/spec/rails_app/db/development.sqlite3 +0 -0
- data/spec/rails_app/db/migrate/20100924132032_devise_create_users.rb +19 -0
- data/spec/rails_app/db/migrate/20101015094514_bento_create_accounts.rb +15 -0
- data/spec/rails_app/db/migrate/20101015094515_bento_add_account_id_to_accounts.rb +9 -0
- data/spec/rails_app/db/migrate/20101015143011_create_projects.rb +13 -0
- data/spec/rails_app/db/production.sqlite3 +0 -0
- data/spec/rails_app/db/schema.rb +44 -0
- data/spec/rails_app/db/test.sqlite3 +0 -0
- data/spec/rails_app/log/development.log +1290 -0
- data/spec/rails_app/log/test.log +30285 -0
- data/spec/rails_app/public/404.html +26 -0
- data/spec/rails_app/public/422.html +26 -0
- data/spec/rails_app/public/500.html +26 -0
- data/spec/rails_app/public/favicon.ico +0 -0
- data/spec/rails_app/script/rails +6 -0
- data/spec/rails_app/tmp/pids/server.pid +1 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/support/bento_spec_helper.rb +16 -0
- data/spec/support/blueprints.rb +32 -0
- metadata +403 -0
@@ -0,0 +1,7 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
5
|
+
require 'rake'
|
6
|
+
|
7
|
+
RailsApp::Application.load_tasks
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class CustomAccountsController < Bento::AccountsController
|
2
|
+
defaults :resource_class => Account, :collection_name => 'accounts', :instance_name => 'account'
|
3
|
+
skip_before_filter :authenticate_user!, :only => %w[new]
|
4
|
+
|
5
|
+
def new
|
6
|
+
flash[:special] = "Welcome to '#{controller_path}' controller!"
|
7
|
+
super
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class Account < ActiveRecord::Base
|
2
|
+
# Include all bento modules. Others available are:
|
3
|
+
# :all, :validations, :user_accessors, :user_association, :user_accessors, :trial
|
4
|
+
bento_account
|
5
|
+
|
6
|
+
# Setup accessible (or protected) attributes for your model
|
7
|
+
attr_accessible :name, :plan, :first_name, :last_name, :email, :password_confirmation, :password
|
8
|
+
|
9
|
+
has_many :projects
|
10
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
devise :database_authenticatable, :validatable
|
3
|
+
# Also available: :token_authenticatable, :confirmable, :lockable,
|
4
|
+
# :timeoutable :registerable, :trackable, :rememberable, :recoverable
|
5
|
+
|
6
|
+
attr_accessible :first_name, :last_name, :email, :password, :password_confirmation, :account
|
7
|
+
belongs_to :account
|
8
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<h1>New account</h1>
|
2
|
+
<%= simple_form_for @account do |form| -%>
|
3
|
+
<%= form.input :name, :label => 'Account name', :hint => 'For example, your own name or the name of your company.' %>
|
4
|
+
<%= form.input :first_name %>
|
5
|
+
<%= form.input :last_name %>
|
6
|
+
<%= form.input :email, :label => 'Email address', :hint => 'Will be used as your login.' %>
|
7
|
+
<%= form.input :password %>
|
8
|
+
<%= form.input :password_confirmation %>
|
9
|
+
<%= form.button :submit, "Create account", :class => "Submit" %>
|
10
|
+
<% end -%>
|
@@ -0,0 +1 @@
|
|
1
|
+
Welcome to the index page
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>RailsApp</title>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<h1>Welcome to the app that's using Bento</h1>
|
8
|
+
|
9
|
+
<% flash.each do |type, message| %>
|
10
|
+
<p id="flash" class="<%= type %>"><%= message %></p>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<%= link_to "Manage accounts", accounts_path %>
|
14
|
+
<%= link_to "Bento Accounts", new_account_path %>
|
15
|
+
<%= link_to "Custom Accounts", new_custom_account_path %>
|
16
|
+
|
17
|
+
<% if user_signed_in? %>
|
18
|
+
<span>Current account: <%= current_account.name %></span>
|
19
|
+
<%= link_to "Projects", projects_path %>
|
20
|
+
<%= link_to "All projects", projects_path(:all => true) %>
|
21
|
+
<%= link_to('Sign out', destroy_user_session_path) %>
|
22
|
+
<% else %>
|
23
|
+
<%= link_to "Sign up", sign_up_accounts_path %>
|
24
|
+
<%= link_to "Sign in", new_user_session_path %>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<%= yield %>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<h4>All projects:</h4>
|
2
|
+
<ul>
|
3
|
+
<% Project.all.each do |project| %>
|
4
|
+
<li>
|
5
|
+
<%= link_to "Edit '#{project.name}'", edit_all_project_path(project) %>
|
6
|
+
<%= button_to "Delete '#{project.name}'", project_path(project), :method => :delete %>
|
7
|
+
</li>
|
8
|
+
<% end %>
|
9
|
+
</ul>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<h4><%= current_account.name %>'s projects:</h4>
|
2
|
+
<ul>
|
3
|
+
<% current_account.projects.each do |project| %>
|
4
|
+
<li>
|
5
|
+
<%= link_to "Edit '#{project.name}'", edit_project_path(project) %>
|
6
|
+
<%= button_to "Delete '#{project.name}'", project_path(project), :method => :delete %>
|
7
|
+
</li>
|
8
|
+
<% end %>
|
9
|
+
</ul>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'projects/form' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'form' %>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
# If you have a Gemfile, require the gems listed there, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
8
|
+
|
9
|
+
require "bento"
|
10
|
+
module RailsApp
|
11
|
+
class Application < Rails::Application
|
12
|
+
# Settings in config/environments/* take precedence over those specified here.
|
13
|
+
# Application configuration should go into files in config/initializers
|
14
|
+
# -- all .rb files in that directory are automatically loaded.
|
15
|
+
|
16
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
17
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
18
|
+
|
19
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
20
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
21
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
22
|
+
|
23
|
+
# Activate observers that should always be running.
|
24
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
25
|
+
|
26
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
27
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
28
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
29
|
+
|
30
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
31
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
32
|
+
# config.i18n.default_locale = :de
|
33
|
+
|
34
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
35
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
36
|
+
|
37
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
38
|
+
config.encoding = "utf-8"
|
39
|
+
|
40
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
41
|
+
config.filter_parameters += [:password]
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,15 @@
|
|
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)
|
14
|
+
|
15
|
+
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
@@ -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: db/development.sqlite3
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: db/test.sqlite3
|
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,28 @@
|
|
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
|
+
|
26
|
+
# Devise mailing
|
27
|
+
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
28
|
+
end
|
@@ -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,142 @@
|
|
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 = :bcrypt
|
47
|
+
|
48
|
+
# Setup a pepper to generate the encrypted password.
|
49
|
+
config.pepper = "1ec78033848cee5ab6addd8b88d24a7aa057712645af5420e22a9b277d306edd0f30ce82cede728d05011aefa12ffd5870b34d0d7ab80fa7ebd08c66b3db9864"
|
50
|
+
|
51
|
+
# ==> Configuration for :confirmable
|
52
|
+
# The time you want to give your user to confirm his account. During this time
|
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).
|
58
|
+
# config.confirm_within = 2.days
|
59
|
+
|
60
|
+
# ==> Configuration for :rememberable
|
61
|
+
# The time the user will be remembered without asking for credentials again.
|
62
|
+
# config.remember_for = 2.weeks
|
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
|
+
|
77
|
+
# ==> Configuration for :timeoutable
|
78
|
+
# The time you want to timeout the user session without activity. After this
|
79
|
+
# time the user will be asked for credentials again.
|
80
|
+
# config.timeout_in = 10.minutes
|
81
|
+
|
82
|
+
# ==> Configuration for :lockable
|
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
|
87
|
+
|
88
|
+
# Defines which strategy will be used to unlock an account.
|
89
|
+
# :email = Sends an unlock link to the user email
|
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.
|
93
|
+
# config.unlock_strategy = :both
|
94
|
+
|
95
|
+
# Number of authentication tries before locking an account if lock_strategy
|
96
|
+
# is failed attempts.
|
97
|
+
# config.maximum_attempts = 20
|
98
|
+
|
99
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
100
|
+
# config.unlock_in = 1.hour
|
101
|
+
|
102
|
+
# ==> Configuration for :token_authenticatable
|
103
|
+
# Defines name of the authentication token params key
|
104
|
+
# config.token_authentication_key = :auth_token
|
105
|
+
|
106
|
+
# ==> Scopes configuration
|
107
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
108
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
109
|
+
# are using only default views.
|
110
|
+
# config.scoped_views = true
|
111
|
+
|
112
|
+
# Configure the default scope given to Warden. By default it's the first
|
113
|
+
# devise role declared in your routes.
|
114
|
+
# config.default_scope = :user
|
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
|
130
|
+
# If you want to use other strategies, that are not (yet) supported by Devise,
|
131
|
+
# you can configure them inside the config.warden block. The example below
|
132
|
+
# allows you to setup OAuth, using http://github.com/roman/warden_oauth
|
133
|
+
#
|
134
|
+
# config.warden do |manager|
|
135
|
+
# manager.oauth(:twitter) do |twitter|
|
136
|
+
# twitter.consumer_secret = <YOUR CONSUMER SECRET>
|
137
|
+
# twitter.consumer_key = <YOUR CONSUMER KEY>
|
138
|
+
# twitter.options :site => 'http://twitter.com'
|
139
|
+
# end
|
140
|
+
# manager.default_strategies(:scope => :user).unshift :twitter_oauth
|
141
|
+
# end
|
142
|
+
end
|