Skip to content

Commit 423be9d

Browse files
authored
Merge pull request #149 from mailchimp/fix/147
Add a confirmation prompt before logging out the user.
2 parents 908e4d0 + cb7439f commit 423be9d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

tests/cypress/e2e/logout.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ describe('Logout tests', () => {
77
it('Admin can logout', () => {
88
cy.visit('/wp-admin/admin.php?page=mailchimp_sf_options');
99
cy.get('#mailchimp_sf_oauth_connect').should('not.exist');
10+
11+
cy.on('window:confirm', (text) => {
12+
expect(text).to.contains('Are you sure you want to log out?');
13+
return true;
14+
});
15+
1016
cy.get('input[value="Logout"]').click();
1117

1218
// connect to "Mailchimp" Account button should be visible.

views/setup_page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<td><h3><?php esc_html_e( 'Logged in as', 'mailchimp' ); ?>: <?php echo esc_html( $user['username'] ); ?></h3>
2222
</td>
2323
<td>
24-
<form method="post" action="">
24+
<form method="post" action="" onsubmit="return confirm('<?php echo esc_js( __( 'Are you sure you want to log out?', 'mailchimp' ) ); ?>');">
2525
<input type="hidden" name="mcsf_action" value="logout"/>
2626
<input type="submit" name="Submit" value="<?php esc_attr_e( 'Logout', 'mailchimp' ); ?>" class="button button-secondary mailchimp-sf-button small" />
2727
<?php wp_nonce_field( 'mc_logout', '_mcsf_nonce_action' ); ?>

0 commit comments

Comments
 (0)