eac_users_support 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e97e05ca57500cd0cbd76a3376efd06f7581b070
4
- data.tar.gz: 22c0f6332755f00443f563b82fac2edfc2ddf15a
2
+ SHA256:
3
+ metadata.gz: 6867d12aa8e309ef121f3e13b8041d9c3c89dd32f7f748552a3c0080c2be910d
4
+ data.tar.gz: e0dc2853d4f4e712a38f6af94b71256d82bce20dd736fff4ef1e94b29e475da1
5
5
  SHA512:
6
- metadata.gz: cbfb886b2c1bef9b4f0dafea2a68cfbcc26df023785e047228af7e1b4f28684834811434b25a70b3f01c98ef4471937ef04e3edac9ee86bef121e86047d66b4b
7
- data.tar.gz: 066a6642fe634287dec384903795c27e9a35d35da9f3bb07f249678148d61ab1d89d856e5d14903656e7e2cd1845168ad9f9d0fe9d5d3f0e63a367c69af2d719
6
+ metadata.gz: c8b33f02eede8b89b22869aa4d55def5b32647518344369c2b1225118a427f784db3ea3dd1d606410aa8f4e78de6f1b9e94cc8b2a3f3b07c9185b3a6d41b80b2
7
+ data.tar.gz: f8a71bd792172d005d03622e635f56449506f5479d25a6b6be47069fdef71668f0a298475d0c33d1f9d0ac5d79aefff98969666a8cafaa9dc5b40c27cd8254d8
@@ -4,12 +4,28 @@ module EacUsersSupport
4
4
  module Admin
5
5
  class UsersController < ::EacUsersSupport::ApplicationController
6
6
  active_scaffold ::EacUsersSupport::User do |conf|
7
+ conf.action_links.add :password_reset,
8
+ type: :member, method: :put, position: false,
9
+ label: ::I18n.t(:'eac_users_support.password_reset.action')
7
10
  conf.columns.exclude :encrypted_password
8
11
  %w[create update list].each do |action|
9
12
  conf.send(action).columns.exclude :remember_created_at
10
13
  end
11
14
  end
12
15
 
16
+ def password_reset
17
+ process_action_link_action do |record|
18
+ record.password = ::Devise.friendly_token
19
+ if record.save
20
+ flash[:info] = ::I18n.t(:'eac_users_support.password_reset.successful',
21
+ user: record, password: record.password)
22
+ else
23
+ flash[:error] = ::I18n.t(:'eac_users_support.password_reset.failed', user: user) +
24
+ ': ' + record.errors.to_s
25
+ end
26
+ end
27
+ end
28
+
13
29
  protected
14
30
 
15
31
  def before_create_save(record)
@@ -9,3 +9,8 @@ pt-BR:
9
9
  eac_users_support/user:
10
10
  one: Usuário
11
11
  other: Usuários
12
+ eac_users_support:
13
+ password_reset:
14
+ action: Resetar senha
15
+ successful: Senha do usuário %{user} alterada para "%{password}".
16
+ failed: Falha ao tentar alterar a senha do usuário %{user}.
data/config/routes.rb CHANGED
@@ -2,7 +2,12 @@
2
2
 
3
3
  EacUsersSupport::Engine.routes.draw do
4
4
  namespace(:admin) do
5
- resources(:users) { as_routes }
5
+ resources(:users) do
6
+ as_routes
7
+ member do
8
+ put :password_reset
9
+ end
10
+ end
6
11
  end
7
12
  devise_for :users, class_name: 'EacUsersSupport::User', module: :devise, skip: [:registrations]
8
13
  resource :user, only: [:edit] do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacUsersSupport
4
- VERSION = '0.2.3'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_users_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-26 00:00:00.000000000 Z
11
+ date: 2019-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_scaffold
@@ -167,43 +167,43 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  version: '0'
168
168
  requirements: []
169
169
  rubyforge_project:
170
- rubygems_version: 2.6.14
170
+ rubygems_version: 2.7.7
171
171
  signing_key:
172
172
  specification_version: 4
173
173
  summary: Ready-to-use support for users registration, login, logout, etc, for Rails.
174
174
  test_files:
175
- - test/dummy/Rakefile
176
- - test/dummy/README.rdoc
177
- - test/dummy/config.ru
178
- - test/dummy/config/boot.rb
179
- - test/dummy/config/database.yml
180
- - test/dummy/config/secrets.yml
181
- - test/dummy/config/locales/en.yml
182
- - test/dummy/config/application.rb
183
- - test/dummy/config/environments/development.rb
184
- - test/dummy/config/environments/test.rb
185
- - test/dummy/config/environments/production.rb
186
- - test/dummy/config/environment.rb
187
175
  - test/dummy/config/routes.rb
188
176
  - test/dummy/config/initializers/assets.rb
189
177
  - test/dummy/config/initializers/cookies_serializer.rb
190
- - test/dummy/config/initializers/inflections.rb
191
178
  - test/dummy/config/initializers/session_store.rb
179
+ - test/dummy/config/initializers/backtrace_silencers.rb
192
180
  - test/dummy/config/initializers/wrap_parameters.rb
193
181
  - test/dummy/config/initializers/filter_parameter_logging.rb
194
- - test/dummy/config/initializers/backtrace_silencers.rb
182
+ - test/dummy/config/initializers/inflections.rb
195
183
  - test/dummy/config/initializers/mime_types.rb
196
- - test/dummy/db/schema.rb
197
- - test/dummy/app/views/layouts/application.html.erb
198
- - test/dummy/app/controllers/application_controller.rb
199
- - test/dummy/app/helpers/application_helper.rb
200
- - test/dummy/app/assets/stylesheets/application.css
201
- - test/dummy/app/assets/javascripts/application.js
202
- - test/dummy/public/422.html
203
- - test/dummy/public/404.html
184
+ - test/dummy/config/database.yml
185
+ - test/dummy/config/secrets.yml
186
+ - test/dummy/config/locales/en.yml
187
+ - test/dummy/config/environment.rb
188
+ - test/dummy/config/boot.rb
189
+ - test/dummy/config/application.rb
190
+ - test/dummy/config/environments/production.rb
191
+ - test/dummy/config/environments/test.rb
192
+ - test/dummy/config/environments/development.rb
193
+ - test/dummy/Rakefile
204
194
  - test/dummy/public/favicon.ico
195
+ - test/dummy/public/404.html
205
196
  - test/dummy/public/500.html
206
- - test/dummy/bin/bundle
197
+ - test/dummy/public/422.html
198
+ - test/dummy/config.ru
199
+ - test/dummy/app/assets/stylesheets/application.css
200
+ - test/dummy/app/assets/javascripts/application.js
201
+ - test/dummy/app/helpers/application_helper.rb
202
+ - test/dummy/app/views/layouts/application.html.erb
203
+ - test/dummy/app/controllers/application_controller.rb
207
204
  - test/dummy/bin/setup
205
+ - test/dummy/bin/bundle
208
206
  - test/dummy/bin/rails
209
207
  - test/dummy/bin/rake
208
+ - test/dummy/db/schema.rb
209
+ - test/dummy/README.rdoc