forked from fixin.me/fixin.me
parent
50c1be4647
commit
dec3af27bf
@ -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 %>
|
||||
|
@ -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) %>
|
||||
<div class"main">
|
||||
<%= 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 %>
|
||||
</div>
|
||||
|
@ -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 %>
|
||||
</td>
|
||||
@ -27,7 +28,7 @@
|
||||
<td><%= user.created_at.to_fs(:db_without_sec) %></td>
|
||||
<td class="actions">
|
||||
<% 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 %>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -1,9 +0,0 @@
|
||||
<h1>New user</h1>
|
||||
|
||||
<%= render "form", user: @user %>
|
||||
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<%= link_to "Back to users", users_path %>
|
||||
</div>
|
@ -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 %>
|
||||
<div class"main">
|
||||
<%= 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 %>
|
||||
</div>
|
||||
|
@ -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" %>
|
||||
<div class"main">
|
||||
<%= 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 %>
|
||||
</div>
|
||||
|
@ -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 %>
|
||||
|
@ -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" %>
|
||||
<div class"main">
|
||||
<%= 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" %>
|
||||
</div>
|
||||
|
@ -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" %>
|
||||
<div class"main">
|
||||
<%= 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' %>
|
||||
</div>
|
||||
|
@ -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: <br>(%{count} characters minimum)
|
||||
new_password: New password
|
||||
password_confirmation: Retype new password
|
||||
blank_password_hint: leave blank to keep unchanged<br>%{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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user