home_page 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/assets/javascripts/home_page/application.js +3 -0
- data/app/assets/javascripts/home_page/loader.js +16 -0
- data/app/assets/stylesheets/home_page/application.css +5 -0
- data/app/assets/stylesheets/home_page/base.less +10 -0
- data/app/assets/stylesheets/home_page/bootswatch.css.less +5 -0
- data/app/assets/stylesheets/home_page/loader.css.less +51 -0
- data/app/assets/stylesheets/home_page/mixins.less +42 -0
- data/app/assets/stylesheets/home_page/variables.less +860 -0
- data/app/controllers/devise_extensions/registrations_controller.rb +32 -0
- data/app/controllers/home_controller.rb +4 -0
- data/app/controllers/home_page/application_controller.rb +19 -0
- data/app/controllers/users_controller.rb +39 -0
- data/app/helpers/home_page/application_helper.rb +26 -0
- data/app/helpers/home_page/layout_helper.rb +29 -0
- data/app/models/user.rb +20 -0
- data/app/views/devise/registrations/new.html.erb +3 -0
- data/app/views/home/index.html.erb +0 -0
- data/app/views/layouts/application.html.erb +56 -0
- data/app/views/users/_form.html.erb +25 -0
- data/app/views/users/edit.html.erb +3 -0
- data/app/views/users/index.html.erb +34 -0
- data/app/views/users/new.html.erb +3 -0
- data/config/initializers/devise.rb +259 -0
- data/config/initializers/simple_form.rb +166 -0
- data/config/initializers/simple_form_bootstrap.rb +136 -0
- data/config/initializers/simple_navigation.rb +2 -0
- data/config/locales/devise.en.yml +61 -0
- data/config/locales/general/en.yml +40 -0
- data/config/locales/resources/user/en.yml +17 -0
- data/config/locales/simple_form.en.yml +31 -0
- data/config/routes.rb +6 -1
- data/db/migrate/20150307152542_create_initial_schema.rb +53 -0
- data/lib/home_page.rb +17 -1
- data/lib/home_page/engine.rb +5 -0
- data/lib/home_page/navigation.rb +66 -0
- data/lib/home_page/simple_navigation_renderer/breadcrumbs_without_method_links.rb +28 -0
- data/lib/home_page/simple_navigation_renderer/twitter_sidenav.rb +30 -0
- data/lib/home_page/version.rb +1 -1
- data/lib/templates/erb/scaffold/_form.html.erb +13 -0
- metadata +218 -27
@@ -0,0 +1,32 @@
|
|
1
|
+
class DeviseExtensions::RegistrationsController < Devise::RegistrationsController
|
2
|
+
# POST /resource
|
3
|
+
def create
|
4
|
+
build_resource(params[:user])
|
5
|
+
|
6
|
+
captcha_verified = if Rails.env == 'development' || Rails.env == 'production'
|
7
|
+
verify_recaptcha(model: resource, message: I18n.t('general.exceptions.wrong_recaptcha'))
|
8
|
+
else
|
9
|
+
true
|
10
|
+
end
|
11
|
+
|
12
|
+
resource.save if captcha_verified
|
13
|
+
|
14
|
+
yield resource if block_given?
|
15
|
+
|
16
|
+
if resource.persisted?
|
17
|
+
if resource.active_for_authentication?
|
18
|
+
set_flash_message :notice, :signed_up if is_flashing_format?
|
19
|
+
sign_up(resource_name, resource)
|
20
|
+
respond_with resource, location: after_sign_up_path_for(resource)
|
21
|
+
else
|
22
|
+
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_flashing_format?
|
23
|
+
expire_data_after_sign_in!
|
24
|
+
respond_with resource, location: after_inactive_sign_up_path_for(resource)
|
25
|
+
end
|
26
|
+
else
|
27
|
+
clean_up_passwords resource
|
28
|
+
set_minimum_password_length
|
29
|
+
respond_with resource
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class HomePage::ApplicationController < ActionController::Base
|
2
|
+
# Prevent CSRF attacks by raising an exception.
|
3
|
+
# For APIs, you may want to use :null_session instead.
|
4
|
+
protect_from_forgery with: :exception
|
5
|
+
|
6
|
+
layout proc { |controller| controller.request.xhr? ? false : 'application' }
|
7
|
+
|
8
|
+
rescue_from ActiveRecord::RecordNotFound, with: :not_found
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def not_found(e)
|
13
|
+
if Rails.env.development?
|
14
|
+
raise e
|
15
|
+
else
|
16
|
+
redirect_to root_path, notice: t('general.exceptions.not_found')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class UsersController < ApplicationController
|
2
|
+
before_filter :find_resource, only: [:edit, :update, :destroy]
|
3
|
+
|
4
|
+
respond_to :html
|
5
|
+
|
6
|
+
helper_method :resource
|
7
|
+
|
8
|
+
before_filter :authenticate_user!
|
9
|
+
|
10
|
+
def index
|
11
|
+
@users = User.order('name ASC')
|
12
|
+
end
|
13
|
+
|
14
|
+
def edit
|
15
|
+
end
|
16
|
+
|
17
|
+
def update
|
18
|
+
if params[:user][:password].present? ? @user.update_attributes(params[:user]) : @user.update_without_password(params[:user])
|
19
|
+
redirect_to edit_user_path(current_user), notice: t('general.form.successfully_updated')
|
20
|
+
else
|
21
|
+
render :edit
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def destroy
|
26
|
+
@user.destroy
|
27
|
+
redirect_to users_url, notice: t('general.form.destroyed')
|
28
|
+
end
|
29
|
+
|
30
|
+
def resource
|
31
|
+
@user
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def find_resource
|
37
|
+
@user = User.friendly.find(params[:id])
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module HomePage
|
2
|
+
module ApplicationHelper
|
3
|
+
# Taken from https://github.com/seyhunak/twitter-bootstrap-rails
|
4
|
+
# Modified to support html in flash message
|
5
|
+
def bootstrap_flash_raw
|
6
|
+
flash_messages = []
|
7
|
+
|
8
|
+
flash.each do |type, message|
|
9
|
+
flash.delete(type)
|
10
|
+
|
11
|
+
# Skip Devise :timeout and :timedout flags
|
12
|
+
next if type == :timeout
|
13
|
+
next if type == :timedout
|
14
|
+
|
15
|
+
content = type.to_s == "filter" ? "" : content_tag(:button, raw("×"), :class => "close", "data-dismiss" => "alert")
|
16
|
+
type = :success if ["notice", "filter"].include? type.to_s
|
17
|
+
type = :danger if ["alert", "error", "recaptcha_error"].include? type.to_s
|
18
|
+
content += raw(message)
|
19
|
+
text = content_tag(:div, content, :class => "alert fade in alert-#{type}")
|
20
|
+
flash_messages << text if message
|
21
|
+
end
|
22
|
+
|
23
|
+
flash_messages.join("\n").html_safe
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module HomePage
|
2
|
+
module LayoutHelper
|
3
|
+
def breadcrumbs
|
4
|
+
result = render_navigation context: application_navigation, renderer: :breadcrumbs_without_method_links, join_with: ' > '
|
5
|
+
result = result && result.scan('<a').length > 1 ? result : ''
|
6
|
+
|
7
|
+
if respond_to?(:resource) && resource.respond_to?(:ancestors)
|
8
|
+
breadcrumbs_with_ancestors(result)
|
9
|
+
else
|
10
|
+
result
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def breadcrumbs_with_ancestors(links)
|
15
|
+
links = links.split(' > ')
|
16
|
+
current_resource_link = links.pop
|
17
|
+
links += resource.ancestors.map {|ancestor| link_to ancestor.name, ancestor }
|
18
|
+
links << current_resource_link
|
19
|
+
raw links.join(' > ')
|
20
|
+
end
|
21
|
+
|
22
|
+
def sidenav(links_count = 2)
|
23
|
+
links_count ||= 2
|
24
|
+
result = render_navigation context: application_navigation, renderer: :twitter_sidenav, level: @twitter_sidenav_level
|
25
|
+
|
26
|
+
result && result.scan('<a').length >= links_count ? result : ''
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/app/models/user.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
validates :name, presence: true, uniqueness: true
|
3
|
+
validates :first_name, presence: true
|
4
|
+
validates :last_name, presence: true
|
5
|
+
|
6
|
+
devise :database_authenticatable, :registerable,
|
7
|
+
:recoverable, :rememberable, :trackable, :validatable,
|
8
|
+
:confirmable, :lockable
|
9
|
+
|
10
|
+
extend FriendlyId
|
11
|
+
|
12
|
+
friendly_id :name, use: :slugged
|
13
|
+
|
14
|
+
attr_accessible :name, :password, :password_confirmation, :remember_me, :first_name, :last_name, :email
|
15
|
+
|
16
|
+
before_create do |user|
|
17
|
+
user.skip_confirmation_notification!
|
18
|
+
user.confirmation_sent_at = nil
|
19
|
+
end
|
20
|
+
end
|
File without changes
|
@@ -0,0 +1,56 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
+
<title><%= (yield(:title).blank? ? '' : yield(:title) + ' - ') + t('general.site.title') %></title>
|
8
|
+
<%= stylesheet_link_tag 'home_page/application', media: 'all' %>
|
9
|
+
<%= csrf_meta_tags %>
|
10
|
+
<link href="images/apple-touch-icon-144x144.png" rel="apple-touch-icon-precomposed" sizes="144x144"/>
|
11
|
+
<link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon-precomposed" sizes="114x114"/>
|
12
|
+
<link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon-precomposed" sizes="72x72"/>
|
13
|
+
<link href="images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"/>
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<div class="navbar navbar-inverse navbar-fixed-top">
|
17
|
+
<div class="container">
|
18
|
+
<div class="navbar-header">
|
19
|
+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
20
|
+
<span class="icon-bar"></span>
|
21
|
+
<span class="icon-bar"></span>
|
22
|
+
<span class="icon-bar"></span>
|
23
|
+
</button>
|
24
|
+
<a class="navbar-brand" href="#"><%= t('general.site.title') %></a>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<%= render_navigation context: :main, expand_all: false, renderer: :bootstrap %>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class="container">
|
32
|
+
<div id="flash">
|
33
|
+
<%= bootstrap_flash_raw %>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div class="content">
|
37
|
+
<% if content_for?(:title) %>
|
38
|
+
<div class="row">
|
39
|
+
<div class="col-md-12">
|
40
|
+
<div class="page-header">
|
41
|
+
<h2 id="title"><%= yield :title %></h2>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
<% end %>
|
46
|
+
<div class="row">
|
47
|
+
<div class="col-md-12">
|
48
|
+
<%= yield %>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
<%= javascript_include_tag 'home_page/application' %>
|
55
|
+
</body>
|
56
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= simple_form_for(
|
2
|
+
resource, url: resource.new_record? ? registration_path(resource_name) : user_path(resource),
|
3
|
+
method: resource.new_record? ? :post : :put, wrapper: :horizontal_form,
|
4
|
+
html: { class: 'form-horizontal', autocomplete: 'off' }
|
5
|
+
) do |f| %>
|
6
|
+
<%= devise_error_messages! %>
|
7
|
+
|
8
|
+
<%= f.input :name %>
|
9
|
+
<%= f.input :first_name %>
|
10
|
+
<%= f.input :last_name %>
|
11
|
+
<%= f.input :email %>
|
12
|
+
<%= f.input :password %>
|
13
|
+
<%= f.input :password_confirmation %>
|
14
|
+
|
15
|
+
<div class="form-group">
|
16
|
+
<div class="col-sm-offset-3 col-sm-9">
|
17
|
+
<%= recaptcha_tags if resource.new_record? && (Rails.env == 'production' || Rails.env == 'development') %>
|
18
|
+
<br/>
|
19
|
+
<%= f.button :submit %>
|
20
|
+
<br/>
|
21
|
+
<br/>
|
22
|
+
<%= render 'devise/shared/links' if resource.new_record? %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<table class='table table-striped'>
|
2
|
+
<thead>
|
3
|
+
<tr class='<%= cycle('odd', 'even') %>'>
|
4
|
+
<th><%= t('activerecord.attributes.user.name') %></th>
|
5
|
+
<th><%= t('activerecord.attributes.user.first_name') %></th>
|
6
|
+
<th><%= t('activerecord.attributes.user.last_name') %></th>
|
7
|
+
<th></th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<% @users.each do |user| %>
|
12
|
+
<tr class='<%= cycle('odd', 'even') %>'>
|
13
|
+
<td><%= link_to user.name, edit_user_path(user) %></td>
|
14
|
+
<td><%= user.first_name %></td>
|
15
|
+
<td><%= user.last_name %></td>
|
16
|
+
<td>
|
17
|
+
<div class="dropdown">
|
18
|
+
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><%= t('general.actions') %></a>
|
19
|
+
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
|
20
|
+
<li>
|
21
|
+
<%= link_to(
|
22
|
+
t('general.destroy'), user_path(user.id), id: "user_#{user.id}", method: :delete,
|
23
|
+
data: { confirm: t('general.questions.are_you_sure') },
|
24
|
+
onclick: "delete_link('user_#{user.id}'); return false;"
|
25
|
+
) %>
|
26
|
+
</li>
|
27
|
+
<li><%= link_to t('general.edit'), eval("edit_user_path(user)") %></li>
|
28
|
+
</ul>
|
29
|
+
</div>
|
30
|
+
</td>
|
31
|
+
</tr>
|
32
|
+
<% end %>
|
33
|
+
</tbody>
|
34
|
+
</table>
|
@@ -0,0 +1,259 @@
|
|
1
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
2
|
+
# Many of these configuration options can be set straight in your model.
|
3
|
+
Devise.setup do |config|
|
4
|
+
# The secret key used by Devise. Devise uses this key to generate
|
5
|
+
# random tokens. Changing this key will render invalid all existing
|
6
|
+
# confirmation, reset password and unlock tokens in the database.
|
7
|
+
# config.secret_key = 'ebf33b28fd1e692ac88707837b0c81c087850dac8d365b5b647ac549ddcae2b68c513017b8f7b114e06102778d547ed14b016a26dd7442435539552c6a07dffe'
|
8
|
+
|
9
|
+
# ==> Mailer Configuration
|
10
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
11
|
+
# note that it will be overwritten if you use your own mailer class
|
12
|
+
# with default "from" parameter.
|
13
|
+
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
14
|
+
|
15
|
+
# Configure the class responsible to send e-mails.
|
16
|
+
# config.mailer = 'Devise::Mailer'
|
17
|
+
|
18
|
+
# ==> ORM configuration
|
19
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
20
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
21
|
+
# available as additional gems.
|
22
|
+
require 'devise/orm/active_record'
|
23
|
+
|
24
|
+
# ==> Configuration for any authentication mechanism
|
25
|
+
# Configure which keys are used when authenticating a user. The default is
|
26
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
27
|
+
# authenticating a user, both parameters are required. Remember that those
|
28
|
+
# parameters are used only when authenticating and not when retrieving from
|
29
|
+
# session. If you need permissions, you should implement that in a before filter.
|
30
|
+
# You can also supply a hash where the value is a boolean determining whether
|
31
|
+
# or not authentication should be aborted when the value is not present.
|
32
|
+
# config.authentication_keys = [ :email ]
|
33
|
+
|
34
|
+
# Configure parameters from the request object used for authentication. Each entry
|
35
|
+
# given should be a request method and it will automatically be passed to the
|
36
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
37
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
38
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
39
|
+
# config.request_keys = []
|
40
|
+
|
41
|
+
# Configure which authentication keys should be case-insensitive.
|
42
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
43
|
+
# to authenticate or find a user. Default is :email.
|
44
|
+
config.case_insensitive_keys = [ :email ]
|
45
|
+
|
46
|
+
# Configure which authentication keys should have whitespace stripped.
|
47
|
+
# These keys will have whitespace before and after removed upon creating or
|
48
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
49
|
+
config.strip_whitespace_keys = [ :email ]
|
50
|
+
|
51
|
+
# Tell if authentication through request.params is enabled. True by default.
|
52
|
+
# It can be set to an array that will enable params authentication only for the
|
53
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
54
|
+
# enable it only for database (email + password) authentication.
|
55
|
+
# config.params_authenticatable = true
|
56
|
+
|
57
|
+
# Tell if authentication through HTTP Auth is enabled. False by default.
|
58
|
+
# It can be set to an array that will enable http authentication only for the
|
59
|
+
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
60
|
+
# enable it only for database authentication. The supported strategies are:
|
61
|
+
# :database = Support basic authentication with authentication key + password
|
62
|
+
# config.http_authenticatable = false
|
63
|
+
|
64
|
+
# If 401 status code should be returned for AJAX requests. True by default.
|
65
|
+
# config.http_authenticatable_on_xhr = true
|
66
|
+
|
67
|
+
# The realm used in Http Basic Authentication. 'Application' by default.
|
68
|
+
# config.http_authentication_realm = 'Application'
|
69
|
+
|
70
|
+
# It will change confirmation, password recovery and other workflows
|
71
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
72
|
+
# Does not affect registerable.
|
73
|
+
# config.paranoid = true
|
74
|
+
|
75
|
+
# By default Devise will store the user in session. You can skip storage for
|
76
|
+
# particular strategies by setting this option.
|
77
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
78
|
+
# may want to disable generating routes to Devise's sessions controller by
|
79
|
+
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
80
|
+
config.skip_session_storage = [:http_auth]
|
81
|
+
|
82
|
+
# By default, Devise cleans up the CSRF token on authentication to
|
83
|
+
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
84
|
+
# requests for sign in and sign up, you need to get a new CSRF token
|
85
|
+
# from the server. You can disable this option at your own risk.
|
86
|
+
# config.clean_up_csrf_token_on_authentication = true
|
87
|
+
|
88
|
+
# ==> Configuration for :database_authenticatable
|
89
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
90
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
91
|
+
#
|
92
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
93
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
94
|
+
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
95
|
+
# encryptor), the cost increases exponentially with the number of stretches (e.g.
|
96
|
+
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
97
|
+
config.stretches = Rails.env.test? ? 1 : 10
|
98
|
+
|
99
|
+
# Setup a pepper to generate the encrypted password.
|
100
|
+
# config.pepper = 'a48d02be2cbed502fb11d5229a87d994e2ed8932abec7c6e1d5d5fe0f33953f1b62f1dd40ee7acf7dad6ad020f6f8486c5e99aaa4eafb06f53f57cad0014023d'
|
101
|
+
|
102
|
+
# ==> Configuration for :confirmable
|
103
|
+
# A period that the user is allowed to access the website even without
|
104
|
+
# confirming their account. For instance, if set to 2.days, the user will be
|
105
|
+
# able to access the website for two days without confirming their account,
|
106
|
+
# access will be blocked just in the third day. Default is 0.days, meaning
|
107
|
+
# the user cannot access the website without confirming their account.
|
108
|
+
# config.allow_unconfirmed_access_for = 2.days
|
109
|
+
|
110
|
+
# A period that the user is allowed to confirm their account before their
|
111
|
+
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
112
|
+
# their account within 3 days after the mail was sent, but on the fourth day
|
113
|
+
# their account can't be confirmed with the token any more.
|
114
|
+
# Default is nil, meaning there is no restriction on how long a user can take
|
115
|
+
# before confirming their account.
|
116
|
+
# config.confirm_within = 3.days
|
117
|
+
|
118
|
+
# If true, requires any email changes to be confirmed (exactly the same way as
|
119
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
120
|
+
# db field (see migrations). Until confirmed, new email is stored in
|
121
|
+
# unconfirmed_email column, and copied to email column on successful confirmation.
|
122
|
+
config.reconfirmable = true
|
123
|
+
|
124
|
+
# Defines which key will be used when confirming an account
|
125
|
+
# config.confirmation_keys = [ :email ]
|
126
|
+
|
127
|
+
# ==> Configuration for :rememberable
|
128
|
+
# The time the user will be remembered without asking for credentials again.
|
129
|
+
# config.remember_for = 2.weeks
|
130
|
+
|
131
|
+
# Invalidates all the remember me tokens when the user signs out.
|
132
|
+
config.expire_all_remember_me_on_sign_out = true
|
133
|
+
|
134
|
+
# If true, extends the user's remember period when remembered via cookie.
|
135
|
+
# config.extend_remember_period = false
|
136
|
+
|
137
|
+
# Options to be passed to the created cookie. For instance, you can set
|
138
|
+
# secure: true in order to force SSL only cookies.
|
139
|
+
# config.rememberable_options = {}
|
140
|
+
|
141
|
+
# ==> Configuration for :validatable
|
142
|
+
# Range for password length.
|
143
|
+
config.password_length = 8..128
|
144
|
+
|
145
|
+
# Email regex used to validate email formats. It simply asserts that
|
146
|
+
# one (and only one) @ exists in the given string. This is mainly
|
147
|
+
# to give user feedback and not to assert the e-mail validity.
|
148
|
+
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
149
|
+
|
150
|
+
# ==> Configuration for :timeoutable
|
151
|
+
# The time you want to timeout the user session without activity. After this
|
152
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
153
|
+
# config.timeout_in = 30.minutes
|
154
|
+
|
155
|
+
# If true, expires auth token on session timeout.
|
156
|
+
# config.expire_auth_token_on_timeout = false
|
157
|
+
|
158
|
+
# ==> Configuration for :lockable
|
159
|
+
# Defines which strategy will be used to lock an account.
|
160
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
161
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
162
|
+
# config.lock_strategy = :failed_attempts
|
163
|
+
|
164
|
+
# Defines which key will be used when locking and unlocking an account
|
165
|
+
# config.unlock_keys = [ :email ]
|
166
|
+
|
167
|
+
# Defines which strategy will be used to unlock an account.
|
168
|
+
# :email = Sends an unlock link to the user email
|
169
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
170
|
+
# :both = Enables both strategies
|
171
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
172
|
+
# config.unlock_strategy = :both
|
173
|
+
|
174
|
+
# Number of authentication tries before locking an account if lock_strategy
|
175
|
+
# is failed attempts.
|
176
|
+
# config.maximum_attempts = 20
|
177
|
+
|
178
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
179
|
+
# config.unlock_in = 1.hour
|
180
|
+
|
181
|
+
# Warn on the last attempt before the account is locked.
|
182
|
+
# config.last_attempt_warning = true
|
183
|
+
|
184
|
+
# ==> Configuration for :recoverable
|
185
|
+
#
|
186
|
+
# Defines which key will be used when recovering the password for an account
|
187
|
+
# config.reset_password_keys = [ :email ]
|
188
|
+
|
189
|
+
# Time interval you can reset your password with a reset password key.
|
190
|
+
# Don't put a too small interval or your users won't have the time to
|
191
|
+
# change their passwords.
|
192
|
+
config.reset_password_within = 6.hours
|
193
|
+
|
194
|
+
# ==> Configuration for :encryptable
|
195
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
196
|
+
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
197
|
+
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
198
|
+
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
199
|
+
# REST_AUTH_SITE_KEY to pepper).
|
200
|
+
#
|
201
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
202
|
+
# config.encryptor = :sha512
|
203
|
+
|
204
|
+
# ==> Scopes configuration
|
205
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
206
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
207
|
+
# are using only default views.
|
208
|
+
# config.scoped_views = false
|
209
|
+
|
210
|
+
# Configure the default scope given to Warden. By default it's the first
|
211
|
+
# devise role declared in your routes (usually :user).
|
212
|
+
# config.default_scope = :user
|
213
|
+
|
214
|
+
# Set this configuration to false if you want /users/sign_out to sign out
|
215
|
+
# only the current scope. By default, Devise signs out all scopes.
|
216
|
+
# config.sign_out_all_scopes = true
|
217
|
+
|
218
|
+
# ==> Navigation configuration
|
219
|
+
# Lists the formats that should be treated as navigational. Formats like
|
220
|
+
# :html, should redirect to the sign in page when the user does not have
|
221
|
+
# access, but formats like :xml or :json, should return 401.
|
222
|
+
#
|
223
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
224
|
+
# should add them to the navigational formats lists.
|
225
|
+
#
|
226
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
227
|
+
# config.navigational_formats = ['*/*', :html]
|
228
|
+
|
229
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
230
|
+
config.sign_out_via = :delete
|
231
|
+
|
232
|
+
# ==> OmniAuth
|
233
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
234
|
+
# up on your models and hooks.
|
235
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
236
|
+
|
237
|
+
# ==> Warden configuration
|
238
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
239
|
+
# change the failure app, you can configure them inside the config.warden block.
|
240
|
+
#
|
241
|
+
# config.warden do |manager|
|
242
|
+
# manager.intercept_401 = false
|
243
|
+
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
244
|
+
# end
|
245
|
+
|
246
|
+
# ==> Mountable engine configurations
|
247
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
248
|
+
# is mountable, there are some extra configurations to be taken into account.
|
249
|
+
# The following options are available, assuming the engine is mounted as:
|
250
|
+
#
|
251
|
+
# mount MyEngine, at: '/my_engine'
|
252
|
+
#
|
253
|
+
# The router that invoked `devise_for`, in the example above, would be:
|
254
|
+
# config.router_name = :my_engine
|
255
|
+
#
|
256
|
+
# When using omniauth, Devise cannot automatically set Omniauth path,
|
257
|
+
# so you need to do it manually. For the users scope, it would be:
|
258
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
259
|
+
end
|