mtdevise 5.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -20
- data/README.md +90 -90
- data/Rakefile +33 -33
- data/app/assets/config/mtdevise_manifest.js +2 -2
- data/app/assets/javascripts/mtdevise/application.js +2 -2
- data/app/assets/stylesheets/mtdevise/application.scss +2 -2
- data/app/controllers/mtdevise/account/dashboard_controller.rb +14 -14
- data/app/controllers/mtdevise/account/users_controller.rb +32 -32
- data/app/controllers/mtdevise/accounts_controller.rb +63 -63
- data/app/controllers/mtdevise/application_controller.rb +63 -63
- data/app/controllers/mtdevise/dashboard_controller.rb +14 -14
- data/app/controllers/mtdevise/welcome_controller.rb +11 -11
- data/app/extenders/controllers/application_controller_extender.rb +8 -8
- data/app/extenders/mtdevise/constraints/subdomain_required.rb +11 -11
- data/app/helpers/mtdevise/application_helper.rb +24 -24
- data/app/jobs/mtdevise/application_job.rb +3 -3
- data/app/mailers/mtdevise/application_mailer.rb +7 -7
- data/app/models/concerns/mtdevise/user_storage.rb +12 -12
- data/app/models/mtdevise/account.rb +47 -47
- data/app/models/mtdevise/application_record.rb +4 -4
- data/app/models/mtdevise/member.rb +8 -8
- data/app/models/mtdevise/user.rb +18 -18
- data/app/views/devise/confirmations/new.html.erb +23 -23
- data/app/views/devise/mailer/confirmation_instructions.html.erb +2 -2
- data/app/views/devise/mailer/reset_password_instructions.html.erb +4 -4
- data/app/views/devise/mailer/unlock_instructions.html.erb +3 -3
- data/app/views/devise/passwords/edit.html.erb +28 -28
- data/app/views/devise/passwords/new.html.erb +23 -23
- data/app/views/devise/registrations/edit.html.erb +18 -18
- data/app/views/devise/registrations/new.html.erb +31 -31
- data/app/views/devise/sessions/new.html.erb +31 -31
- data/app/views/devise/shared/_links.html.erb +21 -21
- data/app/views/devise/unlocks/new.html.erb +25 -25
- data/app/views/layouts/mtdevise/accounts.html.erb +15 -15
- data/app/views/layouts/mtdevise/accountsindex.html.erb +15 -15
- data/app/views/layouts/mtdevise/application.html.erb +15 -15
- data/app/views/layouts/mtdevise/dashboard.html.erb +16 -16
- data/app/views/layouts/mtdevise/signin.html.erb +15 -15
- data/app/views/layouts/mtdevise/signup.html.erb +15 -15
- data/app/views/layouts/mtdevise/useredit.html.erb +15 -15
- data/app/views/layouts/mtdevise/welcome.html.erb +15 -15
- data/app/views/mtdevise/account/dashboard/index.html.erb +1 -1
- data/app/views/mtdevise/account/sessions/new.html.erb +15 -15
- data/app/views/mtdevise/account/users/_form.html.erb +11 -11
- data/app/views/mtdevise/account/users/new.html.erb +5 -5
- data/app/views/mtdevise/accounts/index.html.erb +30 -30
- data/app/views/mtdevise/accounts/new.html.erb +80 -80
- data/app/views/mtdevise/dashboard/index.html.erb +1 -1
- data/app/views/mtdevise/welcome/index.html.erb +18 -18
- data/app/views/shared/_flash.html.erb +10 -10
- data/app/views/shared/_header.html.erb +19 -19
- data/app/views/shared/_validation.html.erb +10 -10
- data/config/initializers/assets.rb +2 -2
- data/config/initializers/devise.rb +279 -279
- data/config/initializers/devise/strategies/subdomain.rb +26 -26
- data/config/locales/devise.en.yml +60 -60
- data/config/routes.rb +22 -22
- data/db/migrate/20150426071228_create_mtdevise_accounts.rb +11 -11
- data/db/migrate/20150426115631_add_owner_id_to_mtdevise_accounts.rb +7 -7
- data/db/migrate/20150426115910_create_mtdevise_users.rb +12 -12
- data/db/migrate/20150426143800_add_devise_to_mtdevise_users.rb +50 -50
- data/db/migrate/20150427200506_add_subdomain_to_mtdevise_accounts.rb +8 -8
- data/db/migrate/20150428110406_create_mtdevise_members.rb +12 -12
- data/db/migrate/20150504181830_add_confirmed_at_to_users.rb +10 -10
- data/db/migrate/20150719125100_add_authentication_token_to_mtdevise_users.rb +8 -8
- data/db/migrate/20151231043439_add_firstname_to_mtdevise_accounts.rb +9 -9
- data/lib/generators/mtdevise/views_generator.rb +60 -60
- data/lib/mtdevise.rb +4 -4
- data/lib/mtdevise/active_record_extensions.rb +15 -15
- data/lib/mtdevise/engine.rb +51 -51
- data/lib/mtdevise/scoped_to.rb +9 -9
- data/lib/mtdevise/version.rb +3 -3
- data/lib/tasks/mtdevise_tasks.rake +4 -4
- data/lib/templates/erb/scaffold/_form.html.erb +15 -15
- metadata +50 -8
@@ -1,2 +1,2 @@
|
|
1
|
-
<%= link_to 'New User?', mtdevise.user_sign_up_path %>
|
1
|
+
<%= link_to 'New User?', mtdevise.user_sign_up_path %>
|
2
2
|
<h4>Welcome</h4>
|
@@ -1,19 +1,19 @@
|
|
1
|
-
<div class="container">
|
2
|
-
<div class="header">
|
3
|
-
<nav>
|
4
|
-
<ul class="nav nav-pills pull-right">
|
5
|
-
</ul>
|
6
|
-
</nav>
|
7
|
-
<h3 class="text-muted">mtdevise</h3>
|
8
|
-
</div>
|
9
|
-
<div class="jumbotron">
|
10
|
-
<h1>Multitenancy Engine</h1>
|
11
|
-
<p><%= link_to "Sign Up Today", mtdevise.sign_up_path, role: 'button', class: 'btn btn-lg btn-success', 'data-no-turbolink' => 'true' %></p>
|
12
|
-
<p></p>
|
13
|
-
</div>
|
14
|
-
<p class="text-center">
|
15
|
-
Already have an Account? Login Below.
|
16
|
-
<%= link_to "Sign In To Manage Your Accounts", mtdevise.new_user_session_path, class: 'text-center center-block', 'data-no-turbolink' => 'true' %>
|
17
|
-
</p>
|
18
|
-
<footer class="footer"><p>Opensourced PHCNetworks 2015-2016</p></footer>
|
1
|
+
<div class="container">
|
2
|
+
<div class="header">
|
3
|
+
<nav>
|
4
|
+
<ul class="nav nav-pills pull-right">
|
5
|
+
</ul>
|
6
|
+
</nav>
|
7
|
+
<h3 class="text-muted">mtdevise</h3>
|
8
|
+
</div>
|
9
|
+
<div class="jumbotron">
|
10
|
+
<h1>Multitenancy Engine</h1>
|
11
|
+
<p><%= link_to "Sign Up Today", mtdevise.sign_up_path, role: 'button', class: 'btn btn-lg btn-success', 'data-no-turbolink' => 'true' %></p>
|
12
|
+
<p></p>
|
13
|
+
</div>
|
14
|
+
<p class="text-center">
|
15
|
+
Already have an Account? Login Below.
|
16
|
+
<%= link_to "Sign In To Manage Your Accounts", mtdevise.new_user_session_path, class: 'text-center center-block', 'data-no-turbolink' => 'true' %>
|
17
|
+
</p>
|
18
|
+
<footer class="footer"><p>Opensourced PHCNetworks 2015-2016</p></footer>
|
19
19
|
</div>
|
@@ -1,11 +1,11 @@
|
|
1
|
-
<div class="container">
|
2
|
-
<div class="alert alert-dismissible alert-warning hidden alert-please-update" role="alert">
|
3
|
-
<button aria-label="Close" class="close" data-dismiss="alert" type="button"><span aria-hidden="true"> ×</span></button><strong>Please update</strong>Despite the fact that the record doens't show on your screen you must save it to delete it!
|
4
|
-
</div>
|
5
|
-
<% flash.each do |key, value| %>
|
6
|
-
<div class="<%= flash_class(key) %> fade in">
|
7
|
-
<a href="#" data-dismiss="alert" class="close">×</a>
|
8
|
-
<%= value %>
|
9
|
-
</div>
|
10
|
-
<% end %>
|
1
|
+
<div class="container">
|
2
|
+
<div class="alert alert-dismissible alert-warning hidden alert-please-update" role="alert">
|
3
|
+
<button aria-label="Close" class="close" data-dismiss="alert" type="button"><span aria-hidden="true"> ×</span></button><strong>Please update</strong>Despite the fact that the record doens't show on your screen you must save it to delete it!
|
4
|
+
</div>
|
5
|
+
<% flash.each do |key, value| %>
|
6
|
+
<div class="<%= flash_class(key) %> fade in">
|
7
|
+
<a href="#" data-dismiss="alert" class="close">×</a>
|
8
|
+
<%= value %>
|
9
|
+
</div>
|
10
|
+
<% end %>
|
11
11
|
</div>
|
@@ -1,20 +1,20 @@
|
|
1
|
-
<nav class="navbar navbar-default navbar-fixed-top">
|
2
|
-
<div class="container">
|
3
|
-
<div class="navbar-header"><%= link_to 'mtdevise', account_root_path, class: 'navbar-brand' %>
|
4
|
-
</div>
|
5
|
-
<div class="collapse navbar-collapse">
|
6
|
-
<ul class="dropdown-menu nav navbar-nav navbar-right">
|
7
|
-
<li>
|
8
|
-
<a aria-expanded="false" class="dropdown-toggle" data-toggle="dropdown" href="#" role="button">Settings<span class="caret"></span></a>
|
9
|
-
<%- if user_signed_in? %>
|
10
|
-
<ul class="dropdown-menu" role="menu">
|
11
|
-
<li>Signed in as <%= current_user.email %></li>
|
12
|
-
<li class="divider"></li>
|
13
|
-
<li><%= link_to 'Log out', destroy_user_session_path, method: :delete %></li>
|
14
|
-
</ul>
|
15
|
-
<% end %>
|
16
|
-
</li>
|
17
|
-
</ul>
|
18
|
-
</div>
|
19
|
-
</div>
|
1
|
+
<nav class="navbar navbar-default navbar-fixed-top">
|
2
|
+
<div class="container">
|
3
|
+
<div class="navbar-header"><%= link_to 'mtdevise', account_root_path, class: 'navbar-brand' %>
|
4
|
+
</div>
|
5
|
+
<div class="collapse navbar-collapse">
|
6
|
+
<ul class="dropdown-menu nav navbar-nav navbar-right">
|
7
|
+
<li>
|
8
|
+
<a aria-expanded="false" class="dropdown-toggle" data-toggle="dropdown" href="#" role="button">Settings<span class="caret"></span></a>
|
9
|
+
<%- if user_signed_in? %>
|
10
|
+
<ul class="dropdown-menu" role="menu">
|
11
|
+
<li>Signed in as <%= current_user.email %></li>
|
12
|
+
<li class="divider"></li>
|
13
|
+
<li><%= link_to 'Log out', destroy_user_session_path, method: :delete %></li>
|
14
|
+
</ul>
|
15
|
+
<% end %>
|
16
|
+
</li>
|
17
|
+
</ul>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
20
|
</nav>
|
@@ -1,11 +1,11 @@
|
|
1
|
-
<% if object.errors.any? %>
|
2
|
-
<div class="alert alert-danger alert-dismissible" role="alert">
|
3
|
-
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
4
|
-
<strong>The form contains </strong> <%= pluralize(object.errors.count, "error") %> .
|
5
|
-
<ul class="list-group">
|
6
|
-
<% object.errors.full_messages.each do |msg| %>
|
7
|
-
<li><%= msg %></li>
|
8
|
-
<% end %>
|
9
|
-
</ul>
|
10
|
-
</div>
|
1
|
+
<% if object.errors.any? %>
|
2
|
+
<div class="alert alert-danger alert-dismissible" role="alert">
|
3
|
+
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
4
|
+
<strong>The form contains </strong> <%= pluralize(object.errors.count, "error") %> .
|
5
|
+
<ul class="list-group">
|
6
|
+
<% object.errors.full_messages.each do |msg| %>
|
7
|
+
<li><%= msg %></li>
|
8
|
+
<% end %>
|
9
|
+
</ul>
|
10
|
+
</div>
|
11
11
|
<% end %>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
Rails.application.config.assets.version = '1.0'
|
2
|
-
Rails.application.config.assets.precompile += %w( mtdevise/jumbotron-narrow.css mtdevise/non-responsive.css)
|
1
|
+
Rails.application.config.assets.version = '1.0'
|
2
|
+
Rails.application.config.assets.precompile += %w( mtdevise/jumbotron-narrow.css mtdevise/non-responsive.css)
|
@@ -1,279 +1,279 @@
|
|
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
|
-
config.parent_controller = 'Mtdevise::ApplicationController'
|
5
|
-
# The secret key used by Devise. Devise uses this key to generate
|
6
|
-
# random tokens. Changing this key will render invalid all existing
|
7
|
-
# confirmation, reset password and unlock tokens in the database.
|
8
|
-
# Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key`
|
9
|
-
# by default. You can change it below and use your own secret key.
|
10
|
-
# config.secret_key = '1debbc3132f8c5fbb648b82bf07c1116f4ea159c7e43434d7703ffd115b9a39f07a0f86db2a8f1bf3145ac2bacfa6a0cf4ca2ba1f2cb2185d74aeec882c10554'
|
11
|
-
|
12
|
-
# ==> Mailer Configuration
|
13
|
-
# Configure the e-mail address which will be shown in Devise::Mailer,
|
14
|
-
# note that it will be overwritten if you use your own mailer class
|
15
|
-
# with default "from" parameter.
|
16
|
-
config.mailer_sender = ENV["PHC_MTDEVISE_SENDER"]
|
17
|
-
|
18
|
-
# Configure the class responsible to send e-mails.
|
19
|
-
# config.mailer = 'Devise::Mailer'
|
20
|
-
|
21
|
-
# ==> ORM configuration
|
22
|
-
# Load and configure the ORM. Supports :active_record (default) and
|
23
|
-
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
24
|
-
# available as additional gems.
|
25
|
-
require 'devise/orm/active_record'
|
26
|
-
|
27
|
-
# ==> Configuration for any authentication mechanism
|
28
|
-
# Configure which keys are used when authenticating a user. The default is
|
29
|
-
# just :email. You can configure it to use [:username, :subdomain], so for
|
30
|
-
# authenticating a user, both parameters are required. Remember that those
|
31
|
-
# parameters are used only when authenticating and not when retrieving from
|
32
|
-
# session. If you need permissions, you should implement that in a before filter.
|
33
|
-
# You can also supply a hash where the value is a boolean determining whether
|
34
|
-
# or not authentication should be aborted when the value is not present.
|
35
|
-
# config.authentication_keys = [:email]
|
36
|
-
|
37
|
-
# Configure parameters from the request object used for authentication. Each entry
|
38
|
-
# given should be a request method and it will automatically be passed to the
|
39
|
-
# find_for_authentication method and considered in your model lookup. For instance,
|
40
|
-
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
41
|
-
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
42
|
-
# config.request_keys = []
|
43
|
-
|
44
|
-
# Configure which authentication keys should be case-insensitive.
|
45
|
-
# These keys will be downcased upon creating or modifying a user and when used
|
46
|
-
# to authenticate or find a user. Default is :email.
|
47
|
-
config.case_insensitive_keys = [:email]
|
48
|
-
|
49
|
-
# Configure which authentication keys should have whitespace stripped.
|
50
|
-
# These keys will have whitespace before and after removed upon creating or
|
51
|
-
# modifying a user and when used to authenticate or find a user. Default is :email.
|
52
|
-
config.strip_whitespace_keys = [:email]
|
53
|
-
|
54
|
-
# Tell if authentication through request.params is enabled. True by default.
|
55
|
-
# It can be set to an array that will enable params authentication only for the
|
56
|
-
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
57
|
-
# enable it only for database (email + password) authentication.
|
58
|
-
# config.params_authenticatable = true
|
59
|
-
|
60
|
-
# Tell if authentication through HTTP Auth is enabled. False by default.
|
61
|
-
# It can be set to an array that will enable http authentication only for the
|
62
|
-
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
63
|
-
# enable it only for database authentication. The supported strategies are:
|
64
|
-
# :database = Support basic authentication with authentication key + password
|
65
|
-
# config.http_authenticatable = false
|
66
|
-
|
67
|
-
# If 401 status code should be returned for AJAX requests. True by default.
|
68
|
-
# config.http_authenticatable_on_xhr = true
|
69
|
-
|
70
|
-
# The realm used in Http Basic Authentication. 'Application' by default.
|
71
|
-
# config.http_authentication_realm = 'Application'
|
72
|
-
|
73
|
-
# It will change confirmation, password recovery and other workflows
|
74
|
-
# to behave the same regardless if the e-mail provided was right or wrong.
|
75
|
-
# Does not affect registerable.
|
76
|
-
# config.paranoid = true
|
77
|
-
|
78
|
-
# By default Devise will store the user in session. You can skip storage for
|
79
|
-
# particular strategies by setting this option.
|
80
|
-
# Notice that if you are skipping storage for all authentication paths, you
|
81
|
-
# may want to disable generating routes to Devise's sessions controller by
|
82
|
-
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
83
|
-
config.skip_session_storage = [:http_auth]
|
84
|
-
|
85
|
-
# By default, Devise cleans up the CSRF token on authentication to
|
86
|
-
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
87
|
-
# requests for sign in and sign up, you need to get a new CSRF token
|
88
|
-
# from the server. You can disable this option at your own risk.
|
89
|
-
# config.clean_up_csrf_token_on_authentication = true
|
90
|
-
|
91
|
-
# ==> Configuration for :database_authenticatable
|
92
|
-
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
93
|
-
# using other encryptors, it sets how many times you want the password re-encrypted.
|
94
|
-
#
|
95
|
-
# Limiting the stretches to just one in testing will increase the performance of
|
96
|
-
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
97
|
-
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
98
|
-
# encryptor), the cost increases exponentially with the number of stretches (e.g.
|
99
|
-
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
100
|
-
config.stretches = Rails.env.test? ? 1 : 10
|
101
|
-
|
102
|
-
# Setup a pepper to generate the encrypted password.
|
103
|
-
# config.pepper = '1355e6a23471bdd2eef16bb9f5673ca97d6745ec4951a0a058ee113451e788008e3f89b03a905d85e4224b94d60f1bb57b210a579e8d7116e414a475cdce19bc'
|
104
|
-
|
105
|
-
# ==> Configuration for :confirmable
|
106
|
-
# A period that the user is allowed to access the website even without
|
107
|
-
# confirming their account. For instance, if set to 2.days, the user will be
|
108
|
-
# able to access the website for two days without confirming their account,
|
109
|
-
# access will be blocked just in the third day. Default is 0.days, meaning
|
110
|
-
# the user cannot access the website without confirming their account.
|
111
|
-
# config.allow_unconfirmed_access_for = 2.days
|
112
|
-
|
113
|
-
# A period that the user is allowed to confirm their account before their
|
114
|
-
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
115
|
-
# their account within 3 days after the mail was sent, but on the fourth day
|
116
|
-
# their account can't be confirmed with the token any more.
|
117
|
-
# Default is nil, meaning there is no restriction on how long a user can take
|
118
|
-
# before confirming their account.
|
119
|
-
# config.confirm_within = 3.days
|
120
|
-
|
121
|
-
# If true, requires any email changes to be confirmed (exactly the same way as
|
122
|
-
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
123
|
-
# db field (see migrations). Until confirmed, new email is stored in
|
124
|
-
# unconfirmed_email column, and copied to email column on successful confirmation.
|
125
|
-
config.reconfirmable = true
|
126
|
-
|
127
|
-
# Defines which key will be used when confirming an account
|
128
|
-
# config.confirmation_keys = [:email]
|
129
|
-
|
130
|
-
# ==> Configuration for :rememberable
|
131
|
-
# The time the user will be remembered without asking for credentials again.
|
132
|
-
# config.remember_for = 2.weeks
|
133
|
-
|
134
|
-
# Invalidates all the remember me tokens when the user signs out.
|
135
|
-
config.expire_all_remember_me_on_sign_out = true
|
136
|
-
|
137
|
-
# If true, extends the user's remember period when remembered via cookie.
|
138
|
-
# config.extend_remember_period = false
|
139
|
-
|
140
|
-
# Options to be passed to the created cookie. For instance, you can set
|
141
|
-
# secure: true in order to force SSL only cookies.
|
142
|
-
# config.rememberable_options = {}
|
143
|
-
|
144
|
-
# ==> Configuration for :validatable
|
145
|
-
# Range for password length.
|
146
|
-
config.password_length = 8..72
|
147
|
-
|
148
|
-
# Email regex used to validate email formats. It simply asserts that
|
149
|
-
# one (and only one) @ exists in the given string. This is mainly
|
150
|
-
# to give user feedback and not to assert the e-mail validity.
|
151
|
-
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
152
|
-
|
153
|
-
# ==> Configuration for :timeoutable
|
154
|
-
# The time you want to timeout the user session without activity. After this
|
155
|
-
# time the user will be asked for credentials again. Default is 30 minutes.
|
156
|
-
# config.timeout_in = 30.minutes
|
157
|
-
|
158
|
-
# If true, expires auth token on session timeout.
|
159
|
-
# config.expire_auth_token_on_timeout = false
|
160
|
-
|
161
|
-
# ==> Configuration for :lockable
|
162
|
-
# Defines which strategy will be used to lock an account.
|
163
|
-
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
164
|
-
# :none = No lock strategy. You should handle locking by yourself.
|
165
|
-
# config.lock_strategy = :failed_attempts
|
166
|
-
|
167
|
-
# Defines which key will be used when locking and unlocking an account
|
168
|
-
# config.unlock_keys = [:email]
|
169
|
-
|
170
|
-
# Defines which strategy will be used to unlock an account.
|
171
|
-
# :email = Sends an unlock link to the user email
|
172
|
-
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
173
|
-
# :both = Enables both strategies
|
174
|
-
# :none = No unlock strategy. You should handle unlocking by yourself.
|
175
|
-
# config.unlock_strategy = :both
|
176
|
-
|
177
|
-
# Number of authentication tries before locking an account if lock_strategy
|
178
|
-
# is failed attempts.
|
179
|
-
# config.maximum_attempts = 20
|
180
|
-
|
181
|
-
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
182
|
-
# config.unlock_in = 1.hour
|
183
|
-
|
184
|
-
# Warn on the last attempt before the account is locked.
|
185
|
-
# config.last_attempt_warning = true
|
186
|
-
|
187
|
-
# ==> Configuration for :recoverable
|
188
|
-
#
|
189
|
-
# Defines which key will be used when recovering the password for an account
|
190
|
-
# config.reset_password_keys = [:email]
|
191
|
-
|
192
|
-
# Time interval you can reset your password with a reset password key.
|
193
|
-
# Don't put a too small interval or your users won't have the time to
|
194
|
-
# change their passwords.
|
195
|
-
config.reset_password_within = 6.hours
|
196
|
-
|
197
|
-
# When set to false, does not sign a user in automatically after their password is
|
198
|
-
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
199
|
-
# config.sign_in_after_reset_password = true
|
200
|
-
|
201
|
-
# ==> Configuration for :encryptable
|
202
|
-
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
203
|
-
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
204
|
-
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
205
|
-
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
206
|
-
# REST_AUTH_SITE_KEY to pepper).
|
207
|
-
#
|
208
|
-
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
209
|
-
# config.encryptor = :sha512
|
210
|
-
|
211
|
-
# ==> Scopes configuration
|
212
|
-
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
213
|
-
# "users/sessions/new". It's turned off by default because it's slower if you
|
214
|
-
# are using only default views.
|
215
|
-
# config.scoped_views = false
|
216
|
-
|
217
|
-
# Configure the default scope given to Warden. By default it's the first
|
218
|
-
# devise role declared in your routes (usually :user).
|
219
|
-
# config.default_scope = :user
|
220
|
-
|
221
|
-
# Set this configuration to false if you want /users/sign_out to sign out
|
222
|
-
# only the current scope. By default, Devise signs out all scopes.
|
223
|
-
# config.sign_out_all_scopes = true
|
224
|
-
|
225
|
-
# ==> Navigation configuration
|
226
|
-
# Lists the formats that should be treated as navigational. Formats like
|
227
|
-
# :html, should redirect to the sign in page when the user does not have
|
228
|
-
# access, but formats like :xml or :json, should return 401.
|
229
|
-
#
|
230
|
-
# If you have any extra navigational formats, like :iphone or :mobile, you
|
231
|
-
# should add them to the navigational formats lists.
|
232
|
-
#
|
233
|
-
# The "*/*" below is required to match Internet Explorer requests.
|
234
|
-
# config.navigational_formats = ['*/*', :html]
|
235
|
-
|
236
|
-
# The default HTTP method used to sign out a resource. Default is :delete.
|
237
|
-
# config.sign_out_via = :delete
|
238
|
-
|
239
|
-
# ==> OmniAuth
|
240
|
-
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
241
|
-
# up on your models and hooks.
|
242
|
-
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
243
|
-
|
244
|
-
# ==> Warden configuration
|
245
|
-
# If you want to use other strategies, that are not supported by Devise, or
|
246
|
-
# change the failure app, you can configure them inside the config.warden block.
|
247
|
-
#
|
248
|
-
# config.warden do |manager|
|
249
|
-
# manager.intercept_401 = false
|
250
|
-
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
251
|
-
# end
|
252
|
-
config.warden do |manager|
|
253
|
-
manager.default_strategies(scope: :user).unshift :subdomain_login
|
254
|
-
end
|
255
|
-
|
256
|
-
# ==> Mountable engine configurations
|
257
|
-
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
258
|
-
# is mountable, there are some extra configurations to be taken into account.
|
259
|
-
# The following options are available, assuming the engine is mounted as:
|
260
|
-
#
|
261
|
-
# mount MyEngine, at: '/my_engine'
|
262
|
-
#
|
263
|
-
# The router that invoked `devise_for`, in the example above, would be:
|
264
|
-
config.router_name = :mtdevise
|
265
|
-
#
|
266
|
-
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
267
|
-
# so you need to do it manually. For the users scope, it would be:
|
268
|
-
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
269
|
-
|
270
|
-
# Devise Custom Layouts
|
271
|
-
Rails.application.config.to_prepare do
|
272
|
-
Devise::SessionsController.layout proc{ |controller| action_name == 'new' ? "layouts/mtdevise/signin" : "layouts/mtdevise/accounts" }
|
273
|
-
Devise::RegistrationsController.layout proc{ |controller| user_signed_in? ? "layouts/mtdevise/useredit" : "layouts/mtdevise/accounts" }
|
274
|
-
Devise::ConfirmationsController.layout "layouts/mtdevise/accounts"
|
275
|
-
Devise::UnlocksController.layout "layouts/mtdevise/accounts"
|
276
|
-
Devise::PasswordsController.layout "layouts/mtdevise/accounts"
|
277
|
-
end
|
278
|
-
|
279
|
-
end
|
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
|
+
config.parent_controller = 'Mtdevise::ApplicationController'
|
5
|
+
# The secret key used by Devise. Devise uses this key to generate
|
6
|
+
# random tokens. Changing this key will render invalid all existing
|
7
|
+
# confirmation, reset password and unlock tokens in the database.
|
8
|
+
# Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key`
|
9
|
+
# by default. You can change it below and use your own secret key.
|
10
|
+
# config.secret_key = '1debbc3132f8c5fbb648b82bf07c1116f4ea159c7e43434d7703ffd115b9a39f07a0f86db2a8f1bf3145ac2bacfa6a0cf4ca2ba1f2cb2185d74aeec882c10554'
|
11
|
+
|
12
|
+
# ==> Mailer Configuration
|
13
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
14
|
+
# note that it will be overwritten if you use your own mailer class
|
15
|
+
# with default "from" parameter.
|
16
|
+
config.mailer_sender = ENV["PHC_MTDEVISE_SENDER"]
|
17
|
+
|
18
|
+
# Configure the class responsible to send e-mails.
|
19
|
+
# config.mailer = 'Devise::Mailer'
|
20
|
+
|
21
|
+
# ==> ORM configuration
|
22
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
23
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
24
|
+
# available as additional gems.
|
25
|
+
require 'devise/orm/active_record'
|
26
|
+
|
27
|
+
# ==> Configuration for any authentication mechanism
|
28
|
+
# Configure which keys are used when authenticating a user. The default is
|
29
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
30
|
+
# authenticating a user, both parameters are required. Remember that those
|
31
|
+
# parameters are used only when authenticating and not when retrieving from
|
32
|
+
# session. If you need permissions, you should implement that in a before filter.
|
33
|
+
# You can also supply a hash where the value is a boolean determining whether
|
34
|
+
# or not authentication should be aborted when the value is not present.
|
35
|
+
# config.authentication_keys = [:email]
|
36
|
+
|
37
|
+
# Configure parameters from the request object used for authentication. Each entry
|
38
|
+
# given should be a request method and it will automatically be passed to the
|
39
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
40
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
41
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
42
|
+
# config.request_keys = []
|
43
|
+
|
44
|
+
# Configure which authentication keys should be case-insensitive.
|
45
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
46
|
+
# to authenticate or find a user. Default is :email.
|
47
|
+
config.case_insensitive_keys = [:email]
|
48
|
+
|
49
|
+
# Configure which authentication keys should have whitespace stripped.
|
50
|
+
# These keys will have whitespace before and after removed upon creating or
|
51
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
52
|
+
config.strip_whitespace_keys = [:email]
|
53
|
+
|
54
|
+
# Tell if authentication through request.params is enabled. True by default.
|
55
|
+
# It can be set to an array that will enable params authentication only for the
|
56
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
57
|
+
# enable it only for database (email + password) authentication.
|
58
|
+
# config.params_authenticatable = true
|
59
|
+
|
60
|
+
# Tell if authentication through HTTP Auth is enabled. False by default.
|
61
|
+
# It can be set to an array that will enable http authentication only for the
|
62
|
+
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
63
|
+
# enable it only for database authentication. The supported strategies are:
|
64
|
+
# :database = Support basic authentication with authentication key + password
|
65
|
+
# config.http_authenticatable = false
|
66
|
+
|
67
|
+
# If 401 status code should be returned for AJAX requests. True by default.
|
68
|
+
# config.http_authenticatable_on_xhr = true
|
69
|
+
|
70
|
+
# The realm used in Http Basic Authentication. 'Application' by default.
|
71
|
+
# config.http_authentication_realm = 'Application'
|
72
|
+
|
73
|
+
# It will change confirmation, password recovery and other workflows
|
74
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
75
|
+
# Does not affect registerable.
|
76
|
+
# config.paranoid = true
|
77
|
+
|
78
|
+
# By default Devise will store the user in session. You can skip storage for
|
79
|
+
# particular strategies by setting this option.
|
80
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
81
|
+
# may want to disable generating routes to Devise's sessions controller by
|
82
|
+
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
83
|
+
config.skip_session_storage = [:http_auth]
|
84
|
+
|
85
|
+
# By default, Devise cleans up the CSRF token on authentication to
|
86
|
+
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
87
|
+
# requests for sign in and sign up, you need to get a new CSRF token
|
88
|
+
# from the server. You can disable this option at your own risk.
|
89
|
+
# config.clean_up_csrf_token_on_authentication = true
|
90
|
+
|
91
|
+
# ==> Configuration for :database_authenticatable
|
92
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
93
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
94
|
+
#
|
95
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
96
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
97
|
+
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
98
|
+
# encryptor), the cost increases exponentially with the number of stretches (e.g.
|
99
|
+
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
100
|
+
config.stretches = Rails.env.test? ? 1 : 10
|
101
|
+
|
102
|
+
# Setup a pepper to generate the encrypted password.
|
103
|
+
# config.pepper = '1355e6a23471bdd2eef16bb9f5673ca97d6745ec4951a0a058ee113451e788008e3f89b03a905d85e4224b94d60f1bb57b210a579e8d7116e414a475cdce19bc'
|
104
|
+
|
105
|
+
# ==> Configuration for :confirmable
|
106
|
+
# A period that the user is allowed to access the website even without
|
107
|
+
# confirming their account. For instance, if set to 2.days, the user will be
|
108
|
+
# able to access the website for two days without confirming their account,
|
109
|
+
# access will be blocked just in the third day. Default is 0.days, meaning
|
110
|
+
# the user cannot access the website without confirming their account.
|
111
|
+
# config.allow_unconfirmed_access_for = 2.days
|
112
|
+
|
113
|
+
# A period that the user is allowed to confirm their account before their
|
114
|
+
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
115
|
+
# their account within 3 days after the mail was sent, but on the fourth day
|
116
|
+
# their account can't be confirmed with the token any more.
|
117
|
+
# Default is nil, meaning there is no restriction on how long a user can take
|
118
|
+
# before confirming their account.
|
119
|
+
# config.confirm_within = 3.days
|
120
|
+
|
121
|
+
# If true, requires any email changes to be confirmed (exactly the same way as
|
122
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
123
|
+
# db field (see migrations). Until confirmed, new email is stored in
|
124
|
+
# unconfirmed_email column, and copied to email column on successful confirmation.
|
125
|
+
config.reconfirmable = true
|
126
|
+
|
127
|
+
# Defines which key will be used when confirming an account
|
128
|
+
# config.confirmation_keys = [:email]
|
129
|
+
|
130
|
+
# ==> Configuration for :rememberable
|
131
|
+
# The time the user will be remembered without asking for credentials again.
|
132
|
+
# config.remember_for = 2.weeks
|
133
|
+
|
134
|
+
# Invalidates all the remember me tokens when the user signs out.
|
135
|
+
config.expire_all_remember_me_on_sign_out = true
|
136
|
+
|
137
|
+
# If true, extends the user's remember period when remembered via cookie.
|
138
|
+
# config.extend_remember_period = false
|
139
|
+
|
140
|
+
# Options to be passed to the created cookie. For instance, you can set
|
141
|
+
# secure: true in order to force SSL only cookies.
|
142
|
+
# config.rememberable_options = {}
|
143
|
+
|
144
|
+
# ==> Configuration for :validatable
|
145
|
+
# Range for password length.
|
146
|
+
config.password_length = 8..72
|
147
|
+
|
148
|
+
# Email regex used to validate email formats. It simply asserts that
|
149
|
+
# one (and only one) @ exists in the given string. This is mainly
|
150
|
+
# to give user feedback and not to assert the e-mail validity.
|
151
|
+
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
152
|
+
|
153
|
+
# ==> Configuration for :timeoutable
|
154
|
+
# The time you want to timeout the user session without activity. After this
|
155
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
156
|
+
# config.timeout_in = 30.minutes
|
157
|
+
|
158
|
+
# If true, expires auth token on session timeout.
|
159
|
+
# config.expire_auth_token_on_timeout = false
|
160
|
+
|
161
|
+
# ==> Configuration for :lockable
|
162
|
+
# Defines which strategy will be used to lock an account.
|
163
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
164
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
165
|
+
# config.lock_strategy = :failed_attempts
|
166
|
+
|
167
|
+
# Defines which key will be used when locking and unlocking an account
|
168
|
+
# config.unlock_keys = [:email]
|
169
|
+
|
170
|
+
# Defines which strategy will be used to unlock an account.
|
171
|
+
# :email = Sends an unlock link to the user email
|
172
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
173
|
+
# :both = Enables both strategies
|
174
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
175
|
+
# config.unlock_strategy = :both
|
176
|
+
|
177
|
+
# Number of authentication tries before locking an account if lock_strategy
|
178
|
+
# is failed attempts.
|
179
|
+
# config.maximum_attempts = 20
|
180
|
+
|
181
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
182
|
+
# config.unlock_in = 1.hour
|
183
|
+
|
184
|
+
# Warn on the last attempt before the account is locked.
|
185
|
+
# config.last_attempt_warning = true
|
186
|
+
|
187
|
+
# ==> Configuration for :recoverable
|
188
|
+
#
|
189
|
+
# Defines which key will be used when recovering the password for an account
|
190
|
+
# config.reset_password_keys = [:email]
|
191
|
+
|
192
|
+
# Time interval you can reset your password with a reset password key.
|
193
|
+
# Don't put a too small interval or your users won't have the time to
|
194
|
+
# change their passwords.
|
195
|
+
config.reset_password_within = 6.hours
|
196
|
+
|
197
|
+
# When set to false, does not sign a user in automatically after their password is
|
198
|
+
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
199
|
+
# config.sign_in_after_reset_password = true
|
200
|
+
|
201
|
+
# ==> Configuration for :encryptable
|
202
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
203
|
+
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
204
|
+
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
205
|
+
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
206
|
+
# REST_AUTH_SITE_KEY to pepper).
|
207
|
+
#
|
208
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
209
|
+
# config.encryptor = :sha512
|
210
|
+
|
211
|
+
# ==> Scopes configuration
|
212
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
213
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
214
|
+
# are using only default views.
|
215
|
+
# config.scoped_views = false
|
216
|
+
|
217
|
+
# Configure the default scope given to Warden. By default it's the first
|
218
|
+
# devise role declared in your routes (usually :user).
|
219
|
+
# config.default_scope = :user
|
220
|
+
|
221
|
+
# Set this configuration to false if you want /users/sign_out to sign out
|
222
|
+
# only the current scope. By default, Devise signs out all scopes.
|
223
|
+
# config.sign_out_all_scopes = true
|
224
|
+
|
225
|
+
# ==> Navigation configuration
|
226
|
+
# Lists the formats that should be treated as navigational. Formats like
|
227
|
+
# :html, should redirect to the sign in page when the user does not have
|
228
|
+
# access, but formats like :xml or :json, should return 401.
|
229
|
+
#
|
230
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
231
|
+
# should add them to the navigational formats lists.
|
232
|
+
#
|
233
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
234
|
+
# config.navigational_formats = ['*/*', :html]
|
235
|
+
|
236
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
237
|
+
# config.sign_out_via = :delete
|
238
|
+
|
239
|
+
# ==> OmniAuth
|
240
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
241
|
+
# up on your models and hooks.
|
242
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
243
|
+
|
244
|
+
# ==> Warden configuration
|
245
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
246
|
+
# change the failure app, you can configure them inside the config.warden block.
|
247
|
+
#
|
248
|
+
# config.warden do |manager|
|
249
|
+
# manager.intercept_401 = false
|
250
|
+
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
251
|
+
# end
|
252
|
+
config.warden do |manager|
|
253
|
+
manager.default_strategies(scope: :user).unshift :subdomain_login
|
254
|
+
end
|
255
|
+
|
256
|
+
# ==> Mountable engine configurations
|
257
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
258
|
+
# is mountable, there are some extra configurations to be taken into account.
|
259
|
+
# The following options are available, assuming the engine is mounted as:
|
260
|
+
#
|
261
|
+
# mount MyEngine, at: '/my_engine'
|
262
|
+
#
|
263
|
+
# The router that invoked `devise_for`, in the example above, would be:
|
264
|
+
config.router_name = :mtdevise
|
265
|
+
#
|
266
|
+
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
267
|
+
# so you need to do it manually. For the users scope, it would be:
|
268
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
269
|
+
|
270
|
+
# Devise Custom Layouts
|
271
|
+
Rails.application.config.to_prepare do
|
272
|
+
Devise::SessionsController.layout proc{ |controller| action_name == 'new' ? "layouts/mtdevise/signin" : "layouts/mtdevise/accounts" }
|
273
|
+
Devise::RegistrationsController.layout proc{ |controller| user_signed_in? ? "layouts/mtdevise/useredit" : "layouts/mtdevise/accounts" }
|
274
|
+
Devise::ConfirmationsController.layout "layouts/mtdevise/accounts"
|
275
|
+
Devise::UnlocksController.layout "layouts/mtdevise/accounts"
|
276
|
+
Devise::PasswordsController.layout "layouts/mtdevise/accounts"
|
277
|
+
end
|
278
|
+
|
279
|
+
end
|