diff --git a/js/src/contracts/abi/index.js b/js/src/contracts/abi/index.js index 80f49dc5b..dda43775e 100644 --- a/js/src/contracts/abi/index.js +++ b/js/src/contracts/abi/index.js @@ -23,6 +23,7 @@ import githubhint from './githubhint.json'; import owned from './owned.json'; import registry from './registry.json'; import signaturereg from './signaturereg.json'; +import smsVerification from './sms-verification.json'; import tokenreg from './tokenreg.json'; import wallet from './wallet.json'; @@ -36,6 +37,7 @@ export { owned, registry, signaturereg, + smsVerification, tokenreg, wallet }; diff --git a/js/src/modals/SMSVerification/Done/done.css b/js/src/modals/SMSVerification/Done/done.css index 4bd7697fb..18c410f3e 100644 --- a/js/src/modals/SMSVerification/Done/done.css +++ b/js/src/modals/SMSVerification/Done/done.css @@ -23,6 +23,7 @@ display: flex; align-items: center; } + .message { margin-top: 0; margin-bottom: 0; diff --git a/js/src/modals/SMSVerification/GatherData/gatherData.css b/js/src/modals/SMSVerification/GatherData/gatherData.css index 8d3fd6c77..680986981 100644 --- a/js/src/modals/SMSVerification/GatherData/gatherData.css +++ b/js/src/modals/SMSVerification/GatherData/gatherData.css @@ -37,11 +37,13 @@ .terms { line-height: 1.3; opacity: .7; -} -.terms ul { - padding-left: 1.5em; -} -.terms li { - margin-top: .2em; - margin-bottom: .2em; + + ul { + padding-left: 1.5em; + } + + li { + margin-top: .2em; + margin-bottom: .2em; + } } diff --git a/js/src/modals/SMSVerification/GatherData/gatherData.js b/js/src/modals/SMSVerification/GatherData/gatherData.js index c89263bd9..fa24e04e5 100644 --- a/js/src/modals/SMSVerification/GatherData/gatherData.js +++ b/js/src/modals/SMSVerification/GatherData/gatherData.js @@ -96,8 +96,7 @@ export default class GatherData extends Component {

Your account is already verified.

); - } - if (isVerified === false) { + } else if (isVerified === false) { return (
@@ -105,7 +104,9 @@ export default class GatherData extends Component {
); } - return (

Checking if your account is verified…

); + return ( +

Checking if your account is verified…

+ ); } renderRequested () { @@ -132,7 +133,9 @@ export default class GatherData extends Component { ); } - return (

Checking if you requested verification…

); + return ( +

Checking if you requested verification…

+ ); } numberOnSubmit = (value) => { diff --git a/js/src/modals/SMSVerification/QueryCode/queryCode.js b/js/src/modals/SMSVerification/QueryCode/queryCode.js index b4da6c8f4..9598fe358 100644 --- a/js/src/modals/SMSVerification/QueryCode/queryCode.js +++ b/js/src/modals/SMSVerification/QueryCode/queryCode.js @@ -45,6 +45,7 @@ export default class QueryCode extends Component { onChange = (_, code) => { this.props.setCode(code.trim()); } + onSubmit = (code) => { this.props.setCode(code.trim()); } diff --git a/js/src/modals/SMSVerification/SMSVerification.js b/js/src/modals/SMSVerification/SMSVerification.js index 3575fc76a..47124e7f6 100644 --- a/js/src/modals/SMSVerification/SMSVerification.js +++ b/js/src/modals/SMSVerification/SMSVerification.js @@ -83,7 +83,9 @@ export default class SMSVerification extends Component { onClick={ onClose } /> ); - if (error) return (
{ cancel }
); + if (error) { + return (
{ cancel }
); + } if (phase === 4) { return ( @@ -100,14 +102,19 @@ export default class SMSVerification extends Component { } let action; - if (phase === 3) { - action = store.done; - } else if (phase === 2) { - action = store.sendConfirmation; - } else if (phase === 1) { - action = store.queryCode; - } else if (phase === 0) { - action = store.sendRequest; + switch (phase) { + case 0: + action = store.sendRequest; + break; + case 1: + action = store.queryCode; + break; + case 2: + action = store.sendConfirmation; + break; + case 3: + action = store.done; + break; } return ( @@ -124,7 +131,9 @@ export default class SMSVerification extends Component { } renderStep (phase, error) { - if (error) return (

{ error }

); + if (error) { + return (

{ error }

); + } const { step, diff --git a/js/src/modals/SMSVerification/SendRequest/sendRequest.js b/js/src/modals/SMSVerification/SendRequest/sendRequest.js index 91c857a6a..31190f628 100644 --- a/js/src/modals/SMSVerification/SendRequest/sendRequest.js +++ b/js/src/modals/SMSVerification/SendRequest/sendRequest.js @@ -35,23 +35,25 @@ export default class SendRequest extends Component { render () { const { step, tx } = this.props; - if (step === POSTING_REQUEST) { - return (

A verification request will be sent to the contract. Please authorize this using the Parity Signer.

); - } + switch (step) { + case POSTING_REQUEST: + return (

A verification request will be sent to the contract. Please authorize this using the Parity Signer.

); - if (step === POSTED_REQUEST) { - return ( -
- -

Please keep this window open.

-
- ); - } + case POSTED_REQUEST: + return ( +
+ +

Please keep this window open.

+
+ ); - if (step === REQUESTING_SMS) { - return (

Requesting an SMS from the Parity server.

); - } + case REQUESTING_SMS: + return ( +

Requesting an SMS from the Parity server.

+ ); - return null; + default: + return null; + } } } diff --git a/js/src/modals/SMSVerification/store.js b/js/src/modals/SMSVerification/store.js index d8a1247e5..1a6a58011 100644 --- a/js/src/modals/SMSVerification/store.js +++ b/js/src/modals/SMSVerification/store.js @@ -69,29 +69,18 @@ export default class VerificationStore { return false; } - if (this.step === GATHERED_DATA) { - return this.fee && this.isVerified === false && this.isNumberValid && this.consentGiven; + switch (this.step) { + case GATHERED_DATA: + return this.fee && this.isVerified === false && this.isNumberValid && this.consentGiven; + case REQUESTED_SMS: + return this.requestTx; + case QUERY_CODE: + return this.isCodeValid; + case POSTED_CONFIRMATION: + return this.confirmationTx; + default: + return false; } - if (this.step === REQUESTED_SMS) { - return this.requestTx; - } - if (this.step === QUERY_CODE) { - return this.isCodeValid; - } - if (this.step === POSTED_CONFIRMATION) { - return this.confirmationTx; - } - return false; - } - - @action setNumber = (number) => { - this.number = number; - } - @action setConsentGiven = (consentGiven) => { - this.consentGiven = consentGiven; - } - @action setCode = (code) => { - this.code = code; } constructor (api, account) { @@ -106,6 +95,18 @@ export default class VerificationStore { }); } + @action setNumber = (number) => { + this.number = number; + } + + @action setConsentGiven = (consentGiven) => { + this.consentGiven = consentGiven; + } + + @action setCode = (code) => { + this.code = code; + } + @action gatherData = () => { const { contract, account } = this; this.step = GATHERING_DATA; @@ -137,10 +138,11 @@ export default class VerificationStore { this.error = 'Failed to check if requested: ' + err.message; }); - Promise.all([ fee, isVerified, hasRequested ]) - .then(() => { - this.step = GATHERED_DATA; - }); + Promise + .all([ fee, isVerified, hasRequested ]) + .then(() => { + this.step = GATHERED_DATA; + }); } @action sendRequest = () => { @@ -165,13 +167,13 @@ export default class VerificationStore { .then((txHash) => { this.requestTx = txHash; return checkIfTxFailed(api, txHash, options.gas) - .then((hasFailed) => { - if (hasFailed) { - throw new Error('Transaction failed, all gas used up.'); - } - this.step = POSTED_REQUEST; - return waitForConfirmations(api, txHash, 1); - }); + .then((hasFailed) => { + if (hasFailed) { + throw new Error('Transaction failed, all gas used up.'); + } + this.step = POSTED_REQUEST; + return waitForConfirmations(api, txHash, 1); + }); }); } @@ -214,13 +216,13 @@ export default class VerificationStore { .then((txHash) => { this.confirmationTx = txHash; return checkIfTxFailed(api, txHash, options.gas) - .then((hasFailed) => { - if (hasFailed) { - throw new Error('Transaction failed, all gas used up.'); - } - this.step = POSTED_CONFIRMATION; - return waitForConfirmations(api, txHash, 1); - }); + .then((hasFailed) => { + if (hasFailed) { + throw new Error('Transaction failed, all gas used up.'); + } + this.step = POSTED_CONFIRMATION; + return waitForConfirmations(api, txHash, 1); + }); }) .then(() => { this.step = DONE; diff --git a/js/src/ui/TxHash/txHash.js b/js/src/ui/TxHash/txHash.js index 87d1850f7..83e5c79f5 100644 --- a/js/src/ui/TxHash/txHash.js +++ b/js/src/ui/TxHash/txHash.js @@ -102,7 +102,9 @@ class TxHash extends Component {