-
Notifications
You must be signed in to change notification settings - Fork 1.7k
sms verification modal #3336
sms verification modal #3336
Changes from 46 commits
7cb724b
f96e693
fc76fa9
1a24540
435d3c2
14da2d2
4c199ef
89a2917
d0d737d
3ef54f9
4931381
a56a1d3
ebf742f
e84531f
e7113e7
7996ac4
f08e2a4
a42140e
01cf88d
8028c0f
cde9f45
89c1d9c
ac80276
2309e53
afdda48
bd839d0
01f1490
8db3414
1e696c4
594bd35
8ce362b
b1fcee7
9df0d33
b5560d2
8ef9fff
7198624
f48a341
377c16c
90df237
bfcc8d3
3e879aa
aa8fc55
7a83fb8
8d4b1a3
da8c70f
ed2b8e1
1344893
a595260
3f0053f
fff8743
179078d
4ae58f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"constant":false,"inputs":[{"name":"_new","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_who","type":"address"}],"name":"certify","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"request","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_who","type":"address"},{"name":"_puzzle","type":"bytes32"}],"name":"puzzle","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"getAddress","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_new","type":"uint256"}],"name":"setFee","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_who","type":"address"}],"name":"revoke","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_code","type":"bytes32"}],"name":"confirm","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"drain","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"delegate","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"getUint","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_new","type":"address"}],"name":"setDelegate","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"}],"name":"certified","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"fee","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"},{"name":"_field","type":"string"}],"name":"get","outputs":[{"name":"","type":"bytes32"}],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"}],"name":"Requested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"},{"indexed":false,"name":"puzzle","type":"bytes32"}],"name":"Puzzled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"}],"name":"Confirmed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"who","type":"address"}],"name":"Revoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"old","type":"address"},{"indexed":true,"name":"current","type":"address"}],"name":"NewOwner","type":"event"}] | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* Copyright 2015, 2016 Ethcore (UK) Ltd. | ||
/* This file is part of Parity. | ||
/* | ||
/* Parity is free software: you can redistribute it and/or modify | ||
/* it under the terms of the GNU General Public License as published by | ||
/* the Free Software Foundation, either version 3 of the License, or | ||
/* (at your option) any later version. | ||
/* | ||
/* Parity is distributed in the hope that it will be useful, | ||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
/* GNU General Public License for more details. | ||
/* | ||
/* You should have received a copy of the GNU General Public License | ||
/* along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
.spacing { | ||
margin-top: 1.5em; | ||
} | ||
|
||
.container { | ||
margin-top: .5em; | ||
display: flex; | ||
align-items: center; | ||
} | ||
.message { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small comment - just an extra line-break here would be good. (Consistency in this file and with the rest - and it doesn't hurt readability either.) |
||
margin-top: 0; | ||
margin-bottom: 0; | ||
margin-left: .5em; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2015, 2016 Ethcore (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import React, { Component } from 'react'; | ||
import SuccessIcon from 'material-ui/svg-icons/navigation/check'; | ||
|
||
import styles from './done.css'; | ||
|
||
export default class Done extends Component { | ||
render () { | ||
return ( | ||
<div className={ styles.container }> | ||
<SuccessIcon /> | ||
<p className={ styles.message }>Congratulations, your account is verified!</p> | ||
</div> | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2015, 2016 Ethcore (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
export default from './done'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* Copyright 2015, 2016 Ethcore (UK) Ltd. | ||
/* This file is part of Parity. | ||
/* | ||
/* Parity is free software: you can redistribute it and/or modify | ||
/* it under the terms of the GNU General Public License as published by | ||
/* the Free Software Foundation, either version 3 of the License, or | ||
/* (at your option) any later version. | ||
/* | ||
/* Parity is distributed in the hope that it will be useful, | ||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
/* GNU General Public License for more details. | ||
/* | ||
/* You should have received a copy of the GNU General Public License | ||
/* along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
.list li { | ||
padding: .1em 0; | ||
} | ||
|
||
.spacing { | ||
margin-top: 1.5em; | ||
} | ||
|
||
.container { | ||
margin-top: .5em; | ||
display: flex; | ||
align-items: center; | ||
} | ||
.message { | ||
margin-top: 0; | ||
margin-bottom: 0; | ||
margin-left: .5em; | ||
} | ||
|
||
.terms { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could/should be nested -
|
||
line-height: 1.3; | ||
opacity: .7; | ||
} | ||
.terms ul { | ||
padding-left: 1.5em; | ||
} | ||
.terms li { | ||
margin-top: .2em; | ||
margin-bottom: .2em; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
// Copyright 2015, 2016 Ethcore (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import React, { Component, PropTypes } from 'react'; | ||
import BigNumber from 'bignumber.js'; | ||
import { Checkbox } from 'material-ui'; | ||
import InfoIcon from 'material-ui/svg-icons/action/info-outline'; | ||
import SuccessIcon from 'material-ui/svg-icons/navigation/check'; | ||
import ErrorIcon from 'material-ui/svg-icons/navigation/close'; | ||
|
||
import { fromWei } from '../../../api/util/wei'; | ||
import { Form, Input } from '../../../ui'; | ||
|
||
import terms from '../terms-of-service'; | ||
import styles from './gatherData.css'; | ||
|
||
const nullable = (type) => PropTypes.oneOfType([ PropTypes.oneOf([ null ]), type ]); | ||
|
||
export default class GatherData extends Component { | ||
static propTypes = { | ||
fee: React.PropTypes.instanceOf(BigNumber), | ||
isNumberValid: PropTypes.bool.isRequired, | ||
isVerified: nullable(PropTypes.bool.isRequired), | ||
hasRequested: nullable(PropTypes.bool.isRequired), | ||
setNumber: PropTypes.func.isRequired, | ||
setConsentGiven: PropTypes.func.isRequired | ||
} | ||
|
||
render () { | ||
const { isNumberValid, isVerified } = this.props; | ||
|
||
return ( | ||
<Form> | ||
<p>The following steps will let you prove that you control both an account and a phone number.</p> | ||
<ol className={ styles.list }> | ||
<li>You send a verification request to a specific contract.</li> | ||
<li>Our server puts a puzzle into this contract.</li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Real nitpick: Not convinced about the use of the word "puzzle" although we call it that way internally. (If I didn't know what we mean, I wouldn't be able to decipher it) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure about the wording here. This is supposed to be a very brief description of how the process works. Although the "Challenge Response" mechanism is well-known among programmers, I don't think it is among normal users. Still I want to give this indication here that the "verification" actually happens & is stored in the contract. |
||
<li>The code you receive via SMS is the solution to this puzzle.</li> | ||
</ol> | ||
{ this.renderFee() } | ||
{ this.renderCertified() } | ||
{ this.renderRequested() } | ||
<Input | ||
label={ 'phone number' } | ||
hint={ 'the SMS will be sent to this number' } | ||
error={ isNumberValid ? null : 'invalid number' } | ||
disabled={ isVerified } | ||
onChange={ this.numberOnChange } | ||
onSubmit={ this.numberOnSubmit } | ||
/> | ||
<Checkbox | ||
className={ styles.spacing } | ||
label={ 'I agree to the terms and conditions below.' } | ||
disabled={ isVerified } | ||
onCheck={ this.consentOnChange } | ||
/> | ||
<div className={ styles.terms }>{ terms }</div> | ||
</Form> | ||
); | ||
} | ||
|
||
renderFee () { | ||
const { fee } = this.props; | ||
|
||
if (!fee) { | ||
return (<p>Fetching the fee…</p>); | ||
} | ||
return ( | ||
<div className={ styles.container }> | ||
<InfoIcon /> | ||
<p className={ styles.message }>The fee is { fromWei(fee).toFixed(3) } ETH.</p> | ||
</div> | ||
); | ||
} | ||
|
||
renderCertified () { | ||
const { isVerified } = this.props; | ||
|
||
if (isVerified) { | ||
return ( | ||
<div className={ styles.container }> | ||
<ErrorIcon /> | ||
<p className={ styles.message }>Your account is already verified.</p> | ||
</div> | ||
); | ||
} | ||
if (isVerified === false) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. else if ? |
||
return ( | ||
<div className={ styles.container }> | ||
<SuccessIcon /> | ||
<p className={ styles.message }>Your account is not verified yet.</p> | ||
</div> | ||
); | ||
} | ||
return (<p className={ styles.message }>Checking if your account is verified…</p>); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra line-break won't hurt. |
||
} | ||
|
||
renderRequested () { | ||
const { isVerified, hasRequested } = this.props; | ||
|
||
// If the account is verified, don't show that it has requested verification. | ||
if (isVerified) { | ||
return null; | ||
} | ||
|
||
if (hasRequested) { | ||
return ( | ||
<div className={ styles.container }> | ||
<InfoIcon /> | ||
<p className={ styles.message }>You already requested verification.</p> | ||
</div> | ||
); | ||
} | ||
if (hasRequested === false) { | ||
return ( | ||
<div className={ styles.container }> | ||
<SuccessIcon /> | ||
<p className={ styles.message }>You did not request verification yet.</p> | ||
</div> | ||
); | ||
} | ||
return (<p className={ styles.message }>Checking if you requested verification…</p>); | ||
} | ||
|
||
numberOnSubmit = (value) => { | ||
this.props.setNumber(value); | ||
} | ||
|
||
numberOnChange = (_, value) => { | ||
this.props.setNumber(value); | ||
} | ||
|
||
consentOnChange = (_, consentGiven) => { | ||
this.props.setConsentGiven(consentGiven); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2015, 2016 Ethcore (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
export default from './gatherData'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2015, 2016 Ethcore (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
export default from './queryCode'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2015, 2016 Ethcore (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import React, { Component, PropTypes } from 'react'; | ||
|
||
import { Form, Input } from '../../../ui'; | ||
|
||
export default class QueryCode extends Component { | ||
static propTypes = { | ||
number: PropTypes.string.isRequired, | ||
isCodeValid: PropTypes.bool.isRequired, | ||
setCode: PropTypes.func.isRequired | ||
} | ||
|
||
render () { | ||
const { number, isCodeValid } = this.props; | ||
|
||
return ( | ||
<Form> | ||
<p>The verification code has been sent to { number }.</p> | ||
<Input | ||
label={ 'verification code' } | ||
hint={ 'Enter the code you received via SMS.' } | ||
error={ isCodeValid ? null : 'invalid code' } | ||
onChange={ this.onChange } | ||
onSubmit={ this.onSubmit } | ||
/> | ||
</Form> | ||
); | ||
} | ||
|
||
onChange = (_, code) => { | ||
this.props.setCode(code.trim()); | ||
} | ||
onSubmit = (code) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpick, line-break. |
||
this.props.setCode(code.trim()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add it to index.js for the contracts as well, import via that.