<%= f.password_field :password, :autocomplete => "on", :tabindex => 2, :value => "", :skip_label => true %>
<%= f.form_group do %>
- <%= f.check_box :remember_me, { :label => t(".remember"), :tabindex => 3, :checked => (params[:remember_me] == "yes") }, "yes" %>
+ <%= f.check_box :remember_me, { :label => t(".remember"), :tabindex => 3, :checked => (params[:remember_me] == "true") }, "yes" %>
<% end %>
<div class="mb-3">
assert_redirected_to root_path
end
+ def test_login_remembered
+ user = create(:user)
+
+ post login_path, :params => { :username => user.display_name, :password => "test", :remember_me => "yes" }
+ assert_redirected_to root_path
+
+ assert_equal 28 * 86400, session[:_remember_for]
+ end
+
+ def test_login_not_remembered
+ user = create(:user)
+
+ post login_path, :params => { :username => user.display_name, :password => "test", :remember_me => "0" }
+ assert_redirected_to root_path
+
+ assert_nil session[:_remember_for]
+ end
+
def test_logout_without_referer
post logout_path
assert_redirected_to root_path