diff --git a/new-lamassu-admin/src/components/inputs/base/CodeInput.styles.js b/new-lamassu-admin/src/components/inputs/base/CodeInput.styles.js index 189add4c..0f0bba93 100644 --- a/new-lamassu-admin/src/components/inputs/base/CodeInput.styles.js +++ b/new-lamassu-admin/src/components/inputs/base/CodeInput.styles.js @@ -9,10 +9,12 @@ const styles = { borderRadius: '4px' }, focus: { - color: primaryColor, border: '2px solid', borderColor: primaryColor, - borderRadius: '4px' + borderRadius: '4px', + '&:focus': { + outline: 'none' + } }, error: { borderColor: errorColor diff --git a/new-lamassu-admin/src/components/typography/styles.js b/new-lamassu-admin/src/components/typography/styles.js index 44cfac11..ac06d238 100644 --- a/new-lamassu-admin/src/components/typography/styles.js +++ b/new-lamassu-admin/src/components/typography/styles.js @@ -129,7 +129,7 @@ export default { confirmationCode: { extend: base, fontSize: codeInputFontSize, - fontFamily: fontPrimary, + fontFamily: fontSecondary, fontWeight: 900 }, inline: { diff --git a/new-lamassu-admin/src/pages/Authentication/Input2FAState.js b/new-lamassu-admin/src/pages/Authentication/Input2FAState.js index 34063f3d..31deaf63 100644 --- a/new-lamassu-admin/src/pages/Authentication/Input2FAState.js +++ b/new-lamassu-admin/src/pages/Authentication/Input2FAState.js @@ -1,6 +1,7 @@ import { useMutation, useLazyQuery } from '@apollo/react-hooks' import { makeStyles } from '@material-ui/core/styles' import base64 from 'base-64' +import { Form, Formik } from 'formik' import gql from 'graphql-tag' import React, { useContext, useState } from 'react' import { useHistory } from 'react-router-dom' @@ -120,14 +121,20 @@ const Input2FAState = ({ state, dispatch }) => { Enter your two-factor authentication code - + {/* TODO: refactor the 2FA CodeInput to properly use Formik */} + {}} initialValues={{}}> +
+ + diff --git a/new-lamassu-admin/src/pages/Authentication/Setup2FAState.js b/new-lamassu-admin/src/pages/Authentication/Setup2FAState.js index 231aae48..410b49e4 100644 --- a/new-lamassu-admin/src/pages/Authentication/Setup2FAState.js +++ b/new-lamassu-admin/src/pages/Authentication/Setup2FAState.js @@ -1,6 +1,7 @@ import { useMutation, useQuery, useLazyQuery } from '@apollo/react-hooks' import { makeStyles } from '@material-ui/core/styles' import base64 from 'base-64' +import { Form, Formik } from 'formik' import gql from 'graphql-tag' import QRCode from 'qrcode.react' import React, { useContext, useState } from 'react' @@ -125,6 +126,14 @@ const Setup2FAState = ({ state, dispatch }) => { return null } + const handleSubmit = () => { + if (twoFAConfirmation.length !== 6) { + setInvalidToken(true) + return + } + setup2FA(mutationOptions) + } + return ( secret && otpauth && ( @@ -159,28 +168,26 @@ const Setup2FAState = ({ state, dispatch }) => {
- + {/* TODO: refactor the 2FA CodeInput to properly use Formik */} + {}} initialValues={{}}> +
+ +
{getErrorMsg() && (

{getErrorMsg()}

)} -
diff --git a/new-lamassu-admin/src/pages/Authentication/shared.styles.js b/new-lamassu-admin/src/pages/Authentication/shared.styles.js index c8d12568..20ed5058 100644 --- a/new-lamassu-admin/src/pages/Authentication/shared.styles.js +++ b/new-lamassu-admin/src/pages/Authentication/shared.styles.js @@ -100,6 +100,9 @@ const styles = { }, error: { color: errorColor + }, + enterButton: { + display: 'none' } } diff --git a/new-lamassu-admin/src/pages/UserManagement/modals/Input2FAModal.js b/new-lamassu-admin/src/pages/UserManagement/modals/Input2FAModal.js index d3773fbb..f64b32e9 100644 --- a/new-lamassu-admin/src/pages/UserManagement/modals/Input2FAModal.js +++ b/new-lamassu-admin/src/pages/UserManagement/modals/Input2FAModal.js @@ -1,5 +1,6 @@ import { useLazyQuery } from '@apollo/react-hooks' import { makeStyles } from '@material-ui/core/styles' +import { Form, Formik } from 'formik' import gql from 'graphql-tag' import React, { useState } from 'react' @@ -48,6 +49,14 @@ const Input2FAModal = ({ showModal, handleClose, setConfirmation }) => { return null } + const handleSubmit = () => { + if (twoFACode.length !== 6) { + setInvalidCode(true) + return + } + confirm2FA({ variables: { code: twoFACode } }) + } + return ( showModal && ( { To make changes on this user, please confirm this action by entering your two-factor authentication code below.

- + {/* TODO: refactor the 2FA CodeInput to properly use Formik */} + {}} initialValues={{}}> +
+ +