From 51f7060aa8464f51f78403f87b3556a7ffaa1995 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 10 May 2015 10:26:55 +0000 Subject: Add the ability to expire passwords after a configurable number of days (#19458). Patch by Holger Just and Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@14264 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/integration/account_test.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'test/integration') diff --git a/test/integration/account_test.rb b/test/integration/account_test.rb index 7f2f0e4ff..9ff6cc0a3 100644 --- a/test/integration/account_test.rb +++ b/test/integration/account_test.rb @@ -150,6 +150,40 @@ class AccountTest < Redmine::IntegrationTest assert_equal false, User.find_by_login('jsmith').must_change_passwd? end + def test_user_with_expired_password_should_be_forced_to_change_its_password + User.find_by_login('jsmith').update_attribute :passwd_changed_on, 14.days.ago + + with_settings :password_max_age => 7 do + post '/login', :username => 'jsmith', :password => 'jsmith' + assert_redirected_to '/my/page' + follow_redirect! + assert_redirected_to '/my/password' + + get '/issues' + assert_redirected_to '/my/password' + end + end + + def test_user_with_expired_password_should_be_able_to_change_its_password + User.find_by_login('jsmith').update_attribute :passwd_changed_on, 14.days.ago + + with_settings :password_max_age => 7 do + post '/login', :username => 'jsmith', :password => 'jsmith' + assert_redirected_to '/my/page' + follow_redirect! + assert_redirected_to '/my/password' + follow_redirect! + assert_response :success + post '/my/password', :password => 'jsmith', :new_password => 'newpassword', :new_password_confirmation => 'newpassword' + assert_redirected_to '/my/account' + follow_redirect! + assert_response :success + + assert_equal false, User.find_by_login('jsmith').must_change_passwd? + end + + end + def test_register_with_automatic_activation Setting.self_registration = '3' -- cgit v1.2.3