File tree Expand file tree Collapse file tree 3 files changed +12
-13
lines changed
packages/ui/src/components Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change 1414.button : disabled {
1515 color : var (--white );
1616 cursor : not-allowed;
17- /* opacity: 0.8; */
1817 pointer-events : none;
1918}
2019
Original file line number Diff line number Diff line change 11import styles from "./Pin.module.css" ;
2- import { useState , useRef } from "react" ;
2+ import { useState , useRef , useContext } from "react" ;
33import Button from "../common/button/Button" ;
44import { useApi } from "../../hooks/useApi" ;
55import { useToast } from "../../hooks/useToast.js" ;
66import { AuthContext } from "../../contexts/Contexts" ;
7- import { useContext } from "react" ;
87import { useNavigate } from "react-router-dom" ;
98import PropTypes from "prop-types" ;
109
1110function Pin ( { onClose } ) {
12- const [ pin , setPin ] = useState ( Array ( 6 ) . fill ( "" ) ) ;
11+ const [ pin , setPin ] = useState ( new Array ( 6 ) . fill ( "" ) ) ;
1312 const inputsRef = useRef ( [ ] ) ;
1413 const toast = useToast ( ) ;
1514 const { setIsAuthenticated } = useContext ( AuthContext ) ;
@@ -28,7 +27,7 @@ function Pin({ onClose }) {
2827 } ,
2928 } ) ;
3029 if ( success ) {
31- setPin ( Array ( 6 ) . fill ( "" ) ) ;
30+ setPin ( new Array ( 6 ) . fill ( "" ) ) ;
3231 setIsAuthenticated ( true ) ;
3332 navigate ( "/dashboard" ) ;
3433 onClose ( ) ;
Original file line number Diff line number Diff line change @@ -132,6 +132,13 @@ export default function TwoFactorAuth() {
132132 setMode ( "VERIFIED" ) ;
133133 setPassword ( "" ) ;
134134 } ;
135+
136+ const getStatusText = ( ) => {
137+ if ( isMFAEnabled ) return "Active" ;
138+ if ( mode === "SETUP" ) return "Setup Required" ;
139+ return "Not Configured" ;
140+ } ;
141+
135142 return (
136143 < div className = { styles . card } >
137144 < div className = { styles . cardHeader } >
@@ -149,11 +156,7 @@ export default function TwoFactorAuth() {
149156 < span
150157 className = { `${ styles . statusBadge } ${ isMFAEnabled ? styles . successBadge : styles . pendingBadge } ` }
151158 >
152- { isMFAEnabled
153- ? "Active"
154- : mode === "SETUP"
155- ? "Setup Required"
156- : "Not Configured" }
159+ { getStatusText ( ) }
157160 </ span >
158161 </ div >
159162
@@ -211,9 +214,7 @@ export default function TwoFactorAuth() {
211214 maxLength = { 6 }
212215 value = { verificationCode }
213216 onChange = { ( e ) =>
214- setVerificationCode (
215- e . target . value . replace ( / [ ^ 0 - 9 ] / g, "" )
216- )
217+ setVerificationCode ( e . target . value . replace ( / \D / g, "" ) )
217218 }
218219 className = { styles . codeInput }
219220 placeholder = "000000"
You can’t perform that action at this time.
0 commit comments