From 0e0f602d5e1423eb1665bc794e03e81a1c17fb61 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Wed, 7 Dec 2016 19:21:29 +0100 Subject: [PATCH] pass fields to query into QueryCode --- js/src/modals/Verification/QueryCode/queryCode.js | 13 +++++++++---- js/src/modals/Verification/verification.js | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/js/src/modals/Verification/QueryCode/queryCode.js b/js/src/modals/Verification/QueryCode/queryCode.js index 03b228367..db0ae25eb 100644 --- a/js/src/modals/Verification/QueryCode/queryCode.js +++ b/js/src/modals/Verification/QueryCode/queryCode.js @@ -20,20 +20,25 @@ import { Form, Input } from '~/ui'; export default class QueryCode extends Component { static propTypes = { - number: PropTypes.string.isRequired, + receiver: PropTypes.string.isRequired, + hint: PropTypes.string, isCodeValid: PropTypes.bool.isRequired, setCode: PropTypes.func.isRequired } + static defaultProps = { + hint: 'Enter the code you received.' + } + render () { - const { number, isCodeValid } = this.props; + const { receiver, hint, isCodeValid } = this.props; return (
-

The verification code has been sent to { number }.

+

The verification code has been sent to { receiver }.

{ error }

); } + const { method } = this.state; if (phase === 0) { - const { method } = this.state; const values = Object.values(methods); const value = values.findIndex((v) => v.value === method); return ( @@ -185,7 +185,6 @@ export default class Verification extends Component { ); case 2: - const { method } = this.state; const { setConsentGiven } = this.props.store; const fields = [] @@ -221,9 +220,19 @@ export default class Verification extends Component { ); case 4: + let receiver, hint; + if (method === 'sms') { + receiver = this.props.store.number; + hint = 'Enter the code you received via SMS.'; + } else if (method === 'email') { + receiver = this.props.store.email; + hint = 'Enter the code you received via e-mail.'; + } return ( );