@acuteinfo/common-screens 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +444 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import clsx from 'clsx';
|
|
|
13
13
|
import { useSnackbar } from 'notistack';
|
|
14
14
|
import FingerprintSharpIcon from '@mui/icons-material/FingerprintSharp';
|
|
15
15
|
import CryptoJS from 'crypto-js';
|
|
16
|
+
import { useNavigate } from 'react-router-dom';
|
|
16
17
|
|
|
17
18
|
const useStyles = makeStyles((theme) => ({
|
|
18
19
|
wrapper: {
|
|
@@ -1000,7 +1001,7 @@ const PasswordRotation = ({ classes, ResetPassword, open, username, accessToken,
|
|
|
1000
1001
|
}, fullWidth: true, disabled: pwdReset.isLoading, onClick: ClickEventHandler, ref: inputButtonRef, className: classes.otpButtons, children: pwdReset.isLoading ? (jsx(CircularProgress, { size: 25, thickness: 4.6 })) : ("Update") })] })] }) }) }));
|
|
1001
1002
|
};
|
|
1002
1003
|
|
|
1003
|
-
const inititalState = {
|
|
1004
|
+
const inititalState$1 = {
|
|
1004
1005
|
username: "",
|
|
1005
1006
|
firstName: "",
|
|
1006
1007
|
lastName: "",
|
|
@@ -1026,7 +1027,7 @@ const inititalState = {
|
|
|
1026
1027
|
auth_type: "O",
|
|
1027
1028
|
otpValidFor: 60,
|
|
1028
1029
|
};
|
|
1029
|
-
const reducer = (state, action) => {
|
|
1030
|
+
const reducer$1 = (state, action) => {
|
|
1030
1031
|
switch (action.type) {
|
|
1031
1032
|
case "inititateUserFingerVerification":
|
|
1032
1033
|
case "inititateOTPVerification": {
|
|
@@ -1189,7 +1190,7 @@ const reducer = (state, action) => {
|
|
|
1189
1190
|
}
|
|
1190
1191
|
case "backToUsernameVerification": {
|
|
1191
1192
|
return {
|
|
1192
|
-
...inititalState,
|
|
1193
|
+
...inititalState$1,
|
|
1193
1194
|
isPasswordError: action?.payload?.isError,
|
|
1194
1195
|
userMessageforpassword: action?.payload?.errorMessage,
|
|
1195
1196
|
};
|
|
@@ -1203,7 +1204,7 @@ const AuthControllerWrapper = ({ bannerDetails, logoUrl, loginFn, veirfyUsername
|
|
|
1203
1204
|
// const { isLoggedIn, login } = useContext(AuthContext);
|
|
1204
1205
|
const classes = useStyles();
|
|
1205
1206
|
// const navigate = useNavigate();
|
|
1206
|
-
const [loginState, dispath] = useReducer(reducer, inititalState);
|
|
1207
|
+
const [loginState, dispath] = useReducer(reducer$1, inititalState$1);
|
|
1207
1208
|
const [openpwdreset, setOpenPwdReset] = useState(false);
|
|
1208
1209
|
const failureCount = useRef(0);
|
|
1209
1210
|
const [dashboardLogoURL, setDashboardLogoURL] = useState(null);
|
|
@@ -1467,5 +1468,443 @@ const AuthControllerWrapper = ({ bannerDetails, logoUrl, loginFn, veirfyUsername
|
|
|
1467
1468
|
}, otpresendCount: otpResendRef.current }, "OTPForm")] })) : (jsx(VerifyFinger, { classes: classes, loginState: loginState, verifyFinger: verifyFinger, previousStep: changeUserName }, "biometric")) })) }))] })] }) }));
|
|
1468
1469
|
};
|
|
1469
1470
|
|
|
1470
|
-
|
|
1471
|
+
const ForgotPasswordFields = ({ classes, loginState, onSubmit }) => {
|
|
1472
|
+
const [input, setInput] = useState({
|
|
1473
|
+
userName: loginState.workingState === 1 ? loginState?.username : "",
|
|
1474
|
+
mobileno: "",
|
|
1475
|
+
password: "",
|
|
1476
|
+
confirmpassword: "",
|
|
1477
|
+
});
|
|
1478
|
+
const inputRef = useRef(null);
|
|
1479
|
+
const inputPassRef = useRef(null);
|
|
1480
|
+
const inputButtonRef = useRef(null);
|
|
1481
|
+
const [showPasswordTime, setShowPasswordTime] = useState(0);
|
|
1482
|
+
const [showConfirmPasswordTime, setShowConfirmPasswordTime] = useState(0);
|
|
1483
|
+
const showPassword = Date.now() < showPasswordTime;
|
|
1484
|
+
const showConfirmPassword = Date.now() < showConfirmPasswordTime;
|
|
1485
|
+
const [, forceUpdate] = useState();
|
|
1486
|
+
const timerRef = useRef(null);
|
|
1487
|
+
useEffect(() => {
|
|
1488
|
+
return () => clearTimeout(timerRef.current);
|
|
1489
|
+
}, []);
|
|
1490
|
+
const navigate = useNavigate();
|
|
1491
|
+
const { t } = useTranslation();
|
|
1492
|
+
const handleChange = (event) => {
|
|
1493
|
+
const name = event.target.name;
|
|
1494
|
+
let value = event.target.value;
|
|
1495
|
+
if (name === "userName" && value) {
|
|
1496
|
+
loginState.isUsernameError = false;
|
|
1497
|
+
}
|
|
1498
|
+
if (name === "mobileno" && value) {
|
|
1499
|
+
value = value.replace(/\D/g, "");
|
|
1500
|
+
if (Boolean(value)) {
|
|
1501
|
+
loginState.isMobileError = false;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
setInput((values) => ({ ...values, [name]: value }));
|
|
1505
|
+
};
|
|
1506
|
+
useEffect(() => {
|
|
1507
|
+
if (loginState.workingState === 1) {
|
|
1508
|
+
setTimeout(() => {
|
|
1509
|
+
inputPassRef?.current?.focus?.();
|
|
1510
|
+
}, 2000);
|
|
1511
|
+
}
|
|
1512
|
+
}, [loginState.workingState]);
|
|
1513
|
+
return (jsx(Fragment, { children: jsxs("div", { className: classes.formWrap, children: [jsx(TextField, { autoFocus: true, label: t("UserID"), placeholder: String(t("UserID")), fullWidth: true, type: "text", name: "userName", value: input.userName || "", onChange: handleChange, error: loginState.isUsernameError, helperText: loginState.isUsernameError
|
|
1514
|
+
? t(loginState.userMessageforusername)
|
|
1515
|
+
: "", InputLabelProps: { shrink: true }, disabled: loginState.loading
|
|
1516
|
+
? true
|
|
1517
|
+
: loginState.workingState === 0
|
|
1518
|
+
? false
|
|
1519
|
+
: true, autoComplete: "off", ref: inputRef, inputProps: { maxLength: 16 }, onKeyDown: (e) => {
|
|
1520
|
+
if (e.key === "Enter") {
|
|
1521
|
+
inputButtonRef?.current?.click?.();
|
|
1522
|
+
}
|
|
1523
|
+
}, style: { paddingBottom: "8px" } }), loginState.workingState === 0 ? (jsx(TextField, { label: t("MobileNo"), placeholder: "Enter Mobile No.",
|
|
1524
|
+
// placeholder={String(t("EnterMobileNo"))}
|
|
1525
|
+
fullWidth: true, type: "text", name: "mobileno", value: input.mobileno || "", onChange: handleChange, error: loginState.isMobileError, helperText: loginState.isMobileError
|
|
1526
|
+
? t(loginState.userMessageforMobileno)
|
|
1527
|
+
: "", InputLabelProps: { shrink: true }, disabled: loginState.loading
|
|
1528
|
+
? true
|
|
1529
|
+
: loginState.workingState === 0
|
|
1530
|
+
? false
|
|
1531
|
+
: true, autoComplete: "off", onKeyDown: (e) => {
|
|
1532
|
+
if (e.key === "Enter") {
|
|
1533
|
+
inputButtonRef?.current?.click?.();
|
|
1534
|
+
}
|
|
1535
|
+
}, inputProps: { maxLength: 13 }, style: { paddingBottom: "8px" } })) : null, loginState.workingState === 1 ? (jsxs(Fragment$1, { children: [jsx(TextField, { autoFocus: true, label: t("Password"), placeholder: "Enter Password", fullWidth: true, type: showPassword ? "text" : "password", name: "password", value: input.password || "", onChange: handleChange, error: loginState.isPasswordError, helperText: loginState.isPasswordError
|
|
1536
|
+
? t(loginState.userMessageforPassword)
|
|
1537
|
+
: "", InputLabelProps: { shrink: true }, disabled: loginState.loading, autoComplete: "off", ref: inputPassRef, onKeyDown: (e) => {
|
|
1538
|
+
if (e.key === "Enter") {
|
|
1539
|
+
inputButtonRef?.current?.click?.();
|
|
1540
|
+
}
|
|
1541
|
+
}, InputProps: {
|
|
1542
|
+
endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(IconButton, { "aria-label": "toggle password visibility", onClick: () => {
|
|
1543
|
+
if (!showPassword) {
|
|
1544
|
+
setShowPasswordTime(Date.now() + 5000);
|
|
1545
|
+
timerRef.current = setTimeout(() => forceUpdate(Date.now()), 5000);
|
|
1546
|
+
}
|
|
1547
|
+
else if (showPassword)
|
|
1548
|
+
setShowPasswordTime(0);
|
|
1549
|
+
}, onMouseDown: (e) => e.preventDefault(), disabled: loginState.loading, children: showPassword ? jsx(Visibility, {}) : jsx(VisibilityOff, {}) }) })),
|
|
1550
|
+
}, inputProps: { maxLength: 16 }, style: { paddingBottom: "8px" } }), jsx(TextField, { label: t("ConfirmPassword"), placeholder: String(t("EnterConfirmPassword")), fullWidth: true, type: showConfirmPassword ? "text" : "password", name: "confirmpassword", value: input.confirmpassword || "", onChange: handleChange, error: loginState.isConfirmPasswordError, helperText: loginState.isConfirmPasswordError
|
|
1551
|
+
? t(loginState.userMessageforconfirmPassword)
|
|
1552
|
+
: "", InputLabelProps: { shrink: true }, disabled: loginState.loading, autoComplete: "off", onKeyDown: (e) => {
|
|
1553
|
+
if (e.key === "Enter") {
|
|
1554
|
+
inputButtonRef?.current?.click?.();
|
|
1555
|
+
}
|
|
1556
|
+
}, InputProps: {
|
|
1557
|
+
endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(IconButton, { "aria-label": "toggle password visibility", onClick: () => {
|
|
1558
|
+
if (!showConfirmPassword) {
|
|
1559
|
+
setShowConfirmPasswordTime(Date.now() + 5000);
|
|
1560
|
+
timerRef.current = setTimeout(() => forceUpdate(Date.now()), 5000);
|
|
1561
|
+
}
|
|
1562
|
+
else if (showConfirmPassword)
|
|
1563
|
+
setShowConfirmPasswordTime(0);
|
|
1564
|
+
}, onMouseDown: (e) => e.preventDefault(), disabled: loginState.loading, children: showConfirmPassword ? jsx(Visibility, {}) : jsx(VisibilityOff, {}) }) })),
|
|
1565
|
+
}, inputProps: { maxLength: 16 }, style: { paddingBottom: "8px" } })] })) : null, loginState.isApiError ? (jsx(FormHelperText, { style: { color: "red" }, children: loginState.apierrorMessage })) : null, jsx("div", { style: {
|
|
1566
|
+
marginTop: "20px",
|
|
1567
|
+
display: "flex",
|
|
1568
|
+
flexDirection: "row-reverse",
|
|
1569
|
+
}, children: jsx("div", { style: {
|
|
1570
|
+
flex: "auto",
|
|
1571
|
+
textAlign: "center",
|
|
1572
|
+
marginTop: "5px",
|
|
1573
|
+
marginBottom: "17px",
|
|
1574
|
+
}, children: jsxs("div", { children: [jsx(GradientButton, { style: { borderRadius: "10px", marginRight: "5px" },
|
|
1575
|
+
// fullWidth
|
|
1576
|
+
disabled: loginState.loading, onClick: () => {
|
|
1577
|
+
navigate("login");
|
|
1578
|
+
}, children: t("backtologin") }), jsx(GradientButton, { style: { borderRadius: "10px" }, disabled: loginState.loading, onClick: () => {
|
|
1579
|
+
onSubmit(input, loginState.workingState);
|
|
1580
|
+
}, ref: inputButtonRef, children: loginState.loading ? (jsx(CircularProgress, { size: 25, thickness: 4.6 })) : (t("Next")) })] }) }) })] }) }));
|
|
1581
|
+
};
|
|
1582
|
+
|
|
1583
|
+
// import { MultiLanguages } from "./multiLanguages";
|
|
1584
|
+
const inititalState = {
|
|
1585
|
+
isUsernameError: false,
|
|
1586
|
+
userMessageforusername: "",
|
|
1587
|
+
loading: false,
|
|
1588
|
+
isMobileError: false,
|
|
1589
|
+
userMessageforMobileno: "",
|
|
1590
|
+
isPasswordError: false,
|
|
1591
|
+
userMessageforPassword: "",
|
|
1592
|
+
isConfirmPasswordError: false,
|
|
1593
|
+
userMessageforconfirmPassword: "",
|
|
1594
|
+
workingState: 0,
|
|
1595
|
+
isApiError: false,
|
|
1596
|
+
apierrorMessage: "",
|
|
1597
|
+
otploading: false,
|
|
1598
|
+
OtpuserMessage: "",
|
|
1599
|
+
otpmodelClose: false,
|
|
1600
|
+
requestCd: "",
|
|
1601
|
+
username: "",
|
|
1602
|
+
auth_type: "O",
|
|
1603
|
+
transactionID: "",
|
|
1604
|
+
};
|
|
1605
|
+
const reducer = (state, action) => {
|
|
1606
|
+
switch (action.type) {
|
|
1607
|
+
case "verifyUserNameandMobileNoFailed": {
|
|
1608
|
+
return {
|
|
1609
|
+
...state,
|
|
1610
|
+
loading: false,
|
|
1611
|
+
isUsernameError: action?.payload?.isUsernameError ?? false,
|
|
1612
|
+
isMobileError: action?.payload?.isMobileError ?? false,
|
|
1613
|
+
userMessageforusername: action?.payload?.userMessageforusername ?? "",
|
|
1614
|
+
userMessageforMobileno: action?.payload?.userMessageforMobileno ?? "",
|
|
1615
|
+
isApiError: action?.payload?.isApiError ?? false,
|
|
1616
|
+
apierrorMessage: action?.payload?.apierrorMessage ?? "",
|
|
1617
|
+
requestCd: "",
|
|
1618
|
+
username: "",
|
|
1619
|
+
};
|
|
1620
|
+
}
|
|
1621
|
+
case "initverifyUserNameandMobileNo": {
|
|
1622
|
+
return {
|
|
1623
|
+
...state,
|
|
1624
|
+
loading: true,
|
|
1625
|
+
isUsernameError: false,
|
|
1626
|
+
isMobileError: false,
|
|
1627
|
+
requestCd: "",
|
|
1628
|
+
username: "",
|
|
1629
|
+
};
|
|
1630
|
+
}
|
|
1631
|
+
case "verifyUserNameandMobileNoSuccess": {
|
|
1632
|
+
return {
|
|
1633
|
+
...state,
|
|
1634
|
+
loading: false,
|
|
1635
|
+
isUsernameError: false,
|
|
1636
|
+
isMobileError: false,
|
|
1637
|
+
workingState: 0,
|
|
1638
|
+
isApiError: false,
|
|
1639
|
+
apierrorMessage: "",
|
|
1640
|
+
requestCd: action?.payload?.requestCd ?? "",
|
|
1641
|
+
username: action?.payload?.username ?? "",
|
|
1642
|
+
auth_type: action?.payload?.auth_type,
|
|
1643
|
+
company_ID: action?.payload?.company_ID,
|
|
1644
|
+
branch_cd: action?.payload?.branch_cd,
|
|
1645
|
+
otpValidFor: action?.payload?.otpValidFor,
|
|
1646
|
+
};
|
|
1647
|
+
}
|
|
1648
|
+
case "inititateOTPVerification": {
|
|
1649
|
+
return {
|
|
1650
|
+
...state,
|
|
1651
|
+
loading: false,
|
|
1652
|
+
otploading: true,
|
|
1653
|
+
OtpuserMessage: "",
|
|
1654
|
+
otpmodelClose: false,
|
|
1655
|
+
};
|
|
1656
|
+
}
|
|
1657
|
+
case "OTPVerificationComplate": {
|
|
1658
|
+
return {
|
|
1659
|
+
...state,
|
|
1660
|
+
loading: false,
|
|
1661
|
+
otploading: false,
|
|
1662
|
+
OtpuserMessage: "",
|
|
1663
|
+
workingState: 1,
|
|
1664
|
+
otpmodelClose: Boolean(action?.payload?.otpmodelclose),
|
|
1665
|
+
};
|
|
1666
|
+
}
|
|
1667
|
+
case "OTPVerificationFailed": {
|
|
1668
|
+
return {
|
|
1669
|
+
...state,
|
|
1670
|
+
otploading: false,
|
|
1671
|
+
OtpuserMessage: action?.payload?.error,
|
|
1672
|
+
otpmodelClose: Boolean(action?.payload?.otpmodelclose),
|
|
1673
|
+
};
|
|
1674
|
+
}
|
|
1675
|
+
case "verifyPasswordFailed": {
|
|
1676
|
+
return {
|
|
1677
|
+
...state,
|
|
1678
|
+
loading: false,
|
|
1679
|
+
isPasswordError: action?.payload?.isPasswordError ?? false,
|
|
1680
|
+
isConfirmPasswordError: action?.payload?.isConfirmPasswordError ?? false,
|
|
1681
|
+
userMessageforPassword: action?.payload?.userMessageforPassword ?? "",
|
|
1682
|
+
userMessageforconfirmPassword: action?.payload?.userMessageforconfirmPassword ?? "",
|
|
1683
|
+
isApiError: false,
|
|
1684
|
+
apierrorMessage: "",
|
|
1685
|
+
};
|
|
1686
|
+
}
|
|
1687
|
+
case "initverifyPasswordSetReq": {
|
|
1688
|
+
return {
|
|
1689
|
+
...state,
|
|
1690
|
+
loading: true,
|
|
1691
|
+
isPasswordError: false,
|
|
1692
|
+
isConfirmPasswordError: false,
|
|
1693
|
+
};
|
|
1694
|
+
}
|
|
1695
|
+
case "passwordRegistaredSuccess": {
|
|
1696
|
+
return {
|
|
1697
|
+
...state,
|
|
1698
|
+
loading: false,
|
|
1699
|
+
isPasswordError: false,
|
|
1700
|
+
isConfirmPasswordError: false,
|
|
1701
|
+
};
|
|
1702
|
+
}
|
|
1703
|
+
case "OTPResendSuccess": {
|
|
1704
|
+
return {
|
|
1705
|
+
...state,
|
|
1706
|
+
requestCd: action?.payload?.requestCd,
|
|
1707
|
+
};
|
|
1708
|
+
}
|
|
1709
|
+
default: {
|
|
1710
|
+
return state;
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
const ForgotPasswordControllerWrapper = ({ screenFlag, updatenewPassword, veirfyUsernameandMobileNo, verifyOTPForPWDReset, logoUrl, LanguageComponent, bannerDetails }) => {
|
|
1715
|
+
const classes = useStyles();
|
|
1716
|
+
const navigate = useNavigate();
|
|
1717
|
+
const [loginState, dispath] = useReducer(reducer, inititalState);
|
|
1718
|
+
const [open, setOpen] = useState(false);
|
|
1719
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
1720
|
+
const otpResendRef = useRef(1);
|
|
1721
|
+
const { t } = useTranslation();
|
|
1722
|
+
// const {
|
|
1723
|
+
// data: imageData,
|
|
1724
|
+
// isLoading,
|
|
1725
|
+
// isFetching,
|
|
1726
|
+
// isError,
|
|
1727
|
+
// error,
|
|
1728
|
+
// refetch,
|
|
1729
|
+
// } = useQuery<any, any>(["getLoginImageData"], () =>
|
|
1730
|
+
// API.getLoginImageData({ APP_TRAN_CD: "51" })
|
|
1731
|
+
// );
|
|
1732
|
+
const onSubmitHandel = async (data, flag) => {
|
|
1733
|
+
if (verifyRequestData(data, flag)) {
|
|
1734
|
+
if (flag === 0) {
|
|
1735
|
+
dispath({ type: "initverifyUserNameandMobileNo" });
|
|
1736
|
+
const { status, data: resdata, message, } = await veirfyUsernameandMobileNo(data?.userName.toLowerCase(), data?.mobileno, screenFlag);
|
|
1737
|
+
if (status === "0") {
|
|
1738
|
+
dispath({
|
|
1739
|
+
type: "verifyUserNameandMobileNoSuccess",
|
|
1740
|
+
payload: {
|
|
1741
|
+
requestCd: String(resdata?.TRAN_CD ?? ""),
|
|
1742
|
+
username: data?.userName,
|
|
1743
|
+
auth_type: resdata?.AUTH_TYPE,
|
|
1744
|
+
company_ID: resdata?.COMP_CD,
|
|
1745
|
+
branch_cd: resdata?.BRANCH_CD,
|
|
1746
|
+
otpValidFor: resdata?.OTP_VALID,
|
|
1747
|
+
},
|
|
1748
|
+
});
|
|
1749
|
+
setOpen(true);
|
|
1750
|
+
}
|
|
1751
|
+
else {
|
|
1752
|
+
dispath({
|
|
1753
|
+
type: "verifyUserNameandMobileNoFailed",
|
|
1754
|
+
payload: {
|
|
1755
|
+
isApiError: true,
|
|
1756
|
+
apierrorMessage: message,
|
|
1757
|
+
},
|
|
1758
|
+
});
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
else if (flag === 1) {
|
|
1762
|
+
dispath({ type: "initverifyPasswordSetReq" });
|
|
1763
|
+
const { status, data: resdata, message, } = await updatenewPassword(loginState?.requestCd, loginState?.username, data?.password);
|
|
1764
|
+
if (status === "0") {
|
|
1765
|
+
dispath({ type: "passwordRegistaredSuccess" });
|
|
1766
|
+
enqueueSnackbar("Password successfully reset", {
|
|
1767
|
+
variant: "success",
|
|
1768
|
+
});
|
|
1769
|
+
navigate("login");
|
|
1770
|
+
}
|
|
1771
|
+
else if (status === "99") {
|
|
1772
|
+
dispath({
|
|
1773
|
+
type: "verifyPasswordFailed",
|
|
1774
|
+
payload: {
|
|
1775
|
+
isApiError: true,
|
|
1776
|
+
apierrorMessage: message,
|
|
1777
|
+
},
|
|
1778
|
+
});
|
|
1779
|
+
}
|
|
1780
|
+
else {
|
|
1781
|
+
enqueueSnackbar(message, {
|
|
1782
|
+
variant: "error",
|
|
1783
|
+
});
|
|
1784
|
+
navigate("login");
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
};
|
|
1789
|
+
const verifyRequestData = (data, flag) => {
|
|
1790
|
+
if (flag === 0) {
|
|
1791
|
+
let validationData = {
|
|
1792
|
+
isUsernameError: false,
|
|
1793
|
+
isMobileError: false,
|
|
1794
|
+
userMessageforusername: "",
|
|
1795
|
+
userMessageforMobileno: "",
|
|
1796
|
+
};
|
|
1797
|
+
if (!Boolean(data.userName)) {
|
|
1798
|
+
validationData.isUsernameError = true;
|
|
1799
|
+
validationData.userMessageforusername = "UsernameisRequired";
|
|
1800
|
+
}
|
|
1801
|
+
if (!Boolean(data.mobileno)) {
|
|
1802
|
+
validationData.isMobileError = true;
|
|
1803
|
+
validationData.userMessageforMobileno = "MobileNoisRequired";
|
|
1804
|
+
}
|
|
1805
|
+
else if (isNaN(data.mobileno) ||
|
|
1806
|
+
(data.mobileno.length !== 10 && data.mobileno.length !== 13)) {
|
|
1807
|
+
validationData.isMobileError = true;
|
|
1808
|
+
validationData.userMessageforMobileno = "Please enter valid Mobile No.";
|
|
1809
|
+
}
|
|
1810
|
+
dispath({
|
|
1811
|
+
type: "verifyUserNameandMobileNoFailed",
|
|
1812
|
+
payload: validationData,
|
|
1813
|
+
});
|
|
1814
|
+
return !(validationData.isMobileError || validationData.isUsernameError);
|
|
1815
|
+
}
|
|
1816
|
+
else if (flag === 1) {
|
|
1817
|
+
let validationData = {
|
|
1818
|
+
isPasswordError: false,
|
|
1819
|
+
userMessageforPassword: "",
|
|
1820
|
+
isConfirmPasswordError: false,
|
|
1821
|
+
userMessageforconfirmPassword: "",
|
|
1822
|
+
};
|
|
1823
|
+
let pwdverify = utilFunction.ValidatePassword(data.password);
|
|
1824
|
+
if (Boolean(pwdverify)) {
|
|
1825
|
+
validationData.isPasswordError = true;
|
|
1826
|
+
validationData.userMessageforPassword = pwdverify;
|
|
1827
|
+
}
|
|
1828
|
+
if (!Boolean(data.confirmpassword)) {
|
|
1829
|
+
validationData.isConfirmPasswordError = true;
|
|
1830
|
+
validationData.userMessageforconfirmPassword =
|
|
1831
|
+
"Confirmpasswordisrequired";
|
|
1832
|
+
}
|
|
1833
|
+
else if (Boolean(data.password) &&
|
|
1834
|
+
data.password !== data.confirmpassword) {
|
|
1835
|
+
validationData.isConfirmPasswordError = true;
|
|
1836
|
+
validationData.userMessageforconfirmPassword =
|
|
1837
|
+
"New Password and Confirm Password did not matched";
|
|
1838
|
+
}
|
|
1839
|
+
dispath({
|
|
1840
|
+
type: "verifyPasswordFailed",
|
|
1841
|
+
payload: validationData,
|
|
1842
|
+
});
|
|
1843
|
+
return !(validationData.isConfirmPasswordError || validationData.isPasswordError);
|
|
1844
|
+
}
|
|
1845
|
+
return true;
|
|
1846
|
+
};
|
|
1847
|
+
const handleClose = () => {
|
|
1848
|
+
setOpen(false);
|
|
1849
|
+
};
|
|
1850
|
+
const VerifyOTP = async (OTPNumber) => {
|
|
1851
|
+
if (Boolean(OTPNumber) && OTPNumber.toString().length === 6) {
|
|
1852
|
+
dispath({ type: "inititateOTPVerification" });
|
|
1853
|
+
const { status, data: resdata, message, } = await verifyOTPForPWDReset(loginState?.requestCd, loginState?.username, OTPNumber, loginState?.auth_type, screenFlag);
|
|
1854
|
+
if (status === "0") {
|
|
1855
|
+
if (screenFlag === "totp") {
|
|
1856
|
+
enqueueSnackbar(message, {
|
|
1857
|
+
variant: "success",
|
|
1858
|
+
});
|
|
1859
|
+
navigate("login");
|
|
1860
|
+
}
|
|
1861
|
+
else {
|
|
1862
|
+
dispath({
|
|
1863
|
+
type: "OTPVerificationComplate",
|
|
1864
|
+
payload: { otpmodelclose: true },
|
|
1865
|
+
});
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
else if (status === "99") {
|
|
1869
|
+
dispath({
|
|
1870
|
+
type: "OTPVerificationFailed",
|
|
1871
|
+
payload: { error: message },
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
else {
|
|
1875
|
+
enqueueSnackbar(message, {
|
|
1876
|
+
variant: "error",
|
|
1877
|
+
});
|
|
1878
|
+
navigate("login");
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
else {
|
|
1882
|
+
dispath({
|
|
1883
|
+
type: "OTPVerificationFailed",
|
|
1884
|
+
payload: { error: "Please enter a 6 digit OTP number" },
|
|
1885
|
+
});
|
|
1886
|
+
}
|
|
1887
|
+
};
|
|
1888
|
+
// useEffect(() => {
|
|
1889
|
+
// GeneralAPI.setDocumentName("Password Reset");
|
|
1890
|
+
// }, []);
|
|
1891
|
+
return (jsx(Fragment$1, { children: jsxs(Grid, { container: true, style: { height: "100vh", overflow: "hidden" }, children: [jsx(BankDetails, { bannerDetails: bannerDetails }), jsxs(Grid, { item: true, xs: 6, md: 6, lg: 6, sm: 6, children: [jsx(Grid, { container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", padding: "31px", children: jsx("img", { src: logoUrl, alt: "Logo" }) }), jsx(Grid, { container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", padding: "0 35px 0 0", children: jsx(LanguageComponent, {}) }), jsx(Container, { maxWidth: "xs", children: jsxs(Grid, { alignItems: "center", style: { paddingTop: "20px" }, children: [jsx("h2", { style: { margin: "10px 0" }, children: loginState.workingState === 1
|
|
1892
|
+
? t("Setnewpassword")
|
|
1893
|
+
: screenFlag === "totp"
|
|
1894
|
+
? "Forgot TOTP"
|
|
1895
|
+
: t("ForgotPassword") }), open ? (jsx(OTPModelForm, { classes: classes, handleClose: handleClose, loginState: loginState, VerifyOTP: VerifyOTP, OTPError: t(loginState?.OtpuserMessage ?? ""), setOTPError: (error) => {
|
|
1896
|
+
dispath({
|
|
1897
|
+
type: "OTPVerificationFailed",
|
|
1898
|
+
payload: { error: error },
|
|
1899
|
+
});
|
|
1900
|
+
}, resendFlag: "FORGET_PW", setNewRequestID: (newRequestID) => {
|
|
1901
|
+
dispath({
|
|
1902
|
+
type: "OTPResendSuccess",
|
|
1903
|
+
payload: { requestCd: newRequestID },
|
|
1904
|
+
});
|
|
1905
|
+
otpResendRef.current = otpResendRef.current + 1;
|
|
1906
|
+
}, otpresendCount: otpResendRef.current, OTPResendRequest: undefined })) : (jsx(ForgotPasswordFields, { classes: classes, loginState: loginState, onSubmit: onSubmitHandel }))] }) })] })] }) }));
|
|
1907
|
+
};
|
|
1908
|
+
|
|
1909
|
+
export { AuthControllerWrapper, ForgotPasswordControllerWrapper };
|
|
1471
1910
|
//# sourceMappingURL=index.js.map
|