diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index d0d4279..705632d 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -29,7 +29,7 @@
<%= image_link_to current_user.email, "account-wrench-outline",
edit_user_registration_path, current: :hide %>
<% if current_user_disguised? %>
- <%= image_button_to t(".revert"), "incognito-off", revert_users_path %>
+ <%= image_link_to t(".revert"), "incognito-off", revert_users_path %>
<% else %>
<%= image_button_to t(".sign_out"), "logout", destroy_user_session_path,
method: :delete %>
diff --git a/app/views/users/confirmations/new.html.erb b/app/views/users/confirmations/new.html.erb
index 264f70b..fbc4cfb 100644
--- a/app/views/users/confirmations/new.html.erb
+++ b/app/views/users/confirmations/new.html.erb
@@ -1,6 +1,8 @@
-<%= tabular_form_for resource, url: user_confirmation_path, html: { method: :post } do |f| %>
- <%= f.email_field :email, required: true, size: 30, autofocus: true, autocomplete: "email",
- value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
+
+ <%= tabular_form_for resource, url: user_confirmation_path do |f| %>
+ <%= f.email_field :email, required: true, size: 30, autofocus: true, autocomplete: "email",
+ value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
- <%= f.submit t(:resend_confirmation) %>
-<% end %>
+ <%= f.submit t(:resend_confirmation) %>
+ <% end %>
+
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb
index 9c3605c..18e8799 100644
--- a/app/views/users/index.html.erb
+++ b/app/views/users/index.html.erb
@@ -17,7 +17,8 @@
<%= user.status %>
<% else %>
<%= form_for user do |u| %>
- <%= u.select :status, User.statuses.keys, {}, onchange: "this.form.submit();" %>
+ <%= u.select :status, User.statuses.keys, {}, autocomplete: "off",
+ onchange: "this.form.requestSubmit();" %>
<% end %>
<% end %>
@@ -27,7 +28,7 @@
<%= user.created_at.to_fs(:db_without_sec) %> |
<% if allow_disguise?(user) %>
- <%= image_button_to t(".disguise"), "incognito", disguise_user_path(user) %>
+ <%= image_link_to t(".disguise"), "incognito", disguise_user_path(user) %>
<% end %>
|
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb
deleted file mode 100644
index eedbd83..0000000
--- a/app/views/users/new.html.erb
+++ /dev/null
@@ -1,9 +0,0 @@
-New user
-
-<%= render "form", user: @user %>
-
-
-
-
- <%= link_to "Back to users", users_path %>
-
diff --git a/app/views/users/passwords/edit.html.erb b/app/views/users/passwords/edit.html.erb
index b69bf4a..267b974 100644
--- a/app/views/users/passwords/edit.html.erb
+++ b/app/views/users/passwords/edit.html.erb
@@ -1,11 +1,13 @@
-<%= tabular_form_for resource, url: user_password_path, html: { method: :put } do |f| %>
- <%= f.hidden_field :reset_password_token, label: false %>
+
+ <%= tabular_form_for resource, url: user_password_path, html: {method: :put} do |f| %>
+ <%= f.hidden_field :reset_password_token, label: false %>
- <%= f.password_field :password, label: t(".new_password"),
- required: true, size: 30, autofocus: true, autocomplete: "new-password",
- hint: ("(#{@minimum_password_length} characters minimum)" if @minimum_password_length) %>
- <%= f.password_field :password_confirmation, label: t(".password_confirmation"),
- required: true, size: 30, autocomplete: "new-password" %>
+ <%= f.password_field :password, label: t(".new_password"), required: true, size: 30,
+ minlength: @minimum_password_length, autofocus: true, autocomplete: "new-password",
+ hint: t("users.minimum_password_length", count: @minimum_password_length) %>
+ <%= f.password_field :password_confirmation, label: t(".password_confirmation"),
+ required: true, size: 30, minlength: @minimum_password_length, autocomplete: "off" %>
- <%= f.submit t(".update_password") %>
-<% end %>
+ <%= f.submit t(".update_password") %>
+ <% end %>
+
diff --git a/app/views/users/passwords/new.html.erb b/app/views/users/passwords/new.html.erb
index 4e3ea0d..726cd32 100644
--- a/app/views/users/passwords/new.html.erb
+++ b/app/views/users/passwords/new.html.erb
@@ -1,5 +1,7 @@
-<%= tabular_form_for resource, url: user_password_path, html: { method: :post } do |f| %>
- <%= f.email_field :email, required: true, size: 30, autofocus: true, autocomplete: "email" %>
+
+ <%= tabular_form_for resource, url: user_password_path do |f| %>
+ <%= f.email_field :email, required: true, size: 30, autofocus: true, autocomplete: "email" %>
- <%= f.submit t(:recover_password) %>
-<% end %>
+ <%= f.submit t(:recover_password) %>
+ <% end %>
+
diff --git a/app/views/users/registrations/edit.html.erb b/app/views/users/registrations/edit.html.erb
index a577576..8e73026 100644
--- a/app/views/users/registrations/edit.html.erb
+++ b/app/views/users/registrations/edit.html.erb
@@ -19,10 +19,12 @@
<%= f.select :status, User.statuses, readonly: true %>
- <%= f.password_field :password, size: 30, autocomplete: "off",
- hint: t(".blank_password_hint_html",
- subhint: t(".minimum_length_hint_html", count: @minimum_password_length)) %>
- <%= f.password_field :password_confirmation, size: 30, autocomplete: "off" %>
+ <%= f.password_field :password, label: t(".new_password"), size: 30,
+ minlength: @minimum_password_length, autocomplete: "new-password",
+ hint: t(".blank_password_hint",
+ subhint: t("users.minimum_password_length", count: @minimum_password_length)) %>
+ <%= f.password_field :password_confirmation, label: t(".password_confirmation"),
+ size: 30, minlength: @minimum_password_length, autocomplete: "off" %>
<%= f.submit t(".update") %>
<% end %>
diff --git a/app/views/users/registrations/new.html.erb b/app/views/users/registrations/new.html.erb
index 432f614..2f1682f 100644
--- a/app/views/users/registrations/new.html.erb
+++ b/app/views/users/registrations/new.html.erb
@@ -1,14 +1,16 @@
-<%= tabular_form_for resource, url: user_registration_path do |f| %>
- <%= f.email_field :email, required: true, size: 30, autofocus: true, autocomplete: "email" %>
- <%= f.password_field :password, required: true, size: 30, minlength: @minimum_password_length,
- autocomplete: "new-password",
- hint: ("(#{@minimum_password_length} characters minimum)" if @minimum_password_length) %>
- <%= f.password_field :password_confirmation, label: t(".password_confirmation"),
- required: true, size: 30, autocomplete: "new-password" %>
+
+ <%= tabular_form_for resource, url: user_registration_path do |f| %>
+ <%= f.email_field :email, required: true, size: 30, autofocus: true, autocomplete: "email" %>
+ <%= f.password_field :password, required: true, size: 30,
+ minlength: @minimum_password_length, autocomplete: "new-password",
+ hint: t("users.minimum_password_length", count: @minimum_password_length) %>
+ <%= f.password_field :password_confirmation, label: t(".password_confirmation"),
+ required: true, size: 30, minlength: @minimum_password_length, autocomplete: "off" %>
- <%= f.submit t(:register) %>
-<% end %>
+ <%= f.submit t(:register) %>
+ <% end %>
-<%= content_tag :p, t(:or), style: "text-align: center;" %>
-<%= image_link_to t(:resend_confirmation), "email-sync-outline", new_user_confirmation_path,
- class: "centered" %>
+ <%= content_tag :p, t(:or), style: "text-align: center;" %>
+ <%= image_link_to t(:resend_confirmation), "email-sync-outline", new_user_confirmation_path,
+ class: "centered" %>
+
diff --git a/app/views/users/sessions/new.html.erb b/app/views/users/sessions/new.html.erb
index 0c96438..4720100 100644
--- a/app/views/users/sessions/new.html.erb
+++ b/app/views/users/sessions/new.html.erb
@@ -1,13 +1,17 @@
-<%= tabular_form_for resource, url: user_session_path do |f| %>
- <%= f.email_field :email, required: true, size: 30, autofocus: true, autocomplete: "email" %>
- <%= f.password_field :password, required: true, size: 30, autocomplete: "current-password" %>
+
+ <%= tabular_form_for resource, url: user_session_path do |f| %>
+ <%= f.email_field :email, required: true, size: 30, autofocus: true, autocomplete: "email" %>
+ <%= f.password_field :password, required: true, size: 30, minlength: @minimum_password_length,
+ autocomplete: "current-password" %>
- <% if devise_mapping.rememberable? %>
- <%= f.check_box :remember_me, label: t(".remember_me") %>
+ <% if devise_mapping.rememberable? %>
+ <%= f.check_box :remember_me, label: t(".remember_me") %>
+ <% end %>
+
+ <%= f.submit t(:sign_in) %>
<% end %>
- <%= f.submit t(:sign_in) %>
-<% end %>
-
-<%= content_tag :p, t(:or), style: "text-align: center;" %>
-<%= image_link_to t(:recover_password), 'lock-reset', new_user_password_path, class: 'centered' %>
+ <%= content_tag :p, t(:or), style: "text-align: center;" %>
+ <%= image_link_to t(:recover_password), 'lock-reset', new_user_password_path,
+ class: 'centered' %>
+
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 8992456..f1d264a 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -62,14 +62,17 @@ en:
All data will be irretrievably lost.
delete: Delete profile
unconfirmed_email_hint: (since %{timestamp})
- blank_password_hint_html: leave blank to keep unchanged%{subhint}
- minimum_length_hint_html:
- zero:
- other:
(%{count} characters minimum)
+ new_password: New password
+ password_confirmation: Retype new password
+ blank_password_hint: leave blank to keep unchanged
%{subhint}
update: Update profile
sessions:
new:
remember_me: Remember me
+ minimum_password_length:
+ zero:
+ one: (%{count} character minimum)
+ other: (%{count} characters minimum)
actions: Actions
add: Add
back: Back
diff --git a/test/system/users_test.rb b/test/system/users_test.rb
index ed52d30..0440c27 100644
--- a/test/system/users_test.rb
+++ b/test/system/users_test.rb
@@ -176,25 +176,25 @@ class UsersTest < ApplicationSystemTestCase
assert_current_path users_path
end
- test "update status disallowed" do
+ test "update status fails for admin when disallowed" do
sign_in user: users.select(&:admin?).select(&:confirmed?).sample
visit users_path
within all(:xpath, "//tbody//tr[not(descendant::select)]").sample do |tr|
user = User.find_by_email!(first(:link).text)
- inject_button_to first('td'), "update status", user_path(user), method: :patch,
- params: {user: {status: User.statuses.keys.sample}}
+ inject_button_to first('td:not(.link)'), "update status", user_path(user), method: :patch,
+ params: {user: {status: User.statuses.keys.sample}}, data: {turbo: false}
click_on "update status"
end
- assert_title "Bad request received (400)"
+ assert_title 'The change you wanted was rejected (422)'
end
test "update status forbidden for non admin" do
sign_in user: users.reject(&:admin?).select(&:confirmed?).sample
- visit root_path
+ visit units_path
inject_button_to find('body'), "update status", user_path(User.all.sample), method: :patch,
params: {user: {status: User.statuses.keys.sample}}
click_on "update status"
- assert_title "Access is forbidden to this page (403)"
+ assert_text t('actioncontroller.exceptions.status.forbidden')
end
end