-
Notifications
You must be signed in to change notification settings - Fork 504
/
template.success.js
86 lines (81 loc) · 2.44 KB
/
template.success.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import React from 'react'
import PropTypes from 'prop-types'
import { FormattedMessage } from 'react-intl'
import { Button, Text } from 'blockchain-info-components'
import styled from 'styled-components'
import QRCodeReact from 'qrcode.react'
import { Field, reduxForm } from 'redux-form'
import { TextBox } from 'components/Form'
import { required } from 'services/FormHelper'
import { spacing } from 'services/StyleService'
const AuthenticatorSummary = styled.div`
width: 100%;
padding: 0 20px;
opacity: ${props => props.success ? 0.3 : 1};
@media (min-width: 992px) {
width: 110%;
}
`
const QRCode = styled.div`
display: flex;
justify-content: center;
align-content: center;
width: 100%;
padding: 30px 0;
`
const QRCodeCopy = styled.div`
display: block;
`
const QRCodeContainer = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
`
const QRInputWrapper = styled.div`
width: 30%;
display: flex;
flex-direction: column;
align-items: center;
margin: 20px 0;
button {
margin-top: 10px;
}
`
const Google = props => {
const { data, invalid, handleSubmit, ui } = props
return (
<form onSubmit={handleSubmit}>
<AuthenticatorSummary success={ui.successToggled}>
<QRCodeContainer>
{ data.googleSecret
? (
<QRCode>
<QRCodeReact value={data.googleSecret} size={115} />
</QRCode>
)
: null
}
<QRCodeCopy>
<Text size='14px' weight={200}>
<FormattedMessage id='scenes.security.twostepverification.authenticator.stepone' defaultMessage='1. Scan this QR code with your Authenticator app.' />
</Text>
<Text size='14px' weight={200} style={spacing('mt-5')}>
<FormattedMessage id='scenes.security.twostepverification.authenticator.steptwo' defaultMessage='2. Enter the random number presented below.' />
</Text>
</QRCodeCopy>
<QRInputWrapper>
<Field name='authCode' component={TextBox} validate={[required]} placeholder='111 222' />
<Button type='submit' nature='primary' disabled={invalid}>Verify Code</Button>
</QRInputWrapper>
</QRCodeContainer>
</AuthenticatorSummary>
</form>
)
}
Google.propTypes = {
handleSubmit: PropTypes.func.isRequired
}
export default reduxForm({
form: 'securityGoogleAuthenticator'
})(Google)