Merge pull request #997 from josepfo/fix/get-ui-registration-up-to-spec
fix: font family and default on focus input border
This commit is contained in:
commit
c0038a591f
7 changed files with 105 additions and 67 deletions
|
|
@ -9,10 +9,12 @@ const styles = {
|
||||||
borderRadius: '4px'
|
borderRadius: '4px'
|
||||||
},
|
},
|
||||||
focus: {
|
focus: {
|
||||||
color: primaryColor,
|
|
||||||
border: '2px solid',
|
border: '2px solid',
|
||||||
borderColor: primaryColor,
|
borderColor: primaryColor,
|
||||||
borderRadius: '4px'
|
borderRadius: '4px',
|
||||||
|
'&:focus': {
|
||||||
|
outline: 'none'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error: {
|
error: {
|
||||||
borderColor: errorColor
|
borderColor: errorColor
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ export default {
|
||||||
confirmationCode: {
|
confirmationCode: {
|
||||||
extend: base,
|
extend: base,
|
||||||
fontSize: codeInputFontSize,
|
fontSize: codeInputFontSize,
|
||||||
fontFamily: fontPrimary,
|
fontFamily: fontSecondary,
|
||||||
fontWeight: 900
|
fontWeight: 900
|
||||||
},
|
},
|
||||||
inline: {
|
inline: {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { useMutation, useLazyQuery } from '@apollo/react-hooks'
|
import { useMutation, useLazyQuery } from '@apollo/react-hooks'
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
import base64 from 'base-64'
|
import base64 from 'base-64'
|
||||||
|
import { Form, Formik } from 'formik'
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
import React, { useContext, useState } from 'react'
|
import React, { useContext, useState } from 'react'
|
||||||
import { useHistory } from 'react-router-dom'
|
import { useHistory } from 'react-router-dom'
|
||||||
|
|
@ -120,14 +121,20 @@ const Input2FAState = ({ state, dispatch }) => {
|
||||||
<TL1 className={classes.info}>
|
<TL1 className={classes.info}>
|
||||||
Enter your two-factor authentication code
|
Enter your two-factor authentication code
|
||||||
</TL1>
|
</TL1>
|
||||||
<CodeInput
|
{/* TODO: refactor the 2FA CodeInput to properly use Formik */}
|
||||||
name="2fa"
|
<Formik onSubmit={() => {}} initialValues={{}}>
|
||||||
value={state.twoFAField}
|
<Form>
|
||||||
onChange={handle2FAChange}
|
<CodeInput
|
||||||
numInputs={6}
|
name="2fa"
|
||||||
error={invalidToken}
|
value={state.twoFAField}
|
||||||
shouldAutoFocus
|
onChange={handle2FAChange}
|
||||||
/>
|
numInputs={6}
|
||||||
|
error={invalidToken}
|
||||||
|
shouldAutoFocus
|
||||||
|
/>
|
||||||
|
<button onClick={handleSubmit} className={classes.enterButton} />
|
||||||
|
</Form>
|
||||||
|
</Formik>
|
||||||
<div className={classes.twofaFooter}>
|
<div className={classes.twofaFooter}>
|
||||||
{errorMessage && <P className={classes.errorMessage}>{errorMessage}</P>}
|
{errorMessage && <P className={classes.errorMessage}>{errorMessage}</P>}
|
||||||
<Button onClick={handleSubmit} buttonClassName={classes.loginButton}>
|
<Button onClick={handleSubmit} buttonClassName={classes.loginButton}>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { useQuery, useMutation } from '@apollo/react-hooks'
|
import { useQuery, useMutation } from '@apollo/react-hooks'
|
||||||
import { makeStyles, Grid } from '@material-ui/core'
|
import { makeStyles, Grid } from '@material-ui/core'
|
||||||
import Paper from '@material-ui/core/Paper'
|
import Paper from '@material-ui/core/Paper'
|
||||||
|
import { Form, Formik } from 'formik'
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
import QRCode from 'qrcode.react'
|
import QRCode from 'qrcode.react'
|
||||||
import React, { useReducer, useState } from 'react'
|
import React, { useReducer, useState } from 'react'
|
||||||
|
|
@ -101,6 +102,20 @@ const Reset2FA = () => {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleSubmit = () => {
|
||||||
|
if (twoFAConfirmation.length !== 6) {
|
||||||
|
setInvalidToken(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reset2FA({
|
||||||
|
variables: {
|
||||||
|
token: token,
|
||||||
|
userID: state.userID,
|
||||||
|
code: twoFAConfirmation
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid
|
<Grid
|
||||||
container
|
container
|
||||||
|
|
@ -152,33 +167,30 @@ const Reset2FA = () => {
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.confirm2FAInput}>
|
<div className={classes.confirm2FAInput}>
|
||||||
<CodeInput
|
{/* TODO: refactor the 2FA CodeInput to properly use Formik */}
|
||||||
name="2fa"
|
<Formik onSubmit={() => {}} initialValues={{}}>
|
||||||
value={twoFAConfirmation}
|
<Form>
|
||||||
onChange={handle2FAChange}
|
<CodeInput
|
||||||
numInputs={6}
|
name="2fa"
|
||||||
error={invalidToken}
|
value={twoFAConfirmation}
|
||||||
shouldAutoFocus
|
onChange={handle2FAChange}
|
||||||
/>
|
numInputs={6}
|
||||||
|
error={invalidToken}
|
||||||
|
shouldAutoFocus
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
onClick={handleSubmit}
|
||||||
|
className={classes.enterButton}
|
||||||
|
/>
|
||||||
|
</Form>
|
||||||
|
</Formik>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.twofaFooter}>
|
<div className={classes.twofaFooter}>
|
||||||
{getErrorMsg() && (
|
{getErrorMsg() && (
|
||||||
<P className={classes.errorMessage}>{getErrorMsg()}</P>
|
<P className={classes.errorMessage}>{getErrorMsg()}</P>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={handleSubmit}
|
||||||
if (twoFAConfirmation.length !== 6) {
|
|
||||||
setInvalidToken(true)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
reset2FA({
|
|
||||||
variables: {
|
|
||||||
token: token,
|
|
||||||
userID: state.userID,
|
|
||||||
code: twoFAConfirmation
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
buttonClassName={classes.loginButton}>
|
buttonClassName={classes.loginButton}>
|
||||||
Done
|
Done
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { useMutation, useQuery, useLazyQuery } from '@apollo/react-hooks'
|
import { useMutation, useQuery, useLazyQuery } from '@apollo/react-hooks'
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
import base64 from 'base-64'
|
import base64 from 'base-64'
|
||||||
|
import { Form, Formik } from 'formik'
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
import QRCode from 'qrcode.react'
|
import QRCode from 'qrcode.react'
|
||||||
import React, { useContext, useState } from 'react'
|
import React, { useContext, useState } from 'react'
|
||||||
|
|
@ -125,6 +126,14 @@ const Setup2FAState = ({ state, dispatch }) => {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleSubmit = () => {
|
||||||
|
if (twoFAConfirmation.length !== 6) {
|
||||||
|
setInvalidToken(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setup2FA(mutationOptions)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
secret &&
|
secret &&
|
||||||
otpauth && (
|
otpauth && (
|
||||||
|
|
@ -159,28 +168,26 @@ const Setup2FAState = ({ state, dispatch }) => {
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.confirm2FAInput}>
|
<div className={classes.confirm2FAInput}>
|
||||||
<CodeInput
|
{/* TODO: refactor the 2FA CodeInput to properly use Formik */}
|
||||||
name="2fa"
|
<Formik onSubmit={() => {}} initialValues={{}}>
|
||||||
value={twoFAConfirmation}
|
<Form>
|
||||||
onChange={handle2FAChange}
|
<CodeInput
|
||||||
numInputs={6}
|
name="2fa"
|
||||||
error={invalidToken}
|
value={twoFAConfirmation}
|
||||||
shouldAutoFocus
|
onChange={handle2FAChange}
|
||||||
/>
|
numInputs={6}
|
||||||
|
error={invalidToken}
|
||||||
|
shouldAutoFocus
|
||||||
|
/>
|
||||||
|
<button onClick={handleSubmit} className={classes.enterButton} />
|
||||||
|
</Form>
|
||||||
|
</Formik>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.twofaFooter}>
|
<div className={classes.twofaFooter}>
|
||||||
{getErrorMsg() && (
|
{getErrorMsg() && (
|
||||||
<P className={classes.errorMessage}>{getErrorMsg()}</P>
|
<P className={classes.errorMessage}>{getErrorMsg()}</P>
|
||||||
)}
|
)}
|
||||||
<Button
|
<Button onClick={handleSubmit} buttonClassName={classes.loginButton}>
|
||||||
onClick={() => {
|
|
||||||
if (twoFAConfirmation.length !== 6) {
|
|
||||||
setInvalidToken(true)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
setup2FA(mutationOptions)
|
|
||||||
}}
|
|
||||||
buttonClassName={classes.loginButton}>
|
|
||||||
Done
|
Done
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,9 @@ const styles = {
|
||||||
},
|
},
|
||||||
error: {
|
error: {
|
||||||
color: errorColor
|
color: errorColor
|
||||||
|
},
|
||||||
|
enterButton: {
|
||||||
|
display: 'none'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { useLazyQuery } from '@apollo/react-hooks'
|
import { useLazyQuery } from '@apollo/react-hooks'
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
|
import { Form, Formik } from 'formik'
|
||||||
import gql from 'graphql-tag'
|
import gql from 'graphql-tag'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
|
|
||||||
|
|
@ -48,6 +49,14 @@ const Input2FAModal = ({ showModal, handleClose, setConfirmation }) => {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleSubmit = () => {
|
||||||
|
if (twoFACode.length !== 6) {
|
||||||
|
setInvalidCode(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
confirm2FA({ variables: { code: twoFACode } })
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
showModal && (
|
showModal && (
|
||||||
<Modal
|
<Modal
|
||||||
|
|
@ -61,28 +70,26 @@ const Input2FAModal = ({ showModal, handleClose, setConfirmation }) => {
|
||||||
To make changes on this user, please confirm this action by entering
|
To make changes on this user, please confirm this action by entering
|
||||||
your two-factor authentication code below.
|
your two-factor authentication code below.
|
||||||
</P>
|
</P>
|
||||||
<CodeInput
|
{/* TODO: refactor the 2FA CodeInput to properly use Formik */}
|
||||||
name="2fa"
|
<Formik onSubmit={() => {}} initialValues={{}}>
|
||||||
value={twoFACode}
|
<Form>
|
||||||
onChange={handleCodeChange}
|
<CodeInput
|
||||||
numInputs={6}
|
name="2fa"
|
||||||
error={invalidCode}
|
value={twoFACode}
|
||||||
containerStyle={classes.codeContainer}
|
onChange={handleCodeChange}
|
||||||
shouldAutoFocus
|
numInputs={6}
|
||||||
/>
|
error={invalidCode}
|
||||||
|
containerStyle={classes.codeContainer}
|
||||||
|
shouldAutoFocus
|
||||||
|
/>
|
||||||
|
<button onClick={handleSubmit} className={classes.enterButton} />
|
||||||
|
</Form>
|
||||||
|
</Formik>
|
||||||
{getErrorMsg() && (
|
{getErrorMsg() && (
|
||||||
<P className={classes.errorMessage}>{getErrorMsg()}</P>
|
<P className={classes.errorMessage}>{getErrorMsg()}</P>
|
||||||
)}
|
)}
|
||||||
<div className={classes.footer}>
|
<div className={classes.footer}>
|
||||||
<Button
|
<Button className={classes.submit} onClick={handleSubmit}>
|
||||||
className={classes.submit}
|
|
||||||
onClick={() => {
|
|
||||||
if (twoFACode.length !== 6) {
|
|
||||||
setInvalidCode(true)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
confirm2FA({ variables: { code: twoFACode } })
|
|
||||||
}}>
|
|
||||||
Confirm
|
Confirm
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue