Skip to content

Commit a0a405a

Browse files
author
Tarun Aditya
committed
fixed sonar qube issues
1 parent ec41666 commit a0a405a

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

packages/ui/src/components/common/button/Button.module.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
.button:disabled {
1515
color: var(--white);
1616
cursor: not-allowed;
17-
/* opacity: 0.8; */
1817
pointer-events: none;
1918
}
2019

packages/ui/src/components/pin/Pin.jsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import styles from "./Pin.module.css";
2-
import { useState, useRef } from "react";
2+
import { useState, useRef, useContext } from "react";
33
import Button from "../common/button/Button";
44
import { useApi } from "../../hooks/useApi";
55
import { useToast } from "../../hooks/useToast.js";
66
import { AuthContext } from "../../contexts/Contexts";
7-
import { useContext } from "react";
87
import { useNavigate } from "react-router-dom";
98
import PropTypes from "prop-types";
109

1110
function 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();

packages/ui/src/components/twofactorauth/TwoFactorAuth.jsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff 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"

0 commit comments

Comments
 (0)