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 FormTelInput instead of FormTextInput #1399

Merged
merged 2 commits into from
Dec 9, 2015
Merged
Changes from 1 commit
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
Prev Previous commit
Me: Adds constants file for shared data and updates placeholders
  • Loading branch information
ebinnion committed Dec 9, 2015
commit dd6b9ec7f2141c60c8be141f9d70a0831402b761
19 changes: 19 additions & 0 deletions client/me/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Internal dependencies
*/
import i18n from 'lib/mixins/i18n';

export default {
sixDigit2faPlaceholder: i18n.translate( 'e.g. 123456', {
context: '6 digit two factor code placeholder.',
textOnly: true
} ),
sevenDigit2faPlaceholder: i18n.translate( 'e.g. 1234567', {
context: '7 digit two factor code placeholder.',
textOnly: true
} ),
eightDigitBackupCodePlaceholder: i18n.translate( 'e.g. 12345678', {
context: '8 digit two factor backup code placeholder.',
textOnly: true
} )
};
17 changes: 5 additions & 12 deletions client/me/reauth-required/index.jsx
Original file line number Diff line number Diff line change
@@ -18,7 +18,8 @@ var Dialog = require( 'components/dialog' ),
observe = require( 'lib/mixins/data-observe' ),
Notice = require( 'components/notice' ),
eventRecorder = require( 'me/event-recorder' ),
userUtilities = require( 'lib/user/utils' );
userUtilities = require( 'lib/user/utils' ),
constants = require( 'me/constants' );

module.exports = React.createClass( {

@@ -152,17 +153,9 @@ module.exports = React.createClass( {
},

render: function() {
var codePlaceholder = this.translate( 'e.g. 123456', {
context: '6 digit two factor code placeholder.',
textOnly: true
} );

if ( this.props.twoStepAuthorization.isTwoStepSMSEnabled() ) {
codePlaceholder = this.translate( 'e.g. 1234567', {
context: '7 digit two factor code placeholder.',
textOnly: true
} );
}
var codePlaceholder = this.props.twoStepAuthorization.isTwoStepSMSEnabled()
? constants.sevenDigit2faPlaceholder
: constants.sixDigit2faPlaceholder;

return (
<Dialog
5 changes: 3 additions & 2 deletions client/me/security-2fa-backup-codes-prompt/index.jsx
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@ var FormButton = require( 'components/forms/form-button' ),
FormTelInput = require( 'components/forms/form-tel-input' ),
Notice = require( 'components/notice' ),
twoStepAuthorization = require( 'lib/two-step-authorization' ),
analytics = require( 'analytics' );
analytics = require( 'analytics' ),
constants = require( 'me/constants' );

module.exports = React.createClass( {

@@ -129,7 +130,7 @@ module.exports = React.createClass( {
disabled={ this.state.submittingCode }
name="backup-code-entry"
autoComplete="off"
placeholder="12345678"
placeholder={ constants.eightDigitBackupCodePlaceholder }
valueLink={ this.linkState( 'backupCodeEntry' ) }
onFocus={ function() {
analytics.ga.recordEvent( 'Me', 'Focused On 2fa Backup Codes Confirm Printed Backup Codes Input' );
9 changes: 8 additions & 1 deletion client/me/security-2fa-code-prompt/index.jsx
Original file line number Diff line number Diff line change
@@ -14,7 +14,8 @@ var FormButton = require( 'components/forms/form-button' ),
FormTelInput = require( 'components/forms/form-tel-input' ),
Notice = require( 'components/notice' ),
twoStepAuthorization = require( 'lib/two-step-authorization' ),
analytics = require( 'analytics' );
analytics = require( 'analytics' ),
constants = require( 'me/constants' );

module.exports = React.createClass( {

@@ -193,14 +194,20 @@ module.exports = React.createClass( {
},

render: function() {
var codePlaceholder = twoStepAuthorization.isTwoStepSMSEnabled()
? constants.sevenDigit2faPlaceholder
: constants.sixDigit2faPlaceholder;

return (
<form className="security-2fa-code-prompt" onSubmit={ this.onSubmit }>
<FormFieldset>
<FormLabel htmlFor="verification-code">{ this.translate( 'Verification Code' ) }</FormLabel>
<FormTelInput
autoFocus
className="security-2fa-code-prompt__verification-code"
disabled={ this.state.submittingForm }
name="verification-code"
placeholder={ codePlaceholder }
autoComplete="off"
valueLink={ this.linkState( 'verificationCode' ) }
onFocus={ function() {
6 changes: 4 additions & 2 deletions client/me/security-2fa-enable/index.jsx
Original file line number Diff line number Diff line change
@@ -16,7 +16,8 @@ var FormButton = require( 'components/forms/form-button' ),
Notice = require( 'components/notice' ),
Security2faProgress = require( 'me/security-2fa-progress' ),
twoStepAuthorization = require( 'lib/two-step-authorization' ),
analytics = require( 'analytics' );
analytics = require( 'analytics' ),
constants = require( 'me/constants' );

module.exports = React.createClass( {

@@ -334,9 +335,10 @@ module.exports = React.createClass( {
{ this.renderInputHelp() }
<FormTelInput
autoComplete="off"
autoFocus
disabled={ this.state.submittingForm }
name="verification-code"
placeholder="123456"
placeholder={ 'sms' === this.state.method ? constants.sevenDigit2faPlaceholder : constants.sixDigit2faPlaceholder }
valueLink={ this.linkState( 'verificationCode' ) }
onFocus={ function() {
analytics.ga.recordEvent( 'Me', 'Focused On 2fa Enable Verification Code Input' );