Option to force a user to change his password (#3872).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12081 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-08-05 17:58:33 +00:00
parent bd4fba08e5
commit b764e39847
10 changed files with 78 additions and 6 deletions

View File

@@ -128,6 +128,35 @@ class AccountTest < ActionController::IntegrationTest
assert_equal 0, Token.count
end
def test_user_with_must_change_passwd_should_be_forced_to_change_its_password
User.find_by_login('jsmith').update_attribute :must_change_passwd, true
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
def test_user_with_must_change_passwd_should_be_able_to_change_its_password
User.find_by_login('jsmith').update_attribute :must_change_passwd, true
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
def test_register_with_automatic_activation
Setting.self_registration = '3'