From e019de07b73f4b7f14d6c55b0ea207980b3959cd Mon Sep 17 00:00:00 2001 From: Eric Binnion Date: Wed, 9 Dec 2015 12:55:02 -0600 Subject: [PATCH 1/3] Me: Fixes 2fa via app layout --- client/me/security-2fa-enable/index.jsx | 81 +++++++++++++----------- client/me/security-2fa-enable/style.scss | 33 ++++------ 2 files changed, 55 insertions(+), 59 deletions(-) diff --git a/client/me/security-2fa-enable/index.jsx b/client/me/security-2fa-enable/index.jsx index b12721ad89be1..28e6a420ef3b7 100644 --- a/client/me/security-2fa-enable/index.jsx +++ b/client/me/security-2fa-enable/index.jsx @@ -178,22 +178,54 @@ module.exports = React.createClass( { } }, + getToggleLink: function() { + return ( + + ); + }, + renderQRCode: function() { return ( -
-

- { this.translate( 'Scan this QR code with your mobile app:' ) } +

+

+ { + this.translate( + "Scan this QR code with your mobile app. {{toggleMethodLink}}Can't scan the barcode?{{/toggleMethodLink}}", { + components: { + toggleMethodLink: this.getToggleLink() + } + } + ) + }

- { this.state.otpAuthUri ? : null } +
+ { this.state.otpAuthUri && + + } +
); }, renderTimeCode: function() { return ( -
-

- { this.translate( 'Enter this time code into your mobile app:' ) } +

+

+ { + this.translate( + 'Enter this time code into your mobile app. {{toggleMethodLink}}Prefer to scan the barcode?{{/toggleMethodLink}}', { + components: { + toggleMethodLink: this.getToggleLink() + } + } + ) + }

{ this.state.timeCode } @@ -208,11 +240,8 @@ module.exports = React.createClass( { } return ( -

-

- { this.translate( 'First', { context: 'The first thing we want the user to do for Two-Step setup.' } ) } -

- { ( 'scan' === this.state.method ) ? this.renderQRCode() : this.renderTimeCode() } +
+ { 'scan' === this.state.method ? this.renderQRCode() : this.renderTimeCode() }
); }, @@ -226,11 +255,7 @@ module.exports = React.createClass( { return (

- { - 'scan' === this.state.method - ? this.translate( 'Enter the code your app gives you after scanning:' ) - : this.translate( 'Enter the code your app gives you after entering the time code:' ) - } + { this.translate( 'Then enter the six digit code provided by the app:' ) }

); }, @@ -275,17 +300,6 @@ module.exports = React.createClass( { ) }

-

- - { 'scan' === this.state.method ? this.translate( "Can't scan the barcode?" ) : this.translate( 'Prefer to scan the barcode?' ) } - -

); }, @@ -312,15 +326,6 @@ module.exports = React.createClass( { renderInputBlock: function() { return (
- { - 'sms' !== this.state.method - ? ( -

- { this.translate( 'Next', { context: 'The next thing we want the user to do for Two-Step setup.' } ) } -

- ) - : null - } { this.renderInputHelp() } +
Date: Wed, 9 Dec 2015 15:01:27 -0600 Subject: [PATCH 2/3] Me: Adds placeholder styles while waiting for QR code --- client/me/security-2fa-enable/index.jsx | 9 +++++++-- client/me/security-2fa-enable/style.scss | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/client/me/security-2fa-enable/index.jsx b/client/me/security-2fa-enable/index.jsx index 28e6a420ef3b7..05b350a48dee0 100644 --- a/client/me/security-2fa-enable/index.jsx +++ b/client/me/security-2fa-enable/index.jsx @@ -3,7 +3,8 @@ */ var React = require( 'react' ), debug = require( 'debug' )( 'calypso:me:security:2fa-enable' ), - QRCode = require( 'qrcode.react' ); + QRCode = require( 'qrcode.react' ), + classNames = require( 'classnames' ); /** * Internal dependencies @@ -191,6 +192,10 @@ module.exports = React.createClass( { }, renderQRCode: function() { + var qrClasses = classNames( 'security-2fa-enable__qr-code', { + 'is-placeholder': ! this.state.otpAuthUri + } ); + return (

@@ -204,7 +209,7 @@ module.exports = React.createClass( { ) }

-
+
{ this.state.otpAuthUri && } diff --git a/client/me/security-2fa-enable/style.scss b/client/me/security-2fa-enable/style.scss index 72ce39a6d10a0..59566cf0a54a5 100644 --- a/client/me/security-2fa-enable/style.scss +++ b/client/me/security-2fa-enable/style.scss @@ -11,6 +11,10 @@ height: 150px; width: 150px; margin: 0 auto; + + &.is-placeholder { + @include placeholder( 23% ); + } } .security-2fa-enable__app-options { From 9d94e0551f08decd563ddcda8514e0b6a21d1830 Mon Sep 17 00:00:00 2001 From: Eric Binnion Date: Wed, 9 Dec 2015 15:02:07 -0600 Subject: [PATCH 3/3] Me: In 2fa via app flow, toggle method before analytics --- client/me/security-2fa-enable/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/me/security-2fa-enable/index.jsx b/client/me/security-2fa-enable/index.jsx index 05b350a48dee0..285995f17fefd 100644 --- a/client/me/security-2fa-enable/index.jsx +++ b/client/me/security-2fa-enable/index.jsx @@ -184,8 +184,8 @@ module.exports = React.createClass( { );