forked from fixin.me/fixin.me
parent
50c1be4647
commit
dec3af27bf
@ -29,7 +29,7 @@
|
|||||||
<%= image_link_to current_user.email, "account-wrench-outline",
|
<%= image_link_to current_user.email, "account-wrench-outline",
|
||||||
edit_user_registration_path, current: :hide %>
|
edit_user_registration_path, current: :hide %>
|
||||||
<% if current_user_disguised? %>
|
<% 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 %>
|
<% else %>
|
||||||
<%= image_button_to t(".sign_out"), "logout", destroy_user_session_path,
|
<%= image_button_to t(".sign_out"), "logout", destroy_user_session_path,
|
||||||
method: :delete %>
|
method: :delete %>
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<%= tabular_form_for resource, url: user_confirmation_path, html: { method: :post } do |f| %>
|
<div class"main">
|
||||||
<%= f.email_field :email, required: true, size: 30, autofocus: true, autocomplete: "email",
|
<%= tabular_form_for resource, url: user_confirmation_path do |f| %>
|
||||||
value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
<%= 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) %>
|
<%= f.submit t(:resend_confirmation) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
<%= user.status %>
|
<%= user.status %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= form_for user do |u| %>
|
<%= 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 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
@ -27,7 +28,7 @@
|
|||||||
<td><%= user.created_at.to_fs(:db_without_sec) %></td>
|
<td><%= user.created_at.to_fs(:db_without_sec) %></td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<% if allow_disguise?(user) %>
|
<% 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 %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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| %>
|
<div class"main">
|
||||||
<%= 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"),
|
<%= f.password_field :password, label: t(".new_password"), required: true, size: 30,
|
||||||
required: true, size: 30, autofocus: true, autocomplete: "new-password",
|
minlength: @minimum_password_length, autofocus: true, autocomplete: "new-password",
|
||||||
hint: ("(#{@minimum_password_length} characters minimum)" if @minimum_password_length) %>
|
hint: t("users.minimum_password_length", count: @minimum_password_length) %>
|
||||||
<%= f.password_field :password_confirmation, label: t(".password_confirmation"),
|
<%= f.password_field :password_confirmation, label: t(".password_confirmation"),
|
||||||
required: true, size: 30, autocomplete: "new-password" %>
|
required: true, size: 30, minlength: @minimum_password_length, autocomplete: "off" %>
|
||||||
|
|
||||||
<%= f.submit t(".update_password") %>
|
<%= f.submit t(".update_password") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<%= tabular_form_for resource, url: user_password_path, html: { method: :post } do |f| %>
|
<div class"main">
|
||||||
<%= 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) %>
|
<%= f.submit t(:recover_password) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
@ -19,10 +19,12 @@
|
|||||||
|
|
||||||
<%= f.select :status, User.statuses, readonly: true %>
|
<%= f.select :status, User.statuses, readonly: true %>
|
||||||
|
|
||||||
<%= f.password_field :password, size: 30, autocomplete: "off",
|
<%= f.password_field :password, label: t(".new_password"), size: 30,
|
||||||
hint: t(".blank_password_hint_html",
|
minlength: @minimum_password_length, autocomplete: "new-password",
|
||||||
subhint: t(".minimum_length_hint_html", count: @minimum_password_length)) %>
|
hint: t(".blank_password_hint",
|
||||||
<%= f.password_field :password_confirmation, size: 30, autocomplete: "off" %>
|
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") %>
|
<%= f.submit t(".update") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
<%= tabular_form_for resource, url: user_registration_path do |f| %>
|
<div class"main">
|
||||||
<%= f.email_field :email, required: true, size: 30, autofocus: true, autocomplete: "email" %>
|
<%= tabular_form_for resource, url: user_registration_path do |f| %>
|
||||||
<%= f.password_field :password, required: true, size: 30, minlength: @minimum_password_length,
|
<%= f.email_field :email, required: true, size: 30, autofocus: true, autocomplete: "email" %>
|
||||||
autocomplete: "new-password",
|
<%= f.password_field :password, required: true, size: 30,
|
||||||
hint: ("(#{@minimum_password_length} characters minimum)" if @minimum_password_length) %>
|
minlength: @minimum_password_length, autocomplete: "new-password",
|
||||||
<%= f.password_field :password_confirmation, label: t(".password_confirmation"),
|
hint: t("users.minimum_password_length", count: @minimum_password_length) %>
|
||||||
required: true, size: 30, autocomplete: "new-password" %>
|
<%= f.password_field :password_confirmation, label: t(".password_confirmation"),
|
||||||
|
required: true, size: 30, minlength: @minimum_password_length, autocomplete: "off" %>
|
||||||
|
|
||||||
<%= f.submit t(:register) %>
|
<%= f.submit t(:register) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= content_tag :p, t(:or), style: "text-align: center;" %>
|
<%= content_tag :p, t(:or), style: "text-align: center;" %>
|
||||||
<%= image_link_to t(:resend_confirmation), "email-sync-outline", new_user_confirmation_path,
|
<%= image_link_to t(:resend_confirmation), "email-sync-outline", new_user_confirmation_path,
|
||||||
class: "centered" %>
|
class: "centered" %>
|
||||||
|
</div>
|
||||||
|
@ -1,13 +1,17 @@
|
|||||||
<%= tabular_form_for resource, url: user_session_path do |f| %>
|
<div class"main">
|
||||||
<%= f.email_field :email, required: true, size: 30, autofocus: true, autocomplete: "email" %>
|
<%= tabular_form_for resource, url: user_session_path do |f| %>
|
||||||
<%= f.password_field :password, required: true, size: 30, autocomplete: "current-password" %>
|
<%= 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? %>
|
<% if devise_mapping.rememberable? %>
|
||||||
<%= f.check_box :remember_me, label: t(".remember_me") %>
|
<%= f.check_box :remember_me, label: t(".remember_me") %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= f.submit t(:sign_in) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= f.submit t(:sign_in) %>
|
<%= content_tag :p, t(:or), style: "text-align: center;" %>
|
||||||
<% end %>
|
<%= image_link_to t(:recover_password), 'lock-reset', new_user_password_path,
|
||||||
|
class: 'centered' %>
|
||||||
<%= content_tag :p, t(:or), style: "text-align: center;" %>
|
</div>
|
||||||
<%= image_link_to t(:recover_password), 'lock-reset', new_user_password_path, class: 'centered' %>
|
|
||||||
|
@ -62,14 +62,17 @@ en:
|
|||||||
All data will be irretrievably lost.
|
All data will be irretrievably lost.
|
||||||
delete: Delete profile
|
delete: Delete profile
|
||||||
unconfirmed_email_hint: (since %{timestamp})
|
unconfirmed_email_hint: (since %{timestamp})
|
||||||
blank_password_hint_html: leave blank to keep unchanged%{subhint}
|
new_password: New password
|
||||||
minimum_length_hint_html:
|
password_confirmation: Retype new password
|
||||||
zero:
|
blank_password_hint: leave blank to keep unchanged<br>%{subhint}
|
||||||
other: <br>(%{count} characters minimum)
|
|
||||||
update: Update profile
|
update: Update profile
|
||||||
sessions:
|
sessions:
|
||||||
new:
|
new:
|
||||||
remember_me: Remember me
|
remember_me: Remember me
|
||||||
|
minimum_password_length:
|
||||||
|
zero:
|
||||||
|
one: (%{count} character minimum)
|
||||||
|
other: (%{count} characters minimum)
|
||||||
actions: Actions
|
actions: Actions
|
||||||
add: Add
|
add: Add
|
||||||
back: Back
|
back: Back
|
||||||
|
@ -176,25 +176,25 @@ class UsersTest < ApplicationSystemTestCase
|
|||||||
assert_current_path users_path
|
assert_current_path users_path
|
||||||
end
|
end
|
||||||
|
|
||||||
test "update status disallowed" do
|
test "update status fails for admin when disallowed" do
|
||||||
sign_in user: users.select(&:admin?).select(&:confirmed?).sample
|
sign_in user: users.select(&:admin?).select(&:confirmed?).sample
|
||||||
visit users_path
|
visit users_path
|
||||||
|
|
||||||
within all(:xpath, "//tbody//tr[not(descendant::select)]").sample do |tr|
|
within all(:xpath, "//tbody//tr[not(descendant::select)]").sample do |tr|
|
||||||
user = User.find_by_email!(first(:link).text)
|
user = User.find_by_email!(first(:link).text)
|
||||||
inject_button_to first('td'), "update status", user_path(user), method: :patch,
|
inject_button_to first('td:not(.link)'), "update status", user_path(user), method: :patch,
|
||||||
params: {user: {status: User.statuses.keys.sample}}
|
params: {user: {status: User.statuses.keys.sample}}, data: {turbo: false}
|
||||||
click_on "update status"
|
click_on "update status"
|
||||||
end
|
end
|
||||||
assert_title "Bad request received (400)"
|
assert_title 'The change you wanted was rejected (422)'
|
||||||
end
|
end
|
||||||
|
|
||||||
test "update status forbidden for non admin" do
|
test "update status forbidden for non admin" do
|
||||||
sign_in user: users.reject(&:admin?).select(&:confirmed?).sample
|
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,
|
inject_button_to find('body'), "update status", user_path(User.all.sample), method: :patch,
|
||||||
params: {user: {status: User.statuses.keys.sample}}
|
params: {user: {status: User.statuses.keys.sample}}
|
||||||
click_on "update status"
|
click_on "update status"
|
||||||
assert_title "Access is forbidden to this page (403)"
|
assert_text t('actioncontroller.exceptions.status.forbidden')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user