locomotive_cms 2.5.5 → 2.5.6.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -2
- data/README.textile +3 -3
- data/app/assets/images/locomotive/icons/flags/pt.png +0 -0
- data/app/assets/javascripts/locomotive/utils/aloha_settings.js.coffee +1 -1
- data/app/assets/javascripts/locomotive/views/current_site/edit_view.js.coffee +5 -0
- data/app/assets/stylesheets/locomotive/backoffice/menu/main.css.scss +1 -1
- data/app/controllers/locomotive/api/theme_assets_controller.rb +1 -1
- data/app/controllers/locomotive/public/content_entries_controller.rb +6 -11
- data/app/controllers/locomotive/public/pages_controller.rb +1 -1
- data/app/controllers/locomotive/public/sitemaps_controller.rb +1 -1
- data/app/models/locomotive/extensions/content_type/sync.rb +16 -5
- data/app/models/locomotive/extensions/page/tree.rb +7 -3
- data/app/models/locomotive/extensions/site/locales.rb +12 -9
- data/app/models/locomotive/site.rb +10 -0
- data/app/views/locomotive/current_site/_form.html.haml +1 -0
- data/config/locales/admin_ui.cs.yml +2 -0
- data/config/locales/admin_ui.de.yml +3 -2
- data/config/locales/admin_ui.en.yml +1 -0
- data/config/locales/admin_ui.es.yml +2 -1
- data/config/locales/admin_ui.et.yml +1 -0
- data/config/locales/admin_ui.fr.yml +2 -1
- data/config/locales/admin_ui.it.yml +23 -0
- data/config/locales/admin_ui.ja.yml +1 -0
- data/config/locales/admin_ui.nb.yml +1 -0
- data/config/locales/admin_ui.nl.yml +4 -0
- data/config/locales/admin_ui.pl.yml +1 -0
- data/config/locales/admin_ui.pt-BR.yml +6 -5
- data/config/locales/admin_ui.pt.yml +320 -0
- data/config/locales/admin_ui.ru.yml +1 -0
- data/config/locales/admin_ui.sk.yml +2 -0
- data/config/locales/admin_ui.sr.yml +1 -0
- data/config/locales/admin_ui.zh-CN.yml +1 -0
- data/config/locales/carrierwave.pt.yml +4 -0
- data/config/locales/default.pt.yml +212 -0
- data/config/locales/devise.pt.yml +62 -0
- data/config/locales/flash.pt.yml +106 -0
- data/config/locales/formtastic.pt.yml +70 -0
- data/config/routes.rb +5 -6
- data/features/api/authorization/theme_assets.feature +4 -4
- data/features/public/contact_form.feature +1 -1
- data/features/public/new_contact_form.feature +95 -0
- data/features/public/pages.feature +2 -2
- data/features/step_definitions/relationships_steps.rb +37 -34
- data/lib/generators/locomotive/install/install_generator.rb +2 -0
- data/lib/generators/locomotive/install/templates/README +3 -2
- data/lib/generators/locomotive/install/templates/devise.rb +175 -0
- data/lib/generators/locomotive/install/templates/dragonfly.rb +1 -1
- data/lib/generators/locomotive/install/templates/locomotive.rb +2 -2
- data/lib/locomotive.rb +9 -0
- data/lib/locomotive/action_controller/public_responder.rb +45 -28
- data/lib/locomotive/configuration.rb +2 -2
- data/lib/locomotive/liquid/drops/content_entry.rb +6 -8
- data/lib/locomotive/liquid/drops/site.rb +1 -5
- data/lib/locomotive/liquid/filters/translate.rb +1 -1
- data/lib/locomotive/liquid/tags/fetch_page.rb +14 -6
- data/lib/locomotive/liquid/tags/model_form.rb +75 -0
- data/lib/locomotive/middlewares.rb +5 -1
- data/lib/locomotive/middlewares/base.rb +45 -0
- data/lib/locomotive/middlewares/locale.rb +32 -0
- data/lib/locomotive/middlewares/locale_redirection.rb +46 -0
- data/lib/locomotive/middlewares/seo_trailing_slash.rb +7 -28
- data/lib/locomotive/middlewares/site.rb +26 -0
- data/lib/locomotive/regexps.rb +1 -1
- data/lib/locomotive/render.rb +22 -2
- data/lib/locomotive/routing.rb +1 -0
- data/lib/locomotive/routing/post_content_entry_constraint.rb +11 -0
- data/lib/locomotive/routing/site_dispatcher.rb +1 -12
- data/lib/locomotive/version.rb +1 -1
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/initializers/dragonfly.rb +1 -1
- data/spec/dummy/config/initializers/locomotive.rb +2 -2
- data/spec/lib/locomotive/liquid/drops/content_entry_spec.rb +23 -18
- data/spec/lib/locomotive/liquid/drops/site_spec.rb +25 -15
- data/spec/lib/locomotive/liquid/tags/model_form_spec.rb +46 -0
- data/spec/lib/locomotive/routing/site_dispatcher_spec.rb +0 -41
- data/spec/models/locomotive/site_spec.rb +1 -1
- data/spec/requests/locale_redirection_spec.rb +109 -0
- data/spec/requests/locale_spec.rb +85 -0
- data/spec/requests/seo_trailing_slash_spec.rb +1 -1
- data/spec/requests/site_spec.rb +27 -0
- data/spec/support/factories.rb +6 -0
- data/spec/support/middlewares.rb +3 -0
- metadata +48 -10
data/config/routes.rb
CHANGED
@@ -109,17 +109,16 @@ Rails.application.routes.draw do
|
|
109
109
|
|
110
110
|
# magic urls
|
111
111
|
match '/_admin' => 'locomotive/public/pages#show_toolbar'
|
112
|
-
match ':locale/_admin' => 'locomotive/public/pages#show_toolbar', locale: /(#{Locomotive.config.site_locales.join('|')})/
|
113
|
-
match ':locale/*path/_admin' => 'locomotive/public/pages#show_toolbar', locale: /(#{Locomotive.config.site_locales.join('|')})/
|
114
112
|
match '*path/_admin' => 'locomotive/public/pages#show_toolbar'
|
115
113
|
|
116
114
|
match '/_edit' => 'locomotive/public/pages#edit'
|
117
|
-
match ':locale/_edit' => 'locomotive/public/pages#edit', page_path: 'index', locale: /(#{Locomotive.config.site_locales.join('|')})/
|
118
|
-
match ':locale/*path/_edit' => 'locomotive/public/pages#edit', locale: /(#{Locomotive.config.site_locales.join('|')})/
|
119
115
|
match '*path/_edit' => 'locomotive/public/pages#edit'
|
120
116
|
|
117
|
+
constraints Locomotive::Routing::PostContentEntryConstraint.new do
|
118
|
+
root to: 'locomotive/public/content_entries#create', path: 'index'
|
119
|
+
match '*path' => 'locomotive/public/content_entries#create'
|
120
|
+
end
|
121
|
+
|
121
122
|
root to: 'locomotive/public/pages#show'
|
122
|
-
match ':locale' => 'locomotive/public/pages#show', page_path: 'index', locale: /(#{Locomotive.config.site_locales.join('|')})/
|
123
|
-
match ':locale/*path' => 'locomotive/public/pages#show', locale: /(#{Locomotive.config.site_locales.join('|')})/
|
124
123
|
match '*path' => 'locomotive/public/pages#show'
|
125
124
|
end
|
@@ -72,8 +72,8 @@ Feature: Theme Assets
|
|
72
72
|
Then the JSON response should be an array
|
73
73
|
And the JSON response should have 3 entries
|
74
74
|
And the JSON should have the following:
|
75
|
-
|
|
76
|
-
|
|
75
|
+
| 1/local_path | "new-javascript.js" |
|
76
|
+
| 1/content_type | "javascript" |
|
77
77
|
|
78
78
|
Scenario: Creating new theme asset as a Designer
|
79
79
|
Given I have a "designer" API token
|
@@ -95,8 +95,8 @@ Feature: Theme Assets
|
|
95
95
|
Then the JSON response should be an array
|
96
96
|
And the JSON response should have 3 entries
|
97
97
|
And the JSON should have the following:
|
98
|
-
|
|
99
|
-
|
|
98
|
+
| 1/local_path | "new-javascript.js" |
|
99
|
+
| 1/content_type | "javascript" |
|
100
100
|
|
101
101
|
Scenario: Creating new theme asset as an Author
|
102
102
|
Given I have an "author" API token
|
@@ -0,0 +1,95 @@
|
|
1
|
+
Feature: Contact form [New way]
|
2
|
+
As a visitor
|
3
|
+
In order to keep in touch with the site
|
4
|
+
I want to be able to send them a message
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I enable the CSRF protection for public submission requests
|
8
|
+
Given I have the site: "test site" set up
|
9
|
+
And I have a custom model named "Messages" with
|
10
|
+
| label | type | required |
|
11
|
+
| Email | string | true |
|
12
|
+
| Message | text | true |
|
13
|
+
| Category | select | true |
|
14
|
+
And I have "Design, Code, Business" as "Category" values of the "Messages" model
|
15
|
+
And I enable the public submission of the "Messages" model
|
16
|
+
And a page named "contact" with the template:
|
17
|
+
"""
|
18
|
+
<html>
|
19
|
+
<head></head>
|
20
|
+
<body>
|
21
|
+
{% if message %}Thanks {{ message.email }}{% endif %}
|
22
|
+
{% model_form "messages" %}
|
23
|
+
<label for="email">E-Mail Address</label>
|
24
|
+
<input type="text" id="email" name="content[email]" />
|
25
|
+
{% if message.errors.email %}Email is required{% endif %}
|
26
|
+
<label for="category">Category</label>
|
27
|
+
<select id="category" name="content[category]">
|
28
|
+
<option value=""></option>
|
29
|
+
{% for name in contents.messages.category_options %}
|
30
|
+
<option value="{{ name }}">{{ name }}</option>
|
31
|
+
{% endfor %}
|
32
|
+
</select>
|
33
|
+
<label for="message">Message</label>
|
34
|
+
<textarea name="content[message]" id="message"></textarea>
|
35
|
+
<input name="submit" type="submit" id="submit" value="Submit" />
|
36
|
+
{% endmodel_form %}
|
37
|
+
</body>
|
38
|
+
</html>
|
39
|
+
"""
|
40
|
+
And a page named "contact_with_redirection" with the template:
|
41
|
+
"""
|
42
|
+
<html>
|
43
|
+
<head></head>
|
44
|
+
<body>
|
45
|
+
{% model_form "messages", success: "/success" %}
|
46
|
+
<label for="email">E-Mail Address</label>
|
47
|
+
<input type="text" id="email" name="content[email]" />
|
48
|
+
{% if message.errors.email %}Email is required{% endif %}
|
49
|
+
<label for="category">Category</label>
|
50
|
+
<select id="category" name="content[category]">
|
51
|
+
<option value=""></option>
|
52
|
+
{% for name in contents.messages.category_options %}
|
53
|
+
<option value="{{ name }}">{{ name }}</option>
|
54
|
+
{% endfor %}
|
55
|
+
</select>
|
56
|
+
<label for="message">Message</label>
|
57
|
+
<textarea name="content[message]" id="message"></textarea>
|
58
|
+
<input name="submit" type="submit" id="submit" value="Submit" />
|
59
|
+
{% endmodel_form %}
|
60
|
+
</body>
|
61
|
+
</html>
|
62
|
+
"""
|
63
|
+
And a page named "success" with the template:
|
64
|
+
"""
|
65
|
+
Thanks {{ message.email }}!
|
66
|
+
"""
|
67
|
+
|
68
|
+
Scenario: Use the url of the current page for the contact form
|
69
|
+
When I view the rendered page at "/contact"
|
70
|
+
Then the rendered output should look like:
|
71
|
+
"""
|
72
|
+
<form method="POST" enctype="multipart/form-data">
|
73
|
+
"""
|
74
|
+
|
75
|
+
Scenario: Sending a message with success
|
76
|
+
When I view the rendered page at "/contact"
|
77
|
+
And I fill in "E-Mail Address" with "did@locomotivecms.com"
|
78
|
+
And I fill in "Message" with "LocomotiveCMS rocks"
|
79
|
+
And I select "Code" from "Category"
|
80
|
+
And I press "Submit"
|
81
|
+
Then I should see "Thanks did@locomotivecms.com"
|
82
|
+
|
83
|
+
Scenario: Display errors
|
84
|
+
When I view the rendered page at "/contact"
|
85
|
+
And I fill in "Message" with "LocomotiveCMS rocks"
|
86
|
+
And I press "Submit"
|
87
|
+
Then I should see "Email is required"
|
88
|
+
|
89
|
+
Scenario: Redirection after success
|
90
|
+
When I view the rendered page at "/contact_with_redirection"
|
91
|
+
And I fill in "E-Mail Address" with "estelle@locomotivecms.com"
|
92
|
+
And I fill in "Message" with "LocomotiveCMS rocks"
|
93
|
+
And I select "Code" from "Category"
|
94
|
+
And I press "Submit"
|
95
|
+
Then I should see "Thanks estelle@locomotivecms.com!"
|
@@ -14,7 +14,7 @@ Scenario: List all of them
|
|
14
14
|
When I view the rendered page at "/all"
|
15
15
|
Then the rendered output should look like:
|
16
16
|
"""
|
17
|
-
Home page,
|
17
|
+
Home page, Page not found, All,
|
18
18
|
"""
|
19
19
|
|
20
20
|
Scenario: Scoped listing
|
@@ -91,7 +91,7 @@ Scenario: link_to templatized page
|
|
91
91
|
"""
|
92
92
|
Here is the title: "Hello world"
|
93
93
|
"""
|
94
|
-
|
94
|
+
|
95
95
|
Scenario: Default locale fallback
|
96
96
|
Given the site "test site" has locales "en, es"
|
97
97
|
And a page named "only-english" with the template:
|
@@ -1,67 +1,67 @@
|
|
1
1
|
Given %r{^I have an? "([^"]*)" model which has many "([^"]*)"$} do |parent_model, child_model|
|
2
|
-
@parent_model = FactoryGirl.build(:content_type, :
|
3
|
-
ct.entries_custom_fields.build :
|
2
|
+
@parent_model = FactoryGirl.build(:content_type, site: @site, name: parent_model).tap do |ct|
|
3
|
+
ct.entries_custom_fields.build label: 'Body', type: 'string', required: false
|
4
4
|
ct.save!
|
5
5
|
end
|
6
|
-
@child_model = FactoryGirl.build(:content_type, :
|
7
|
-
ct.entries_custom_fields.build :
|
8
|
-
ct.entries_custom_fields.build :
|
6
|
+
@child_model = FactoryGirl.build(:content_type, site: @site, name: child_model).tap do |ct|
|
7
|
+
ct.entries_custom_fields.build label: 'Body', type: 'string', required: false
|
8
|
+
ct.entries_custom_fields.build label: parent_model.singularize.downcase, type: 'belongs_to', required: false, class_name: @parent_model.entries_class_name
|
9
9
|
ct.save!
|
10
10
|
end
|
11
11
|
|
12
12
|
@parent_model.entries_custom_fields.build({
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
13
|
+
label: child_model,
|
14
|
+
type: 'has_many',
|
15
|
+
class_name: @child_model.entries_class_name,
|
16
|
+
inverse_of: parent_model.singularize.downcase
|
17
17
|
})
|
18
18
|
|
19
19
|
@parent_model.save
|
20
20
|
end
|
21
21
|
|
22
22
|
Given %r{^I set up a has_many relationship between "([^"]*)" and "([^"]*)"$} do |source_name, target_name|
|
23
|
-
source_model = @site.content_types.where(:
|
24
|
-
target_model = @site.content_types.where(:
|
23
|
+
source_model = @site.content_types.where(name: source_name).first
|
24
|
+
target_model = @site.content_types.where(name: target_name).first
|
25
25
|
|
26
26
|
source_model.entries_custom_fields.build({
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
27
|
+
label: target_name,
|
28
|
+
type: 'has_many',
|
29
|
+
class_name: target_model.entries_class_name,
|
30
|
+
inverse_of: source_name.singularize.downcase
|
31
31
|
})
|
32
32
|
|
33
33
|
source_model.save
|
34
34
|
end
|
35
35
|
|
36
36
|
Given %r{^I set up a many_to_many relationship between "([^"]*)" and "([^"]*)"$} do |first_name, last_name|
|
37
|
-
first_model = @site.content_types.where(:
|
38
|
-
last_model = @site.content_types.where(:
|
37
|
+
first_model = @site.content_types.where(name: first_name).first
|
38
|
+
last_model = @site.content_types.where(name: last_name).first
|
39
39
|
|
40
40
|
first_model.entries_custom_fields.build({
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
41
|
+
label: last_name,
|
42
|
+
type: 'many_to_many',
|
43
|
+
class_name: last_model.entries_class_name,
|
44
|
+
inverse_of: first_name.pluralize.downcase
|
45
45
|
})
|
46
46
|
|
47
47
|
first_model.save
|
48
48
|
|
49
49
|
last_model.entries_custom_fields.build({
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
50
|
+
label: first_name,
|
51
|
+
type: 'many_to_many',
|
52
|
+
class_name: first_model.entries_class_name,
|
53
|
+
inverse_of: last_name.pluralize.downcase
|
54
54
|
})
|
55
55
|
|
56
56
|
last_model.save
|
57
57
|
end
|
58
58
|
|
59
59
|
Given %r{^I attach the "([^"]*)" ([\S]*) to the "([^"]*)" ([\S]*)$} do |target_name, target_model_name, souce_name, source_model_name|
|
60
|
-
target_model = @site.content_types.where(:
|
61
|
-
source_model = @site.content_types.where(:
|
60
|
+
target_model = @site.content_types.where(name: target_model_name.pluralize.capitalize).first
|
61
|
+
source_model = @site.content_types.where(name: source_model_name.pluralize.capitalize).first
|
62
62
|
|
63
|
-
target_entry = target_model.entries.where(:
|
64
|
-
source_entry = source_model.entries.where(:
|
63
|
+
target_entry = target_model.entries.where(_slug: target_name.permalink).first
|
64
|
+
source_entry = source_model.entries.where(_slug: souce_name.permalink).first
|
65
65
|
|
66
66
|
source_entry.send(target_model_name.pluralize.downcase.parameterize('_').to_sym).push(target_entry)
|
67
67
|
end
|
@@ -71,10 +71,11 @@ Then /^I should be able to view a paginated list of a has many association$/ do
|
|
71
71
|
step %{I have an "Articles" model which has many "Comments"}
|
72
72
|
|
73
73
|
# Create contents
|
74
|
-
article = @parent_model.entries.create!(:
|
75
|
-
@child_model.entries.create!(:
|
76
|
-
@child_model.entries.create!(:
|
77
|
-
@child_model.entries.create!(:
|
74
|
+
article = @parent_model.entries.create!(slug: 'parent', body: 'Parent')
|
75
|
+
@child_model.entries.create!(slug: 'one', body: 'One', article: article)
|
76
|
+
@child_model.entries.create!(slug: 'two', body: 'Two', article: article)
|
77
|
+
@child_model.entries.create!(slug: 'three', body: 'Three', article: article)
|
78
|
+
@child_model.entries.create!(slug: 'four', body: 'Four', article: article, _visible: false)
|
78
79
|
|
79
80
|
# Create a page
|
80
81
|
raw_template = %{
|
@@ -90,7 +91,7 @@ Then /^I should be able to view a paginated list of a has many association$/ do
|
|
90
91
|
}
|
91
92
|
|
92
93
|
# Create a page
|
93
|
-
FactoryGirl.create(:page, :
|
94
|
+
FactoryGirl.create(:page, site: @site, slug: 'hello', parent: @site.pages.root.first, raw_template: raw_template)
|
94
95
|
|
95
96
|
# The page should have the first two comments
|
96
97
|
visit '/hello'
|
@@ -98,10 +99,12 @@ Then /^I should be able to view a paginated list of a has many association$/ do
|
|
98
99
|
page.should have_content 'One'
|
99
100
|
page.should have_content 'Two'
|
100
101
|
page.should_not have_content 'Three'
|
102
|
+
page.should_not have_content 'Four'
|
101
103
|
|
102
104
|
# The second page should have the last comment
|
103
105
|
click_link '2'
|
104
106
|
page.should_not have_content 'One'
|
105
107
|
page.should_not have_content 'Two'
|
106
108
|
page.should have_content 'Three'
|
109
|
+
page.should_not have_content 'Four'
|
107
110
|
end
|
@@ -12,6 +12,8 @@ module Locomotive
|
|
12
12
|
|
13
13
|
template 'carrierwave.rb', 'config/initializers/carrierwave.rb'
|
14
14
|
|
15
|
+
template 'devise.rb', 'config/initializers/devise.rb'
|
16
|
+
|
15
17
|
template 'dragonfly.rb', 'config/initializers/dragonfly.rb'
|
16
18
|
|
17
19
|
template 'mongoid.yml', 'config/mongoid.yml'
|
@@ -4,11 +4,12 @@ The Locomotive Engine has been correctly installed in your Rails application.
|
|
4
4
|
|
5
5
|
1. Edit the main config files:
|
6
6
|
|
7
|
-
- config/initializers/locomotive.rb
|
8
7
|
- config/initializers/carrierwave.rb
|
8
|
+
- config/initializers/devise.rb
|
9
9
|
- config/initializers/dragonfly.rb
|
10
|
-
- config/
|
10
|
+
- config/initializers/locomotive.rb
|
11
11
|
- config/devise.yml
|
12
|
+
- config/mongoid.yml
|
12
13
|
- config/routes.rb
|
13
14
|
|
14
15
|
2. Launch the server
|
@@ -0,0 +1,175 @@
|
|
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
|
+
config.secret_key = "d9eb5171c59a4c817f68b0de27b8c1e340c2341b52cdbc60d3083d4e8958532" \
|
5
|
+
"18dcc5f589cafde048faec956b61f864b9b5513ff9ce29bf9e5d58b0f234f8e3b"
|
6
|
+
|
7
|
+
# ==> Mailer Configuration
|
8
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
9
|
+
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
10
|
+
config.mailer_sender = "please-change-me@config-initializers-devise.com"
|
11
|
+
|
12
|
+
|
13
|
+
# config.parent_controller = "ApplicationWithFakeEngine"
|
14
|
+
# Configure the class responsible to send e-mails.
|
15
|
+
# config.mailer = "Devise::Mailer"
|
16
|
+
|
17
|
+
# ==> ORM configuration
|
18
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
19
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
20
|
+
# available as additional gems.
|
21
|
+
require "devise/orm/mongoid"
|
22
|
+
|
23
|
+
# ==> Configuration for any authentication mechanism
|
24
|
+
# Configure which keys are used when authenticating a user. By default is
|
25
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
26
|
+
# authenticating a user, both parameters are required. Remember that those
|
27
|
+
# parameters are used only when authenticating and not when retrieving from
|
28
|
+
# session. If you need permissions, you should implement that in a before filter.
|
29
|
+
# You can also supply hash where the value is a boolean expliciting if authentication
|
30
|
+
# should be aborted or not if the value is not present. By default is empty.
|
31
|
+
# config.authentication_keys = [ :email ]
|
32
|
+
|
33
|
+
# Configure parameters from the request object used for authentication. Each entry
|
34
|
+
# given should be a request method and it will automatically be passed to
|
35
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
36
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
37
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
38
|
+
# config.request_keys = []
|
39
|
+
|
40
|
+
# Configure which authentication keys should be case-insensitive.
|
41
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
42
|
+
# to authenticate or find a user. Default is :email.
|
43
|
+
config.case_insensitive_keys = [ :email ]
|
44
|
+
|
45
|
+
# Configure which authentication keys should have whitespace stripped.
|
46
|
+
# These keys will have whitespace before and after removed upon creating or
|
47
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
48
|
+
config.strip_whitespace_keys = [ :email ]
|
49
|
+
|
50
|
+
# Tell if authentication through request.params is enabled. True by default.
|
51
|
+
# config.params_authenticatable = true
|
52
|
+
|
53
|
+
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
54
|
+
config.http_authenticatable = true
|
55
|
+
|
56
|
+
# If http headers should be returned for AJAX requests. True by default.
|
57
|
+
# config.http_authenticatable_on_xhr = true
|
58
|
+
|
59
|
+
# The realm used in Http Basic Authentication. "Application" by default.
|
60
|
+
# config.http_authentication_realm = "Application"
|
61
|
+
|
62
|
+
# ==> Configuration for :database_authenticatable
|
63
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
64
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
65
|
+
config.stretches = Rails.env.test? ? 1 : 10
|
66
|
+
|
67
|
+
# ==> Configuration for :confirmable
|
68
|
+
# The time you want to give your user to confirm their account. During this time
|
69
|
+
# they will be able to access your application without confirming. Default is nil.
|
70
|
+
# When allow_unconfirmed_access_for is zero, the user won't be able to sign in without confirming.
|
71
|
+
# You can use this to let your user access some features of your application
|
72
|
+
# without confirming the account, but blocking it after a certain period
|
73
|
+
# (ie 2 days).
|
74
|
+
# config.allow_unconfirmed_access_for = 2.days
|
75
|
+
|
76
|
+
# Defines which key will be used when confirming an account
|
77
|
+
# config.confirmation_keys = [ :email ]
|
78
|
+
|
79
|
+
# ==> Configuration for :rememberable
|
80
|
+
# The time the user will be remembered without asking for credentials again.
|
81
|
+
# config.remember_for = 2.weeks
|
82
|
+
|
83
|
+
# If true, a valid remember token can be re-used between multiple browsers.
|
84
|
+
# config.remember_across_browsers = true
|
85
|
+
|
86
|
+
# If true, extends the user's remember period when remembered via cookie.
|
87
|
+
# config.extend_remember_period = false
|
88
|
+
|
89
|
+
# ==> Configuration for :validatable
|
90
|
+
# Range for password length. Default is 8..128.
|
91
|
+
# config.password_length = 8..128
|
92
|
+
|
93
|
+
# Regex to use to validate the email address
|
94
|
+
# config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
95
|
+
|
96
|
+
# ==> Configuration for :timeoutable
|
97
|
+
# The time you want to timeout the user session without activity. After this
|
98
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
99
|
+
# config.timeout_in = 30.minutes
|
100
|
+
|
101
|
+
# ==> Configuration for :lockable
|
102
|
+
# Defines which strategy will be used to lock an account.
|
103
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
104
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
105
|
+
# config.lock_strategy = :failed_attempts
|
106
|
+
|
107
|
+
# Defines which key will be used when locking and unlocking an account
|
108
|
+
# config.unlock_keys = [ :email ]
|
109
|
+
|
110
|
+
# Defines which strategy will be used to unlock an account.
|
111
|
+
# :email = Sends an unlock link to the user email
|
112
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
113
|
+
# :both = Enables both strategies
|
114
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
115
|
+
# config.unlock_strategy = :both
|
116
|
+
|
117
|
+
# Number of authentication tries before locking an account if lock_strategy
|
118
|
+
# is failed attempts.
|
119
|
+
# config.maximum_attempts = 20
|
120
|
+
|
121
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
122
|
+
# config.unlock_in = 1.hour
|
123
|
+
|
124
|
+
# ==> Configuration for :recoverable
|
125
|
+
#
|
126
|
+
# Defines which key will be used when recovering the password for an account
|
127
|
+
# config.reset_password_keys = [ :email ]
|
128
|
+
|
129
|
+
# Time interval you can reset your password with a reset password key.
|
130
|
+
# Don't put a too small interval or your users won't have the time to
|
131
|
+
# change their passwords.
|
132
|
+
config.reset_password_within = 2.hours
|
133
|
+
|
134
|
+
# Setup a pepper to generate the encrypted password.
|
135
|
+
config.pepper = "d142367154e5beacca404b1a6a4f8bc52c6fdcfa3ccc3cf8eb49f3458a688ee6ac3b9fae488432a3bfca863b8a90008368a9f3a3dfbe5a962e64b6ab8f3a3a1a"
|
136
|
+
|
137
|
+
# ==> Configuration for :token_authenticatable
|
138
|
+
# Defines name of the authentication token params key
|
139
|
+
# config.token_authentication_key = :auth_token
|
140
|
+
|
141
|
+
# ==> Scopes configuration
|
142
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
143
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
144
|
+
# are using only default views.
|
145
|
+
# config.scoped_views = false
|
146
|
+
|
147
|
+
# Configure the default scope given to Warden. By default it's the first
|
148
|
+
# devise role declared in your routes (usually :user).
|
149
|
+
# config.default_scope = :user
|
150
|
+
|
151
|
+
# Configure sign_out behavior.
|
152
|
+
# Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
|
153
|
+
# The default is true, which means any logout action will sign out all active scopes.
|
154
|
+
# config.sign_out_all_scopes = true
|
155
|
+
|
156
|
+
# ==> Navigation configuration
|
157
|
+
# Lists the formats that should be treated as navigational. Formats like
|
158
|
+
# :html, should redirect to the sign in page when the user does not have
|
159
|
+
# access, but formats like :xml or :json, should return 401.
|
160
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
161
|
+
# should add them to the navigational formats lists. Default is [:html]
|
162
|
+
# config.navigational_formats = [:html, :iphone]
|
163
|
+
|
164
|
+
# The default HTTP method used to sign out a resource. Default is :get.
|
165
|
+
# config.sign_out_via = :get
|
166
|
+
|
167
|
+
# ==> Warden configuration
|
168
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
169
|
+
# change the failure app, you can configure them inside the config.warden block.
|
170
|
+
#
|
171
|
+
# config.warden do |manager|
|
172
|
+
# manager.failure_app = AnotherApp
|
173
|
+
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
174
|
+
# end
|
175
|
+
end
|