1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-31 19:47:14 +00:00

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
This commit is contained in:
Go MAEDA 2024-12-08 06:40:47 +00:00
parent ab4bca896e
commit 4f761e34e8
8 changed files with 16 additions and 16 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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 %>

View File

@ -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>

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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",