Skip to content

Commit

Permalink
Add test to optionally keep other sessions when modifying a user's pa…
Browse files Browse the repository at this point in the history
…ssword. (#832)
  • Loading branch information
clokep authored Mar 18, 2020
1 parent 51e6d2f commit c0c8009
Showing 1 changed file with 33 additions and 1 deletion.
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

0 comments on commit c0c8009

Please sign in to comment.