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

Me: Use Redux analytics instead of eventRecorder in Security2faSetupBackupCodes #20198

Merged
merged 5 commits into from
Nov 27, 2017

Conversation

tyxla
Copy link
Member

@tyxla tyxla commented Nov 24, 2017

This PR refactors Security2faSetupBackupCodes to:

  • Use Redux analytics instead of eventRecorder.
  • Remove all mixins, specifically eventRecorder.
  • Convert from createReactClass to a React.Component.
  • Remove some unnecessary debug code.
  • Sort some imports 🔤 .
  • Remove var usages in favor of const/let.

This PR should not introduce any visual changes.

Part of #20053.

To test:

  • Checkout this branch
  • Go to http://calypso.localhost:3000/me/security/two-step
  • Disable two step auth if it's enabled.
  • Apply the following diff to your Calypso (see below)
  • Refresh the page.
  • Start the two-step auth setup process.
  • On the last step where the codes are generated, verify the right analytics events are tracked when clicking the support link on the failure screen.
  • Verify everything else in the backup codes / two factor auth process works like it did before.

Diff to make backup code generation fail:

diff --git a/client/lib/two-step-authorization/index.js b/client/lib/two-step-authorization/index.js
index cc0e2732a7..af89d9dbc6 100644
--- a/client/lib/two-step-authorization/index.js
+++ b/client/lib/two-step-authorization/index.js
@@ -153,6 +153,8 @@ TwoStepAuthorization.prototype.sendSMSCode = function( callback ) {
  * Fetches a new set of backup codes by calling /me/two-step/backup-codes/new
  */
 TwoStepAuthorization.prototype.backupCodes = function( callback ) {
+       callback( 'Some error' );
+       return;
        wpcom.me().backupCodes(
                function( error, data ) {
                        if ( error ) {

@tyxla tyxla added [Feature] User & Account Settings (/me) Settings and tools for managing your WordPress.com user account. Security [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Type] Janitorial labels Nov 24, 2017
@tyxla tyxla self-assigned this Nov 24, 2017
@matticbot
Copy link
Contributor

@tyxla tyxla requested a review from a team November 24, 2017 13:36
@ockham
Copy link
Contributor

ockham commented Nov 24, 2017

  • Force a failure of backup codes retrieval (you can do it quickly in TwoStepAuthorization.prototype.backupCodes).

Uh, how specifically? My attempts so far didn't get me anywhere 😁

@tyxla tyxla changed the title Me: Use Redux analytics instead of eventRecorder in Security2faBackupCodes Me: Use Redux analytics instead of eventRecorder in Security2faSetupBackupCodes Nov 25, 2017
@tyxla
Copy link
Member Author

tyxla commented Nov 27, 2017

@ockham I realize those testing instructions are a total mess 😉 Sorry about that.

I've updated them a bit, please ping me if you need details when you have a minute to test this one. Thanks!

Copy link
Contributor

@ockham ockham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updated instructions! Confirmed to work fine now. 👍

@tyxla tyxla added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Nov 27, 2017
@tyxla tyxla merged commit 0aeda5c into master Nov 27, 2017
@tyxla tyxla deleted the cleanup/event-recorder-security-2fa-setup-backup-codes branch November 27, 2017 13:27
bluefuton pushed a commit that referenced this pull request Nov 28, 2017
…ackupCodes (#20198)

* Me: Use Redux analytics in Security2faSetupBackupCodes

* Me: Remove unnecessary debug code in Security2faSetupBackupCodes

* Me: Refactor Security2faSetupBackupCodes to a React.Component

* Me: Sort some imports in Security2faSetupBackupCodes

* Me: Replace var usages in Security2faSetupBackupCodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] User & Account Settings (/me) Settings and tools for managing your WordPress.com user account. Security [Type] Janitorial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants