Skip to content

Commit

Permalink
fix(Coinify): show general error if not email address in use
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Welber committed Jun 20, 2018
1 parent b42a092 commit 48ad5a8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
Expand Up @@ -23,7 +23,7 @@ export default ({ coreSagas }) => {
yield call(coreSagas.data.coinify.triggerKYC)
yield put(A.coinifyNextStep('isx'))
} else {
yield put(A.coinifySignupFailure(profile.error))
yield put(A.coinifySignupFailure(JSON.parse(profile.error)))
}
} catch (e) {
yield put(actions.logs.logErrorMessage(logLocation, 'coinifySignup', e))
Expand Down
Expand Up @@ -31,7 +31,8 @@ class AcceptTermsContainer extends Component {

render () {
const { busy } = this.state
const { invalid, email, signupError, updateUI } = this.props
const { invalid, email, signupError, updateUI, coinifyFrontendActions } = this.props
const { coinifyClearSignupError } = coinifyFrontendActions

return <AcceptTerms
busy={busy}
Expand All @@ -41,6 +42,7 @@ class AcceptTermsContainer extends Component {
signupError={signupError}
updateUI={updateUI}
editEmail={() => { this.props.updateUI({ create: 'change_email' }) }}
clearError={() => coinifyClearSignupError()}
/>
}
}
Expand Down
Expand Up @@ -9,6 +9,7 @@ import Terms from 'components/Terms'
import { Button, HeartbeatLoader, Text, TextGroup, Link, Icon } from 'blockchain-info-components'
import { Form, ColLeft, ColRight, InputWrapper, PartnerHeader, PartnerSubHeader, ButtonWrapper, ErrorWrapper, ColRightInner } from 'components/BuySell/Signup'
import { spacing } from 'services/StyleService'
import { prop } from 'ramda'

const AcceptTermsContainer = styled.div`
display: flex;
Expand Down Expand Up @@ -48,11 +49,10 @@ const IconContainer = styled.div`
align-items: center;
margin-left: 10px;
`
const checkboxShouldBeChecked = value => value ? undefined : 'You must agree to the terms and conditions'

const AcceptTerms = (props) => {
const { busy, email, invalid, handleSubmit, signupError, updateUI, emailVerified, editEmail } = props

const checkboxShouldBeChecked = value => value ? undefined : 'You must agree to the terms and conditions'
const { busy, email, invalid, handleSubmit, signupError, updateUI, emailVerified, editEmail, clearError } = props

const helpers = [
{
Expand Down Expand Up @@ -113,18 +113,35 @@ const AcceptTerms = (props) => {
</ButtonWrapper>
<ErrorWrapper>
{
signupError && <TextGroup inline>
<Text size='12px' color='error' weight={300}>
<FormattedMessage id='coinifyexchangedata.create.accept.error1' defaultMessage='Unfortunately this email is being used for another account. ' />
</Text>
<Text size='12px' color='brand-secondary' cursor='pointer' weight={300} onClick={() => updateUI({ create: 'change_email' })}>
<FormattedMessage id='coinifyexchangedata.create.accept.error2' defaultMessage='Click here ' />
</Text>
<Text size='12px' color='error' weight={300}>
<FormattedMessage id='coinifyexchangedata.create.accept.error3' defaultMessage='to change it.' />
signupError && prop('error', signupError) === 'email_address_in_use'
? <TextGroup inline>
<Text size='12px' color='error' weight={300}>
<FormattedMessage id='coinifyexchangedata.create.accept.error1' defaultMessage='Unfortunately this email is being used for another account. ' />
</Text>
<Text size='12px' color='brand-secondary' cursor='pointer' weight={300} onClick={() => updateUI({ create: 'change_email' })}>
<FormattedMessage id='coinifyexchangedata.create.accept.error2' defaultMessage='Click here ' />
</Text>
<Text size='12px' color='error' weight={300}>
<FormattedMessage id='coinifyexchangedata.create.accept.error3' defaultMessage='to change it.' />

</Text>
</TextGroup>
</Text>
</TextGroup>
: signupError
? <TextGroup inline>
<Text size='12px' color='error' weight={300}>
<FormattedMessage id='coinifyexchangedata.create.accept.unknownError' defaultMessage="We're sorry, but something unexpected went wrong. Please " />
</Text>
<Link size='12px' weight={300} onClick={() => clearError()}>
<FormattedMessage id='tryagain' defaultMessage='try again' />
</Link>
<Text size='12px' color='error' weight={300}>
<FormattedMessage id='or' defaultMessage='or' />
</Text>
<Link target='_blank' href='https://support.blockchain.com' size='12px' weight={300}>
<FormattedMessage id='contactsupport' defaultMessage='contact support.' />
</Link>
</TextGroup>
: null
}
</ErrorWrapper>
{faqHelper()}
Expand Down

0 comments on commit 48ad5a8

Please sign in to comment.