Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions tests/cypress/e2e/logout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ describe('Logout tests', () => {
it('Admin can logout', () => {
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options');
cy.get('#mailchimp_sf_oauth_connect').should('not.exist');

cy.on('window:confirm', (text) => {
expect(text).to.contains('Are you sure you want to log out?');
return true;
});

cy.get('input[value="Logout"]').click();

// connect to "Mailchimp" Account button should be visible.
Expand Down
2 changes: 1 addition & 1 deletion views/setup_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<td><h3><?php esc_html_e( 'Logged in as', 'mailchimp' ); ?>: <?php echo esc_html( $user['username'] ); ?></h3>
</td>
<td>
<form method="post" action="">
<form method="post" action="" onsubmit="return confirm('<?php echo esc_js( __( 'Are you sure you want to log out?', 'mailchimp' ) ); ?>');">
<input type="hidden" name="mcsf_action" value="logout"/>
<input type="submit" name="Submit" value="<?php esc_attr_e( 'Logout', 'mailchimp' ); ?>" class="button button-secondary mailchimp-sf-button small" />
<?php wp_nonce_field( 'mc_logout', '_mcsf_nonce_action' ); ?>
Expand Down