Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test to optionally keep other sessions when changing a password. #832

Merged
merged 1 commit into from
Mar 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion tests/14account/01change-password.pl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ sub matrix_set_password
})->then_done(1);
};

test "After changing password, a different session no longer works",
test "After changing password, a different session no longer works by default",
requires => [ local_user_fixture( password => $password ) ],

check => sub {
Expand All @@ -107,6 +107,38 @@ sub matrix_set_password
})->then_done(1);
};

test "After changing password, different sessions can optionally be kept",
requires => [ local_user_fixture( password => $password ) ],

check => sub {
my ( $user ) = @_;

my $other_login;

matrix_login_again_with_user( $user )->then( sub {
( $other_login ) = @_;
# ensure other login works to start with
matrix_sync( $other_login );
})->then( sub {
do_request_json_for( $user,
method => "POST",
uri => "/r0/account/password",
content => {
auth => {
type => "m.login.password",
user => $user->user_id,
password => $password,
},
new_password => "my new password",
logout_devices => JSON::false,
},
);
})->then( sub {
# The access token should still be valid.
matrix_sync( $other_login );
})->then_done(1);
};

test "Pushers created with a different access token are deleted on password change",
requires => [ local_user_fixture( password => $password ) ],

Expand Down