summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-12-08 06:40:47 +0000
committerGo MAEDA <maeda@farend.jp>2024-12-08 06:40:47 +0000
commit4f761e34e89cad617441abee78eb03bd1d935169 (patch)
tree4bc95c3e8bd05cbf2a77f446c493295af3408f00
parentab4bca896ed7402a053cca9eedc8dd32184d97a4 (diff)
downloadredmine-4f761e34e89cad617441abee78eb03bd1d935169.tar.gz
redmine-4f761e34e89cad617441abee78eb03bd1d935169.zip
Enable browser autocomplete for login input fields (#41937).
Contributed by Thomas Butz (user:otbutz). git-svn-id: https://svn.redmine.org/redmine/trunk@23361 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/views/account/login.html.erb4
-rw-r--r--app/views/account/password_recovery.html.erb4
-rw-r--r--app/views/my/password.html.erb6
-rw-r--r--app/views/sudo_mode/_new_modal.html.erb2
-rw-r--r--app/views/sudo_mode/new.html.erb2
-rw-r--r--test/functional/account_controller_test.rb4
-rw-r--r--test/functional/my_controller_test.rb6
-rw-r--r--test/integration/account_test.rb4
8 files changed, 16 insertions, 16 deletions
diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb
index 27878bc7e..fb8085d71 100644
--- a/app/views/account/login.html.erb
+++ b/app/views/account/login.html.erb
@@ -5,13 +5,13 @@
<%= back_url_hidden_field_tag %>
<label for="username"><%=l(:field_login)%></label>
- <%= text_field_tag 'username', params[:username], :tabindex => '1', :autofocus => params[:username].blank? %>
+ <%= text_field_tag 'username', params[:username], :tabindex => '1', :autocomplete => 'username', :autofocus => params[:username].blank? %>
<label for="password">
<%=l(:field_password)%>
<%= link_to l(:label_password_lost), lost_password_path, :class => "lost_password" if Setting.lost_password? %>
</label>
- <%= password_field_tag 'password', nil, :tabindex => '2', :autofocus => params[:username].present? %>
+ <%= password_field_tag 'password', nil, :tabindex => '2', :autocomplete => 'current-password', :autofocus => params[:username].present? %>
<% if Setting.autologin? %>
<label for="autologin"><%= check_box_tag 'autologin', 1, false, :tabindex => 4 %> <%= l(:label_stay_logged_in) %></label>
diff --git a/app/views/account/password_recovery.html.erb b/app/views/account/password_recovery.html.erb
index 0c275b476..a3556ce75 100644
--- a/app/views/account/password_recovery.html.erb
+++ b/app/views/account/password_recovery.html.erb
@@ -7,7 +7,7 @@
<div class="box tabular">
<p>
<label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
- <%= password_field_tag 'new_password', nil, :size => 25 %>
+ <%= password_field_tag 'new_password', nil, :size => 25, :autocomplete => 'new-password' %>
<em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
<% if Setting.password_required_char_classes.any? %>
<em class="info"><%= l(:text_characters_must_contain, :character_classes => Setting.password_required_char_classes.collect{|c| l("label_password_char_class_#{c}")}.join(", ")) %></em>
@@ -16,7 +16,7 @@
<p>
<label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
- <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %>
+ <%= password_field_tag 'new_password_confirmation', nil, :size => 25, :autocomplete => 'new-password' %>
</p>
</div>
<p><%= submit_tag l(:button_save) %></p>
diff --git a/app/views/my/password.html.erb b/app/views/my/password.html.erb
index 91f66ccd7..ad17de4c6 100644
--- a/app/views/my/password.html.erb
+++ b/app/views/my/password.html.erb
@@ -5,10 +5,10 @@
<%= form_tag({}, :class => "tabular") do %>
<div class="box">
<p><label for="password"><%=l(:field_current_password)%> <span class="required">*</span></label>
-<%= password_field_tag 'password', nil, :size => 25 %></p>
+<%= password_field_tag 'password', nil, :size => 25, :autocomplete => 'current-password' %></p>
<p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
-<%= password_field_tag 'new_password', nil, :size => 25 %>
+<%= password_field_tag 'new_password', nil, :size => 25, :autocomplete => 'new-password' %>
<em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
<% if Setting.password_required_char_classes.any? %>
<em class="info"><%= l(:text_characters_must_contain, :character_classes => Setting.password_required_char_classes.collect{|c| l("label_password_char_class_#{c}")}.join(", ")) %></em>
@@ -16,7 +16,7 @@
</p>
<p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
-<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
+<%= password_field_tag 'new_password_confirmation', nil, :size => 25, :autocomplete => 'new-password' %></p>
</div>
<%= submit_tag l(:button_apply) %>
<% end %>
diff --git a/app/views/sudo_mode/_new_modal.html.erb b/app/views/sudo_mode/_new_modal.html.erb
index 8c86436cf..d259c5a2a 100644
--- a/app/views/sudo_mode/_new_modal.html.erb
+++ b/app/views/sudo_mode/_new_modal.html.erb
@@ -8,7 +8,7 @@
<div class="box tabular">
<p>
<label for="sudo_password"><%= l :field_password %><span class="required">*</span></label>
- <%= password_field_tag :sudo_password, nil, size: 25 %>
+ <%= password_field_tag :sudo_password, nil, size: 25, :autocomplete => 'current-password' %>
<br/><%= link_to l(:label_password_lost), lost_password_path, :class => "lost_password" if Setting.lost_password? %>
</p>
</div>
diff --git a/app/views/sudo_mode/new.html.erb b/app/views/sudo_mode/new.html.erb
index cd25ea1d6..6bf87cc8d 100644
--- a/app/views/sudo_mode/new.html.erb
+++ b/app/views/sudo_mode/new.html.erb
@@ -8,7 +8,7 @@
<div class="box">
<p>
<label for="sudo_password"><%= l :field_password %><span class="required">*</span></label>
- <%= password_field_tag :sudo_password, nil, size: 25, autofocus: true %>
+ <%= password_field_tag :sudo_password, nil, size: 25, :autocomplete => 'current-password', autofocus: true %>
</br><%= link_to l(:label_password_lost), lost_password_path, :class => "lost_password" if Setting.lost_password? %>
</p>
</div>
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb
index 083b2bafd..4954f3292 100644
--- a/test/functional/account_controller_test.rb
+++ b/test/functional/account_controller_test.rb
@@ -30,8 +30,8 @@ class AccountControllerTest < Redmine::ControllerTest
get :login
assert_response :success
- assert_select 'input[name=username]'
- assert_select 'input[name=password]'
+ assert_select 'input[name=username][autocomplete=username]'
+ assert_select 'input[name=password][autocomplete=current-password]'
end
def test_get_login_while_logged_in_should_redirect_to_back_url_if_present
diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb
index b485b5c9a..b311854f1 100644
--- a/test/functional/my_controller_test.rb
+++ b/test/functional/my_controller_test.rb
@@ -605,9 +605,9 @@ class MyControllerTest < Redmine::ControllerTest
def test_change_password
get :password
assert_response :success
- assert_select 'input[type=password][name=password]'
- assert_select 'input[type=password][name=new_password]'
- assert_select 'input[type=password][name=new_password_confirmation]'
+ assert_select 'input[type=password][name=password][autocomplete=current-password]'
+ assert_select 'input[type=password][name=new_password][autocomplete=new-password]'
+ assert_select 'input[type=password][name=new_password_confirmation][autocomplete=new-password]'
end
def test_update_password
diff --git a/test/integration/account_test.rb b/test/integration/account_test.rb
index 1953588b6..e40584152 100644
--- a/test/integration/account_test.rb
+++ b/test/integration/account_test.rb
@@ -136,8 +136,8 @@ class AccountTest < Redmine::IntegrationTest
follow_redirect!
assert_response :success
assert_select 'input[type=hidden][name=token][value=?]', token.value
- assert_select 'input[name=new_password]'
- assert_select 'input[name=new_password_confirmation]'
+ assert_select 'input[name=new_password][autocomplete=new-password]'
+ assert_select 'input[name=new_password_confirmation][autocomplete=new-password]'
post(
"/account/lost_password",