eac_users_support 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +33 -0
- data/app/assets/javascripts/eac_users_support/application.js +14 -0
- data/app/assets/stylesheets/eac_users_support/application.css +16 -0
- data/app/controllers/eac_users_support/admin/users_controller.rb +17 -0
- data/app/controllers/eac_users_support/application_controller.rb +4 -0
- data/app/controllers/eac_users_support/users_controller.rb +26 -0
- data/app/models/eac_users_support/user.rb +14 -0
- data/app/views/eac_users_support/users/edit.html.erb +13 -0
- data/config/initializers/devise.rb +274 -0
- data/config/locales/devise.en.yml +62 -0
- data/config/locales/devise.pt-BR.yml +64 -0
- data/config/routes.rb +12 -0
- data/db/migrate/20160605013848_create_users.rb +9 -0
- data/db/migrate/20160605035833_add_devise_authenticable_to_users.rb +6 -0
- data/db/migrate/20171012182305_rename_users_to_eac_users_support_users.rb +6 -0
- data/lib/eac_users_support/engine.rb +16 -0
- data/lib/eac_users_support/patches/action_controller_test_case.rb +10 -0
- data/lib/eac_users_support/tasks/password_reset.rb +27 -0
- data/lib/eac_users_support/version.rb +3 -0
- data/lib/eac_users_support.rb +11 -0
- data/lib/tasks/eac_users_support.rake +18 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +12 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +9 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/schema.rb +25 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/eac_users_support_test.rb +7 -0
- data/test/integration/navigation_test.rb +7 -0
- data/test/test_helper.rb +23 -0
- metadata +198 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c8d6dc62ccfce418082abe367c1a0883da6a2363
|
4
|
+
data.tar.gz: 600b4b303cc8c058e608451e3997161e65ab7b65
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8fb381363adbdaa63fe01c200beb6bf0573bf6eedeec16a777e8d60e7b8afb7bdb6b13e89ca6df1cbef34bccaec5676aaf1d903d60729c768f3616a05a8c96eb
|
7
|
+
data.tar.gz: bdea221210c498589471d0d97daf1aca9b9820a4c467d269ff4b545b2480685bab7a5a585799d21467fb8654d32fcba44d97580376f3da76f2065382fe9a8185
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Eduardo H. Bogoni
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'UsersSupport'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
load 'rails/tasks/statistics.rake'
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
task default: :test
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
14
|
+
//= active_scaffold
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*= require active_scaffold
|
16
|
+
*/
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module EacUsersSupport
|
2
|
+
module Admin
|
3
|
+
class UsersController < ::EacUsersSupport::ApplicationController
|
4
|
+
before_action :authenticate_user!
|
5
|
+
|
6
|
+
active_scaffold ::EacUsersSupport::User do |conf|
|
7
|
+
conf.columns.exclude :encrypted_password
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
def before_create_save(record)
|
13
|
+
record.password = record.email
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module EacUsersSupport
|
2
|
+
class UsersController < ::EacUsersSupport::ApplicationController
|
3
|
+
before_action :authenticate_user!
|
4
|
+
|
5
|
+
def edit
|
6
|
+
@user = current_user
|
7
|
+
end
|
8
|
+
|
9
|
+
def update_password
|
10
|
+
@user = User.find(current_user.id)
|
11
|
+
if @user.update(user_params)
|
12
|
+
sign_in @user, bypass: true
|
13
|
+
redirect_to main_app.root_path
|
14
|
+
else
|
15
|
+
render 'edit'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def user_params
|
22
|
+
# NOTE: Using `strong_parameters` gem
|
23
|
+
params.require(:user).permit(:password, :password_confirmation)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_dependency 'eac_users_support'
|
3
|
+
|
4
|
+
module EacUsersSupport
|
5
|
+
class User < ActiveRecord::Base
|
6
|
+
devise :database_authenticatable, :registerable
|
7
|
+
|
8
|
+
validates :email, presence: true, uniqueness: true
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
email
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= form_for(@user, :url => { :action => "update_password" } ) do |f| %>
|
2
|
+
<div class="field">
|
3
|
+
<%= f.label :password, "Password" %><br />
|
4
|
+
<%= f.password_field :password, :autocomplete => "off" %>
|
5
|
+
</div>
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :password_confirmation %><br />
|
8
|
+
<%= f.password_field :password_confirmation %>
|
9
|
+
</div>
|
10
|
+
<div class="action_container">
|
11
|
+
<%= f.submit %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
@@ -0,0 +1,274 @@
|
|
1
|
+
require 'devise'
|
2
|
+
|
3
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
4
|
+
# Many of these configuration options can be set straight in your model.
|
5
|
+
Devise.setup do |config|
|
6
|
+
# The secret key used by Devise. Devise uses this key to generate
|
7
|
+
# random tokens. Changing this key will render invalid all existing
|
8
|
+
# confirmation, reset password and unlock tokens in the database.
|
9
|
+
# Devise will use the `secret_key_base` as its `secret_key`
|
10
|
+
# by default. You can change it below and use your own secret key.
|
11
|
+
config.secret_key = '003771cf2e1d51041eb663ddd7a04f3b577a4f3a288cc91fded55e9d2b24d2f8bc' \
|
12
|
+
'6fc29d55a38a45d6985e8b7a5c54f2680a8f149b0b01d6b73d70ca920c190c'
|
13
|
+
|
14
|
+
# ==> Mailer Configuration
|
15
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
16
|
+
# note that it will be overwritten if you use your own mailer class
|
17
|
+
# with default "from" parameter.
|
18
|
+
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
19
|
+
|
20
|
+
# Configure the class responsible to send e-mails.
|
21
|
+
# config.mailer = 'Devise::Mailer'
|
22
|
+
|
23
|
+
# Configure the parent class responsible to send e-mails.
|
24
|
+
# config.parent_mailer = 'ActionMailer::Base'
|
25
|
+
|
26
|
+
# ==> ORM configuration
|
27
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
28
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
29
|
+
# available as additional gems.
|
30
|
+
require 'devise/orm/active_record'
|
31
|
+
|
32
|
+
# ==> Configuration for any authentication mechanism
|
33
|
+
# Configure which keys are used when authenticating a user. The default is
|
34
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
35
|
+
# authenticating a user, both parameters are required. Remember that those
|
36
|
+
# parameters are used only when authenticating and not when retrieving from
|
37
|
+
# session. If you need permissions, you should implement that in a before filter.
|
38
|
+
# You can also supply a hash where the value is a boolean determining whether
|
39
|
+
# or not authentication should be aborted when the value is not present.
|
40
|
+
# config.authentication_keys = [:email]
|
41
|
+
|
42
|
+
# Configure parameters from the request object used for authentication. Each entry
|
43
|
+
# given should be a request method and it will automatically be passed to the
|
44
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
45
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
46
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
47
|
+
# config.request_keys = []
|
48
|
+
|
49
|
+
# Configure which authentication keys should be case-insensitive.
|
50
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
51
|
+
# to authenticate or find a user. Default is :email.
|
52
|
+
config.case_insensitive_keys = [:email]
|
53
|
+
|
54
|
+
# Configure which authentication keys should have whitespace stripped.
|
55
|
+
# These keys will have whitespace before and after removed upon creating or
|
56
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
57
|
+
config.strip_whitespace_keys = [:email]
|
58
|
+
|
59
|
+
# Tell if authentication through request.params is enabled. True by default.
|
60
|
+
# It can be set to an array that will enable params authentication only for the
|
61
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
62
|
+
# enable it only for database (email + password) authentication.
|
63
|
+
# config.params_authenticatable = true
|
64
|
+
|
65
|
+
# Tell if authentication through HTTP Auth is enabled. False by default.
|
66
|
+
# It can be set to an array that will enable http authentication only for the
|
67
|
+
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
68
|
+
# enable it only for database authentication. The supported strategies are:
|
69
|
+
# :database = Support basic authentication with authentication key + password
|
70
|
+
# config.http_authenticatable = false
|
71
|
+
|
72
|
+
# If 401 status code should be returned for AJAX requests. True by default.
|
73
|
+
# config.http_authenticatable_on_xhr = true
|
74
|
+
|
75
|
+
# The realm used in Http Basic Authentication. 'Application' by default.
|
76
|
+
# config.http_authentication_realm = 'Application'
|
77
|
+
|
78
|
+
# It will change confirmation, password recovery and other workflows
|
79
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
80
|
+
# Does not affect registerable.
|
81
|
+
# config.paranoid = true
|
82
|
+
|
83
|
+
# By default Devise will store the user in session. You can skip storage for
|
84
|
+
# particular strategies by setting this option.
|
85
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
86
|
+
# may want to disable generating routes to Devise's sessions controller by
|
87
|
+
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
88
|
+
config.skip_session_storage = [:http_auth]
|
89
|
+
|
90
|
+
# By default, Devise cleans up the CSRF token on authentication to
|
91
|
+
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
92
|
+
# requests for sign in and sign up, you need to get a new CSRF token
|
93
|
+
# from the server. You can disable this option at your own risk.
|
94
|
+
# config.clean_up_csrf_token_on_authentication = true
|
95
|
+
|
96
|
+
# ==> Configuration for :database_authenticatable
|
97
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 11. If
|
98
|
+
# using other algorithms, it sets how many times you want the password to be hashed.
|
99
|
+
#
|
100
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
101
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
102
|
+
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
103
|
+
# algorithm), the cost increases exponentially with the number of stretches (e.g.
|
104
|
+
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
105
|
+
config.stretches = Rails.env.test? ? 1 : 11
|
106
|
+
|
107
|
+
# Set up a pepper to generate the hashed password.
|
108
|
+
# config.pepper = '6184eaea7098bb366f05dca476c19204739a0cc3e216e126975be81c149df3347b1d814' +
|
109
|
+
# '45fc3a8bd261faa5015132f0bc91c3e1a4969e5ce0f6928d33760eaa6'
|
110
|
+
|
111
|
+
# Send a notification email when the user's password is changed
|
112
|
+
# config.send_password_change_notification = false
|
113
|
+
|
114
|
+
# ==> Configuration for :confirmable
|
115
|
+
# A period that the user is allowed to access the website even without
|
116
|
+
# confirming their account. For instance, if set to 2.days, the user will be
|
117
|
+
# able to access the website for two days without confirming their account,
|
118
|
+
# access will be blocked just in the third day. Default is 0.days, meaning
|
119
|
+
# the user cannot access the website without confirming their account.
|
120
|
+
# config.allow_unconfirmed_access_for = 2.days
|
121
|
+
|
122
|
+
# A period that the user is allowed to confirm their account before their
|
123
|
+
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
124
|
+
# their account within 3 days after the mail was sent, but on the fourth day
|
125
|
+
# their account can't be confirmed with the token any more.
|
126
|
+
# Default is nil, meaning there is no restriction on how long a user can take
|
127
|
+
# before confirming their account.
|
128
|
+
# config.confirm_within = 3.days
|
129
|
+
|
130
|
+
# If true, requires any email changes to be confirmed (exactly the same way as
|
131
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
132
|
+
# db field (see migrations). Until confirmed, new email is stored in
|
133
|
+
# unconfirmed_email column, and copied to email column on successful confirmation.
|
134
|
+
config.reconfirmable = true
|
135
|
+
|
136
|
+
# Defines which key will be used when confirming an account
|
137
|
+
# config.confirmation_keys = [:email]
|
138
|
+
|
139
|
+
# ==> Configuration for :rememberable
|
140
|
+
# The time the user will be remembered without asking for credentials again.
|
141
|
+
# config.remember_for = 2.weeks
|
142
|
+
|
143
|
+
# Invalidates all the remember me tokens when the user signs out.
|
144
|
+
config.expire_all_remember_me_on_sign_out = true
|
145
|
+
|
146
|
+
# If true, extends the user's remember period when remembered via cookie.
|
147
|
+
# config.extend_remember_period = false
|
148
|
+
|
149
|
+
# Options to be passed to the created cookie. For instance, you can set
|
150
|
+
# secure: true in order to force SSL only cookies.
|
151
|
+
# config.rememberable_options = {}
|
152
|
+
|
153
|
+
# ==> Configuration for :validatable
|
154
|
+
# Range for password length.
|
155
|
+
config.password_length = 6..128
|
156
|
+
|
157
|
+
# Email regex used to validate email formats. It simply asserts that
|
158
|
+
# one (and only one) @ exists in the given string. This is mainly
|
159
|
+
# to give user feedback and not to assert the e-mail validity.
|
160
|
+
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
161
|
+
|
162
|
+
# ==> Configuration for :timeoutable
|
163
|
+
# The time you want to timeout the user session without activity. After this
|
164
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
165
|
+
# config.timeout_in = 30.minutes
|
166
|
+
|
167
|
+
# ==> Configuration for :lockable
|
168
|
+
# Defines which strategy will be used to lock an account.
|
169
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
170
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
171
|
+
# config.lock_strategy = :failed_attempts
|
172
|
+
|
173
|
+
# Defines which key will be used when locking and unlocking an account
|
174
|
+
# config.unlock_keys = [:email]
|
175
|
+
|
176
|
+
# Defines which strategy will be used to unlock an account.
|
177
|
+
# :email = Sends an unlock link to the user email
|
178
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
179
|
+
# :both = Enables both strategies
|
180
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
181
|
+
# config.unlock_strategy = :both
|
182
|
+
|
183
|
+
# Number of authentication tries before locking an account if lock_strategy
|
184
|
+
# is failed attempts.
|
185
|
+
# config.maximum_attempts = 20
|
186
|
+
|
187
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
188
|
+
# config.unlock_in = 1.hour
|
189
|
+
|
190
|
+
# Warn on the last attempt before the account is locked.
|
191
|
+
# config.last_attempt_warning = true
|
192
|
+
|
193
|
+
# ==> Configuration for :recoverable
|
194
|
+
#
|
195
|
+
# Defines which key will be used when recovering the password for an account
|
196
|
+
# config.reset_password_keys = [:email]
|
197
|
+
|
198
|
+
# Time interval you can reset your password with a reset password key.
|
199
|
+
# Don't put a too small interval or your users won't have the time to
|
200
|
+
# change their passwords.
|
201
|
+
config.reset_password_within = 6.hours
|
202
|
+
|
203
|
+
# When set to false, does not sign a user in automatically after their password is
|
204
|
+
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
205
|
+
# config.sign_in_after_reset_password = true
|
206
|
+
|
207
|
+
# ==> Configuration for :encryptable
|
208
|
+
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
|
209
|
+
# You can use :sha1, :sha512 or algorithms from others authentication tools as
|
210
|
+
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
|
211
|
+
# for default behavior) and :restful_authentication_sha1 (then you should set
|
212
|
+
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
|
213
|
+
#
|
214
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
215
|
+
# config.encryptor = :sha512
|
216
|
+
|
217
|
+
# ==> Scopes configuration
|
218
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
219
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
220
|
+
# are using only default views.
|
221
|
+
# config.scoped_views = false
|
222
|
+
|
223
|
+
# Configure the default scope given to Warden. By default it's the first
|
224
|
+
# devise role declared in your routes (usually :user).
|
225
|
+
# config.default_scope = :user
|
226
|
+
|
227
|
+
# Set this configuration to false if you want /users/sign_out to sign out
|
228
|
+
# only the current scope. By default, Devise signs out all scopes.
|
229
|
+
# config.sign_out_all_scopes = true
|
230
|
+
|
231
|
+
# ==> Navigation configuration
|
232
|
+
# Lists the formats that should be treated as navigational. Formats like
|
233
|
+
# :html, should redirect to the sign in page when the user does not have
|
234
|
+
# access, but formats like :xml or :json, should return 401.
|
235
|
+
#
|
236
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
237
|
+
# should add them to the navigational formats lists.
|
238
|
+
#
|
239
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
240
|
+
# config.navigational_formats = ['*/*', :html]
|
241
|
+
|
242
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
243
|
+
config.sign_out_via = :delete
|
244
|
+
|
245
|
+
# ==> OmniAuth
|
246
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
247
|
+
# up on your models and hooks.
|
248
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
249
|
+
|
250
|
+
# ==> Warden configuration
|
251
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
252
|
+
# change the failure app, you can configure them inside the config.warden block.
|
253
|
+
#
|
254
|
+
# config.warden do |manager|
|
255
|
+
# manager.intercept_401 = false
|
256
|
+
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
257
|
+
# end
|
258
|
+
|
259
|
+
# ==> Mountable engine configurations
|
260
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
261
|
+
# is mountable, there are some extra configurations to be taken into account.
|
262
|
+
# The following options are available, assuming the engine is mounted as:
|
263
|
+
#
|
264
|
+
# mount MyEngine, at: '/my_engine'
|
265
|
+
#
|
266
|
+
# The router that invoked `devise_for`, in the example above, would be:
|
267
|
+
config.router_name = :eac_users_support
|
268
|
+
#
|
269
|
+
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
270
|
+
# so you need to do it manually. For the users scope, it would be:
|
271
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
272
|
+
|
273
|
+
config.parent_controller = 'EacUsersSupport::ApplicationController'
|
274
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
|
2
|
+
|
3
|
+
en:
|
4
|
+
devise:
|
5
|
+
confirmations:
|
6
|
+
confirmed: "Your email address has been successfully confirmed."
|
7
|
+
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
|
8
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
|
9
|
+
failure:
|
10
|
+
already_authenticated: "You are already signed in."
|
11
|
+
inactive: "Your account is not activated yet."
|
12
|
+
invalid: "Invalid %{authentication_keys} or password."
|
13
|
+
locked: "Your account is locked."
|
14
|
+
last_attempt: "You have one more attempt before your account is locked."
|
15
|
+
not_found_in_database: "Invalid %{authentication_keys} or password."
|
16
|
+
timeout: "Your session expired. Please sign in again to continue."
|
17
|
+
unauthenticated: "You need to sign in or sign up before continuing."
|
18
|
+
unconfirmed: "You have to confirm your email address before continuing."
|
19
|
+
mailer:
|
20
|
+
confirmation_instructions:
|
21
|
+
subject: "Confirmation instructions"
|
22
|
+
reset_password_instructions:
|
23
|
+
subject: "Reset password instructions"
|
24
|
+
unlock_instructions:
|
25
|
+
subject: "Unlock instructions"
|
26
|
+
password_change:
|
27
|
+
subject: "Password Changed"
|
28
|
+
omniauth_callbacks:
|
29
|
+
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
30
|
+
success: "Successfully authenticated from %{kind} account."
|
31
|
+
passwords:
|
32
|
+
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
33
|
+
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
34
|
+
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
35
|
+
updated: "Your password has been changed successfully. You are now signed in."
|
36
|
+
updated_not_active: "Your password has been changed successfully."
|
37
|
+
registrations:
|
38
|
+
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
|
39
|
+
signed_up: "Welcome! You have signed up successfully."
|
40
|
+
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
41
|
+
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
42
|
+
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
|
43
|
+
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
|
44
|
+
updated: "Your account has been updated successfully."
|
45
|
+
sessions:
|
46
|
+
signed_in: "Signed in successfully."
|
47
|
+
signed_out: "Signed out successfully."
|
48
|
+
already_signed_out: "Signed out successfully."
|
49
|
+
unlocks:
|
50
|
+
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
|
51
|
+
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
|
52
|
+
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
53
|
+
errors:
|
54
|
+
messages:
|
55
|
+
already_confirmed: "was already confirmed, please try signing in"
|
56
|
+
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
57
|
+
expired: "has expired, please request a new one"
|
58
|
+
not_found: "not found"
|
59
|
+
not_locked: "was not locked"
|
60
|
+
not_saved:
|
61
|
+
one: "1 error prohibited this %{resource} from being saved:"
|
62
|
+
other: "%{count} errors prohibited this %{resource} from being saved:"
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
|
2
|
+
|
3
|
+
# Utilize-o em 'config/locales/', com o nome de 'devise.pt-BR.yml'.
|
4
|
+
# Em 'config/application.rb', utilize => config.i18n.default_locale = :'pt-BR'
|
5
|
+
|
6
|
+
pt-BR:
|
7
|
+
devise:
|
8
|
+
confirmations:
|
9
|
+
confirmed: "Sua conta foi confirmada com sucesso."
|
10
|
+
send_instructions: "Você receberá um e-mail para confirmar sua conta em alguns minutos."
|
11
|
+
send_paranoid_instructions: "Caso seu endereço de e-mail já exista em nosso banco de dados, você receberá um email com instruções sobre como ativar sua conta."
|
12
|
+
failure:
|
13
|
+
already_authenticated: "Você já está logado."
|
14
|
+
inactive: "Sua conta ainda não foi ativada."
|
15
|
+
invalid: "Email ou senha inválidos."
|
16
|
+
locked: "Sua conta está bloqueada."
|
17
|
+
last_attempt: "Você possui apenas uma tentativa, antes de sua conta ser bloqueada."
|
18
|
+
not_found_in_database: "Email ou senha inválidos."
|
19
|
+
timeout: "Sua sessão expirou, faça login novamente para continuar."
|
20
|
+
unauthenticated: "Você precisa fazer login ou se registrar, antes de continuar."
|
21
|
+
unconfirmed: "Você precisa confirmar sua conta, antes de continuar."
|
22
|
+
mailer:
|
23
|
+
confirmation_instructions:
|
24
|
+
subject: "Instruções de confirmação"
|
25
|
+
reset_password_instructions:
|
26
|
+
subject: "Instruções para redefinir sua senha"
|
27
|
+
unlock_instructions:
|
28
|
+
subject: "Instruções para desbloquear sua conta"
|
29
|
+
omniauth_callbacks:
|
30
|
+
failure: "Não foi possível autenticá-lo em %{kind} por causa de \"%{reason}\"."
|
31
|
+
success: "Autenticado com sucesso em %{kind}."
|
32
|
+
passwords:
|
33
|
+
no_token: "Você não pode acessar essa página para redefinir sua senha. Se você recebeu um e-mail para redefinir sua senha, por favor, certifique-se de estar usando a URL correta."
|
34
|
+
send_instructions: "Você receberá um e-mail com instruções sobre como redefinir sua senha em poucos minutos."
|
35
|
+
send_paranoid_instructions: "Se o seu endereço de e-mail existir em nosso banco de dados, você receberá um link de recuperação de senha em poucos minutos."
|
36
|
+
updated: "Sua senha foi alterada com sucesso. Você agora está conectado."
|
37
|
+
updated_not_active: "Sua senha foi alterada com sucesso."
|
38
|
+
registrations:
|
39
|
+
destroyed: "Até logo! Sua conta foi cancelada com sucesso. Nós esperamos vê-lo novamente em breve."
|
40
|
+
signed_up: "Bem-vindo! Você se registrou com sucesso."
|
41
|
+
signed_up_but_inactive: "Você se registrou com sucesso. Para efetuar login, você deverá ativar sua conta."
|
42
|
+
signed_up_but_locked: "Você se registrou com sucesso. No entanto, não podemos logá-lo, pois sua conta está bloqueada."
|
43
|
+
signed_up_but_unconfirmed: "Uma mensagem com um link de confirmação foi enviado para seu endereço de e-mail. Por favor, verifique-o, para ativar sua conta."
|
44
|
+
update_needs_confirmation: "Você atualizou sua conta com sucesso, mas precisamos verificar o seu novo endereço de e-mail. Por favor, verifique seu e-mail e clique no link de confirmação para confirmar o seu novo endereço de e-mail."
|
45
|
+
updated: "Sua conta foi atualizada com sucesso."
|
46
|
+
sessions:
|
47
|
+
signed_in: "Logado com sucesso."
|
48
|
+
signed_out: "Saiu com sucesso."
|
49
|
+
already_signed_out: "Saiu com sucesso."
|
50
|
+
unlocks:
|
51
|
+
send_instructions: "Você receberá um e-mail com instruções sobre como desbloquear sua conta, em poucos minutos."
|
52
|
+
send_paranoid_instructions: "Se a sua conta existir, você receberá um e-mail com instruções sobre como desbloqueá-la, em poucos minutos."
|
53
|
+
unlocked: "Sua conta foi desbloqueada com sucesso. Faça login para continuar."
|
54
|
+
errors:
|
55
|
+
messages:
|
56
|
+
already_confirmed: "já foi confirmado, por favor, efetue login"
|
57
|
+
confirmation_period_expired: "deve ser confirmada dentro de %{period}, por favor solicite uma nova"
|
58
|
+
expired: "expirado, por favor solicite uma nova"
|
59
|
+
not_found: "não encontrado"
|
60
|
+
not_locked: "não encontra-se bloqueada"
|
61
|
+
not_saved:
|
62
|
+
one: "1 erro impediu a gravação de %{resource} :"
|
63
|
+
other: "%{count} erros impediram a gravação de %{resource} :"
|
64
|
+
confirmation: 'Não é igual'
|
data/config/routes.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
EacUsersSupport::Engine.routes.draw do
|
2
|
+
namespace(:admin) do
|
3
|
+
resources(:users) { as_routes }
|
4
|
+
end
|
5
|
+
devise_for :users, class_name: 'EacUsersSupport::User', module: :devise, skip: [:registrations]
|
6
|
+
resource :user, only: [:edit] do
|
7
|
+
collection do
|
8
|
+
patch 'update_password'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
get '/users/sign_up(.:format)', to: 'devise/sessions#new', as: 'new_user_registration'
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'devise'
|
3
|
+
|
4
|
+
module EacUsersSupport
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
isolate_namespace EacUsersSupport
|
7
|
+
|
8
|
+
initializer :append_migrations do |app|
|
9
|
+
unless app.root.to_s.match root.to_s
|
10
|
+
config.paths['db/migrate'].expanded.each do |expanded_path|
|
11
|
+
app.config.paths['db/migrate'] << expanded_path
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|