thecore_ui_rails_admin 3.8.0 → 3.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/views/rails_admin/main/change_password.html.erb +14 -4
- data/config/initializers/after_initialize.rb +13 -0
- data/config/locales/en.thecore_ui_ra.yml +2 -1
- data/config/locales/it.thecore_ui_ra.yml +2 -1
- data/lib/member_actions/change_password.rb +11 -6
- data/lib/thecore_ui_rails_admin/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6fd3925ac3731ba34c6a8309921a3b2fc6e809ce252d4f35154bf64cfeb16e91
|
|
4
|
+
data.tar.gz: a3fbabe5802a62f590f901de7459b467ff5bf7f0ca310de8054afc93d9491492
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c9b11bf195a4a09f47a57681a96b60875378ddda5e7c6745d7141766e639de9092c4a044e2c6595d9b8f0376866d5dda487407db279e3b93e08b33de4418a4d
|
|
7
|
+
data.tar.gz: c0bdd3226419acfa5a665e2205883b2e92f6ae186b40fda3e3954d677584d9292c1087fa0f4435d43b88b5027245cd291858b0cf0b02cd33de96cb4815a47c90
|
|
@@ -1,17 +1,27 @@
|
|
|
1
|
+
<div class="alert alert-info">
|
|
2
|
+
<%= t('admin.actions.change_password.requirements', min_length: User.password_length.min) %>
|
|
3
|
+
</div>
|
|
4
|
+
|
|
1
5
|
<%= form_for(@object, url: change_password_path, html: { method: :patch }, class: "main") do |f| %>
|
|
2
6
|
|
|
3
7
|
<fieldset>
|
|
4
|
-
<div class="control-group row mb-3 string_type password_field " id="user_password_field">
|
|
8
|
+
<div class="control-group row mb-3 string_type password_field <%= 'error' if @object.errors[:password].present? %>" id="user_password_field">
|
|
5
9
|
<label class="col-sm-2 col-form-label text-md-end" for="user_password">Password</label>
|
|
6
|
-
<div class="col-sm-10 controls">
|
|
10
|
+
<div class="col-sm-10 controls <%= 'has-error' if @object.errors[:password].present? %>">
|
|
7
11
|
<input class="form-control" required="required" size="50" type="password" name="user[password]" id="user_password">
|
|
12
|
+
<% if @object.errors[:password].present? %>
|
|
13
|
+
<span class="help-inline text-danger"><%= @object.errors[:password].to_sentence %></span>
|
|
14
|
+
<% end %>
|
|
8
15
|
<div class="form-text"><%=t('admin.form.required')%></div>
|
|
9
16
|
</div>
|
|
10
17
|
</div>
|
|
11
|
-
<div class="control-group row mb-3 string_type password_confirmation_field " id="user_password_confirmation_field">
|
|
18
|
+
<div class="control-group row mb-3 string_type password_confirmation_field <%= 'error' if @object.errors[:password_confirmation].present? %>" id="user_password_confirmation_field">
|
|
12
19
|
<label class="col-sm-2 col-form-label text-md-end" for="user_password_confirmation">Password Confirmation</label>
|
|
13
|
-
<div class="col-sm-10 controls">
|
|
20
|
+
<div class="col-sm-10 controls <%= 'has-error' if @object.errors[:password_confirmation].present? %>">
|
|
14
21
|
<input class="form-control" required="required" size="50" type="password" name="user[password_confirmation]" id="user_password_confirmation">
|
|
22
|
+
<% if @object.errors[:password_confirmation].present? %>
|
|
23
|
+
<span class="help-inline text-danger"><%= @object.errors[:password_confirmation].to_sentence %></span>
|
|
24
|
+
<% end %>
|
|
15
25
|
<div class="form-text"><%=t('admin.form.required')%></div>
|
|
16
26
|
</div>
|
|
17
27
|
</div>
|
|
@@ -47,6 +47,19 @@ Rails.application.configure do
|
|
|
47
47
|
Target.send :include, ThecoreUiRailsAdminTargetConcern
|
|
48
48
|
ThecoreSettings::Setting.send :include, ThecoreUiRailsAdminSettingsConcern
|
|
49
49
|
|
|
50
|
+
# Force RailsAdmin::Config::Actions to initialize its base action list
|
|
51
|
+
# (Dashboard, Index, Show, Edit, ...) before any custom action below
|
|
52
|
+
# registers itself. `RailsAdmin::Config::Actions.add_action`'s
|
|
53
|
+
# `@@actions ||= []` means whichever caller touches `@@actions` first
|
|
54
|
+
# decides whether the base actions ever get added at all -- if a custom
|
|
55
|
+
# `add_action` runs first (as can happen when route drawing is lazy,
|
|
56
|
+
# e.g. outside a request/eager-loaded boot), the base actions are
|
|
57
|
+
# silently skipped for the rest of the process, breaking every
|
|
58
|
+
# `edit_path`/`index_path`/... helper call. Calling `.all` here is a
|
|
59
|
+
# no-op once already initialized, so this is safe regardless of order
|
|
60
|
+
# elsewhere.
|
|
61
|
+
RailsAdmin::Config::Actions.all
|
|
62
|
+
|
|
50
63
|
require "root_actions/general_computation"
|
|
51
64
|
require "root_actions/active_job_monitor"
|
|
52
65
|
require "root_actions/push_notification_test"
|
|
@@ -41,7 +41,8 @@ en:
|
|
|
41
41
|
breadcrumb: Change Password
|
|
42
42
|
menu: Change Password
|
|
43
43
|
success: Your password was changed successfully
|
|
44
|
-
error: Warning!
|
|
44
|
+
error: "Warning! Please correct the highlighted field(s) below."
|
|
45
|
+
requirements: "Password requirements: at least %{min_length} characters, including at least one uppercase letter, one lowercase letter, one number, and one special character (e.g. ! @ # $ % &). The password and its confirmation must match."
|
|
45
46
|
save_filters:
|
|
46
47
|
success: Filters saved successfully
|
|
47
48
|
error: Error while saving filters
|
|
@@ -41,7 +41,8 @@ it:
|
|
|
41
41
|
breadcrumb: Cambia Password
|
|
42
42
|
menu: Cambia Password
|
|
43
43
|
success: La tua password è stata cambiata con successo
|
|
44
|
-
error: "Attenzione!
|
|
44
|
+
error: "Attenzione! Controlla i campi evidenziati qui sotto."
|
|
45
|
+
requirements: "Requisiti password: almeno %{min_length} caratteri, con almeno una lettera maiuscola, una lettera minuscola, un numero e un carattere speciale (es. ! @ # $ % &). Password e conferma devono coincidere."
|
|
45
46
|
save_filters:
|
|
46
47
|
success: Filtri salvati con successo
|
|
47
48
|
error: Errore durante il salvataggio dei filtri
|
|
@@ -13,15 +13,20 @@ RailsAdmin::Config::Actions.add_action "change_password", :base, :member do
|
|
|
13
13
|
proc do
|
|
14
14
|
# if it's a form submission, then update the password
|
|
15
15
|
if request.patch?
|
|
16
|
-
|
|
17
|
-
if u.update(password: params[:user][:password], password_confirmation: params[:user][:password_confirmation])
|
|
16
|
+
if @object.update(password: params[:user][:password], password_confirmation: params[:user][:password_confirmation])
|
|
18
17
|
flash[:success] = I18n.t("admin.actions.change_password.success")
|
|
18
|
+
redirect_to index_path(model_name: @abstract_model.to_param)
|
|
19
19
|
else
|
|
20
|
-
#
|
|
21
|
-
|
|
20
|
+
# Stay on the change_password page, highlighting the error the same
|
|
21
|
+
# way RailsAdmin's own edit/new forms do on a validation failure --
|
|
22
|
+
# @object keeps its errors for the re-rendered form to read. The flash
|
|
23
|
+
# is deliberately generic (no error list): the view already renders
|
|
24
|
+
# each field's own errors inline, right next to that field -- listing
|
|
25
|
+
# the same @object.errors.full_messages again up here would just show
|
|
26
|
+
# every message twice on a two-field form.
|
|
27
|
+
flash.now[:error] = I18n.t("admin.actions.change_password.error")
|
|
28
|
+
render :change_password, status: :not_acceptable
|
|
22
29
|
end
|
|
23
|
-
# Redirect to the object
|
|
24
|
-
redirect_to index_path(model_name: @abstract_model.to_param)
|
|
25
30
|
end
|
|
26
31
|
end
|
|
27
32
|
end
|