@acuteinfo/common-screens 1.0.59 → 1.0.61
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.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'regenerator-runtime/runtime';
|
|
2
2
|
import './assets/index~NFLKLAwc.css';
|
|
3
3
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
4
|
-
import { TextField, GradientButton, utilFunction, ClearCacheProvider, queryClient, Alert, GridWrapper, SearchBar } from '@acuteinfo/common-base';
|
|
4
|
+
import { TextField, GradientButton, utilFunction, usePopupContext, ClearCacheProvider, queryClient, Alert, GridWrapper, SearchBar } from '@acuteinfo/common-base';
|
|
5
5
|
import { useState, useRef, useEffect, Fragment, useMemo, useReducer, useCallback } from 'react';
|
|
6
6
|
import { makeStyles } from '@mui/styles';
|
|
7
7
|
import Visibility from '@mui/icons-material/Visibility';
|
|
@@ -376,9 +376,11 @@ const OTPModel = ({ classes, OTPResendRequest, open, handleClose, loginState, Ve
|
|
|
376
376
|
};
|
|
377
377
|
const handleResendClick = async () => {
|
|
378
378
|
setResendotpLoading(true);
|
|
379
|
-
const { status, data, message } = await OTPResendRequest(
|
|
380
|
-
|
|
381
|
-
|
|
379
|
+
const { status, data, message } = await OTPResendRequest(
|
|
380
|
+
// resendFlag === "FORGET_PW" || resendFlag === "FORGT_TOTP"
|
|
381
|
+
// ? loginState?.requestCd
|
|
382
|
+
// : loginState?.transactionID,
|
|
383
|
+
loginState?.comapanyCD, loginState?.branchCD, loginState?.contactUser, resendFlag, loginState?.otpValidFor, loginState?.username);
|
|
382
384
|
setResendotpLoading(false);
|
|
383
385
|
if (status === "0") {
|
|
384
386
|
setNewRequestID(data?.TRAN_CD);
|
|
@@ -406,7 +408,10 @@ const OTPModel = ({ classes, OTPResendRequest, open, handleClose, loginState, Ve
|
|
|
406
408
|
if (loginState?.otpmodelClose ?? false) {
|
|
407
409
|
handleCloseEvent();
|
|
408
410
|
}
|
|
409
|
-
|
|
411
|
+
else if (Boolean(OTPError)) {
|
|
412
|
+
setOTP("");
|
|
413
|
+
}
|
|
414
|
+
}, [loginState.otpmodelClose, OTPError]);
|
|
410
415
|
return (jsx(Fragment, { children: jsx(Container, { maxWidth: "sm", children: jsx(Grid, { alignItems: "center", marginTop: "4em", children: jsxs("div", {
|
|
411
416
|
// className={classes.formWrap}
|
|
412
417
|
style: {
|
|
@@ -424,34 +429,42 @@ const OTPModel = ({ classes, OTPResendRequest, open, handleClose, loginState, Ve
|
|
|
424
429
|
fontStyle: "normal",
|
|
425
430
|
lineHeight: "150%",
|
|
426
431
|
marginBottom: "10px",
|
|
427
|
-
}, children:
|
|
432
|
+
}, children: loginState?.authType === "OTP"
|
|
433
|
+
? t("otp.OTPAuthentication")
|
|
434
|
+
: loginState?.authType === "TOTP"
|
|
435
|
+
? t("otp.TOTPAuthentication")
|
|
436
|
+
: null }), jsx("div", { style: {
|
|
428
437
|
color: "#949597",
|
|
429
438
|
fontSize: "16px",
|
|
430
439
|
fontWeight: "400",
|
|
431
440
|
alignItems: "center",
|
|
432
441
|
fontStyle: "normal",
|
|
433
442
|
lineHeight: "33px",
|
|
434
|
-
}, children:
|
|
443
|
+
}, children: loginState?.authType === "OTP"
|
|
444
|
+
? t("otp.EnterOTPsentToMobile")
|
|
445
|
+
: loginState?.authType === "TOTP"
|
|
446
|
+
? t("otp.PleaseEnterOTP")
|
|
447
|
+
: null }), jsxs("div", { className: classes.OTPalignName, children: [t("otp.Hello"), " ", loginState?.username
|
|
435
448
|
? loginState.username.charAt(0).toUpperCase() +
|
|
436
449
|
loginState.username.slice(1)
|
|
437
|
-
: null, jsx(ResendOTP
|
|
450
|
+
: null, loginState?.authType === "OTP" && (jsx(ResendOTP
|
|
438
451
|
// onResendClick={() => setbtnshow(false)}
|
|
439
452
|
, {
|
|
440
453
|
// onResendClick={() => setbtnshow(false)}
|
|
441
454
|
onResendClick: handleResendClick,
|
|
442
455
|
// onTimerComplete={() => setbtnshow(true)}
|
|
443
|
-
renderButton: renderButton, renderTime: renderTime, maxTime: loginState?.otpValidFor ?? 60, className: classes.resendOTPalign })] }), jsxs("div", { className: classes.divflex, onKeyDown: (e) => {
|
|
456
|
+
renderButton: renderButton, renderTime: renderTime, maxTime: loginState?.otpValidFor ?? 60, className: classes.resendOTPalign }))] }), jsxs("div", { className: classes.divflex, onKeyDown: (e) => {
|
|
444
457
|
if (e.key === "Enter") {
|
|
445
458
|
inputButtonRef?.current?.click?.();
|
|
446
459
|
}
|
|
447
|
-
}, children: [jsx(OTPInput, { value: OTP, onChange: setOTP, autoFocus: true, OTPLength: 6, otpType: "number", disabled:
|
|
460
|
+
}, children: [jsx(OTPInput, { value: OTP, onChange: setOTP, autoFocus: true, OTPLength: 6, otpType: "number", disabled: loginState.otploading || loginState.loading, secure: !showPassword, className: classes.otpinputpadding }), jsx(IconButton$1, { "aria-label": "toggle password visibility", onClick: () => {
|
|
448
461
|
if (!showPassword) {
|
|
449
462
|
setShowPasswordTime(Date.now() + 5000);
|
|
450
463
|
timerRef.current = setTimeout(() => forceUpdate(Date.now()), 5000);
|
|
451
464
|
}
|
|
452
465
|
else if (showPassword)
|
|
453
466
|
setShowPasswordTime(0);
|
|
454
|
-
}, onMouseDown: (e) => e.preventDefault(), disabled: loginState.otploading, className: classes.ibtnvisible, children: showPassword ? jsx(Visibility, {}) : jsx(VisibilityOff, {}) })] }), Boolean(OTPError) ? (jsx(FormHelperText, { style: { color: "red" }, children: OTPError })) : null, jsxs("div", { style: {
|
|
467
|
+
}, onMouseDown: (e) => e.preventDefault(), disabled: loginState.otploading, className: classes.ibtnvisible, children: showPassword ? jsx(Visibility, {}) : jsx(VisibilityOff, {}) })] }), Boolean(OTPError) ? (jsx(FormHelperText, { style: { color: "red" }, children: OTPError })) : null, loginState?.authType === "TOTP" ? (jsx("div", { style: { flex: "auto" }, children: jsx("a", { href: "forgot-totp", style: { color: "var(--theme-color3)" }, children: "Forgot TOTP" }) })) : (jsx(Fragment$1, {})), jsxs("div", { style: {
|
|
455
468
|
display: "flex",
|
|
456
469
|
gap: "10px",
|
|
457
470
|
margin: "42px 0 0 42px",
|
|
@@ -460,13 +473,16 @@ const OTPModel = ({ classes, OTPResendRequest, open, handleClose, loginState, Ve
|
|
|
460
473
|
// fullWidth
|
|
461
474
|
, {
|
|
462
475
|
// fullWidth
|
|
463
|
-
disabled: loginState.otploading, onClick: () => {
|
|
476
|
+
disabled: loginState.otploading || loginState.loading, onClick: () => {
|
|
464
477
|
previousStep(false, "");
|
|
465
478
|
}, className: classes.otpButtons, textColor: "var(--theme-color3)", sx: {
|
|
466
|
-
border: "var(--theme-color3)1px solid",
|
|
479
|
+
border: "var(--theme-color3) 1px solid",
|
|
467
480
|
minWidth: "50%",
|
|
468
481
|
background: "var(--white)",
|
|
469
482
|
borderRadius: "10px",
|
|
483
|
+
"&:disabled": {
|
|
484
|
+
color: "var(-theme-color3) !important",
|
|
485
|
+
},
|
|
470
486
|
"&:hover": {
|
|
471
487
|
background: "var(--white) !important",
|
|
472
488
|
},
|
|
@@ -508,9 +524,12 @@ const OTPModelForm = ({ classes, OTPResendRequest, handleClose, loginState, Veri
|
|
|
508
524
|
};
|
|
509
525
|
const handleResendClick = async () => {
|
|
510
526
|
setResendotpLoading(true);
|
|
511
|
-
const { status, data, message } = await OTPResendRequest(
|
|
512
|
-
|
|
513
|
-
|
|
527
|
+
const { status, data, message } = await OTPResendRequest(
|
|
528
|
+
// resendFlag === "FORGET_PW"
|
|
529
|
+
// ? loginState?.requestCd
|
|
530
|
+
// : loginState?.transactionID,
|
|
531
|
+
// resendFlag,
|
|
532
|
+
loginState?.company_ID, loginState?.branch_cd, loginState?.contactUser, resendFlag, loginState?.otpValidFor, loginState?.username);
|
|
514
533
|
setResendotpLoading(false);
|
|
515
534
|
if (status === "0") {
|
|
516
535
|
setNewRequestID(data?.TRAN_CD);
|
|
@@ -559,19 +578,19 @@ const OTPModelForm = ({ classes, OTPResendRequest, handleClose, loginState, Veri
|
|
|
559
578
|
if (e.key === "Enter") {
|
|
560
579
|
inputButtonRef?.current?.click?.();
|
|
561
580
|
}
|
|
562
|
-
}, children: [jsx(OTPInput, { value: OTP, onChange: setOTP, autoFocus: true, OTPLength: 6, otpType: "number", disabled:
|
|
581
|
+
}, children: [jsx(OTPInput, { value: OTP, onChange: setOTP, autoFocus: true, OTPLength: 6, otpType: "number", disabled: loginState.otploading || loginState.loading, secure: !showPassword, className: classes.otpinputpadding }), jsx(IconButton$1, { "aria-label": "toggle password visibility", onClick: () => {
|
|
563
582
|
if (!showPassword) {
|
|
564
583
|
setShowPasswordTime(Date.now() + 5000);
|
|
565
584
|
timerRef.current = setTimeout(() => forceUpdate(Date.now()), 5000);
|
|
566
585
|
}
|
|
567
586
|
else if (showPassword)
|
|
568
587
|
setShowPasswordTime(0);
|
|
569
|
-
}, onMouseDown: (e) => e.preventDefault(), disabled: loginState.otploading, className: classes.ibtnvisible, children: showPassword ? jsx(Visibility, {}) : jsx(VisibilityOff, {}) })] }), Boolean(OTPError) ? (jsx(FormHelperText, { style: { color: "red" }, children: OTPError })) : null,
|
|
588
|
+
}, onMouseDown: (e) => e.preventDefault(), disabled: loginState.otploading, className: classes.ibtnvisible, children: showPassword ? jsx(Visibility, {}) : jsx(VisibilityOff, {}) })] }), Boolean(OTPError) ? (jsx(FormHelperText, { style: { color: "red" }, children: OTPError })) : null, jsxs("div", { style: {
|
|
570
589
|
display: "flex",
|
|
571
590
|
gap: "10px",
|
|
572
591
|
margin: "42px 0 0 42px",
|
|
573
592
|
width: "60%",
|
|
574
|
-
}, children: [jsx(GradientButton, { fullWidth: true, disabled: loginState.otploading, onClick: handleCloseEvent, className: classes.otpButtons, starticon: "West", textColor: "var(--white) !important", sx: {
|
|
593
|
+
}, children: [jsx(GradientButton, { fullWidth: true, disabled: loginState.otploading || loginState.loading, onClick: handleCloseEvent, className: classes.otpButtons, starticon: "West", textColor: "var(--white) !important", sx: {
|
|
575
594
|
"&:disabled": {
|
|
576
595
|
color: "var(-theme-color3) !important",
|
|
577
596
|
},
|
|
@@ -824,7 +843,7 @@ const BankDetails = ({ bannerDetails }) => {
|
|
|
824
843
|
}, children: jsxs(Container, { maxWidth: "sm", children: [jsxs("div", { className: "text", style: {
|
|
825
844
|
color: "white",
|
|
826
845
|
fontStyle: "normal",
|
|
827
|
-
fontSize: "
|
|
846
|
+
fontSize: "31px",
|
|
828
847
|
paddingTop: "30px",
|
|
829
848
|
}, children: [banner?.bannerTitle ?? "", jsx("span", { style: { marginLeft: "8px", fontWeight: "900" } })] }), jsx("div", { style: {
|
|
830
849
|
lineHeight: "27px",
|
|
@@ -836,7 +855,7 @@ const BankDetails = ({ bannerDetails }) => {
|
|
|
836
855
|
}, children: banner?.bannerNote ?? "" })] }) })] }) }));
|
|
837
856
|
};
|
|
838
857
|
|
|
839
|
-
const PasswordRotation = ({ classes, ResetPassword, open, username, accessToken, tokenType, handleClose, }) => {
|
|
858
|
+
const PasswordRotation = ({ classes, ResetPassword, open, username, accessToken, tokenType, handleClose, validatePasswordFn }) => {
|
|
840
859
|
const inputButtonRef = useRef(null);
|
|
841
860
|
const { enqueueSnackbar } = useSnackbar();
|
|
842
861
|
const { t } = useTranslation();
|
|
@@ -873,6 +892,7 @@ const PasswordRotation = ({ classes, ResetPassword, open, username, accessToken,
|
|
|
873
892
|
isconfirmnewpwdError: false,
|
|
874
893
|
confirmnewpassworderror: "",
|
|
875
894
|
};
|
|
895
|
+
// Local validation
|
|
876
896
|
if (!Boolean(input.oldpassword)) {
|
|
877
897
|
setPwdData.isoldPwdError = true;
|
|
878
898
|
setPwdData.oldpassworderror = "Current Password is required.";
|
|
@@ -888,8 +908,7 @@ const PasswordRotation = ({ classes, ResetPassword, open, username, accessToken,
|
|
|
888
908
|
Boolean(input.password) &&
|
|
889
909
|
input.oldpassword === input.password) {
|
|
890
910
|
setPwdData.isnewpwdError = true;
|
|
891
|
-
setPwdData.newpassworderror =
|
|
892
|
-
"The new password cannot be the same as the old password";
|
|
911
|
+
setPwdData.newpassworderror = "The new password cannot be the same as the old password";
|
|
893
912
|
isError = true;
|
|
894
913
|
}
|
|
895
914
|
if (!Boolean(input.confirmpassword)) {
|
|
@@ -900,29 +919,46 @@ const PasswordRotation = ({ classes, ResetPassword, open, username, accessToken,
|
|
|
900
919
|
else if (Boolean(input.password) &&
|
|
901
920
|
input.password !== input.confirmpassword) {
|
|
902
921
|
setPwdData.isconfirmnewpwdError = true;
|
|
903
|
-
setPwdData.confirmnewpassworderror =
|
|
904
|
-
"New Password and Confirm Password did not matched";
|
|
922
|
+
setPwdData.confirmnewpassworderror = "New Password and Confirm Password did not match";
|
|
905
923
|
isError = true;
|
|
906
924
|
}
|
|
907
925
|
if (isError) {
|
|
908
926
|
setPasswordReset(setPwdData);
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
// API validation
|
|
930
|
+
setPasswordReset((values) => ({ ...values, isLoading: true }));
|
|
931
|
+
const { validateStatus, validateData } = await validatePasswordFn({
|
|
932
|
+
USER_ID: input.userName,
|
|
933
|
+
PASSWORD: input.password,
|
|
934
|
+
SCREEN_REF: "LOGIN"
|
|
935
|
+
});
|
|
936
|
+
setPasswordReset((values) => ({ ...values, isLoading: false }));
|
|
937
|
+
if (validateStatus === "0") {
|
|
938
|
+
switch (validateData?.O_STATUS) {
|
|
939
|
+
case "999":
|
|
940
|
+
setPwdData.isnewpwdError = true;
|
|
941
|
+
setPwdData.newpassworderror = validateData?.O_MESSAGE;
|
|
942
|
+
setPasswordReset(setPwdData);
|
|
943
|
+
return;
|
|
944
|
+
case "0":
|
|
945
|
+
let response = await ResetPassword(input.userName, input.oldpassword, input.password, accessToken, tokenType);
|
|
946
|
+
setPasswordReset((values) => ({ ...values, isLoading: true }));
|
|
947
|
+
if (response.status === "0") {
|
|
948
|
+
enqueueSnackbar("Password successfully changed.", {
|
|
949
|
+
variant: "success",
|
|
950
|
+
});
|
|
951
|
+
handleClose("0");
|
|
952
|
+
setPasswordReset((values) => ({ ...values, isLoading: false }));
|
|
953
|
+
}
|
|
954
|
+
else {
|
|
955
|
+
setPasswordReset((values) => ({
|
|
956
|
+
...values,
|
|
957
|
+
isError: true,
|
|
958
|
+
errorMessage: response.message,
|
|
959
|
+
}));
|
|
960
|
+
}
|
|
961
|
+
break;
|
|
926
962
|
}
|
|
927
963
|
}
|
|
928
964
|
};
|
|
@@ -1003,14 +1039,14 @@ const inititalState$1 = {
|
|
|
1003
1039
|
userMessageforusername: "",
|
|
1004
1040
|
currentFlow: "username",
|
|
1005
1041
|
transactionID: "",
|
|
1042
|
+
comapanyCD: "",
|
|
1043
|
+
branchCD: "",
|
|
1044
|
+
contactUser: "",
|
|
1006
1045
|
access_token: "",
|
|
1007
1046
|
token_type: "",
|
|
1008
1047
|
otpmodelClose: false,
|
|
1009
1048
|
authType: "",
|
|
1010
1049
|
isScanning: false,
|
|
1011
|
-
auth_data: [],
|
|
1012
|
-
company_ID: "",
|
|
1013
|
-
Branch_CD: "",
|
|
1014
1050
|
auth_type: "O",
|
|
1015
1051
|
otpValidFor: 60,
|
|
1016
1052
|
};
|
|
@@ -1045,6 +1081,9 @@ const reducer$1 = (state, action) => {
|
|
|
1045
1081
|
userMessageforusername: action?.payload?.errorUsername,
|
|
1046
1082
|
username: "",
|
|
1047
1083
|
transactionID: "",
|
|
1084
|
+
comapanyCD: "",
|
|
1085
|
+
branchCD: "",
|
|
1086
|
+
contactUser: ""
|
|
1048
1087
|
};
|
|
1049
1088
|
}
|
|
1050
1089
|
case "passwordVerificationFailure":
|
|
@@ -1059,6 +1098,8 @@ const reducer$1 = (state, action) => {
|
|
|
1059
1098
|
userMessageforpassword: action?.payload?.errorPassword,
|
|
1060
1099
|
username: "",
|
|
1061
1100
|
transactionID: "",
|
|
1101
|
+
comapanyCD: "",
|
|
1102
|
+
branchCD: ""
|
|
1062
1103
|
};
|
|
1063
1104
|
case "usernameVerificationFailure": {
|
|
1064
1105
|
return {
|
|
@@ -1072,6 +1113,9 @@ const reducer$1 = (state, action) => {
|
|
|
1072
1113
|
userMessageforusername: action?.payload?.errorUsername,
|
|
1073
1114
|
username: "",
|
|
1074
1115
|
transactionID: "",
|
|
1116
|
+
comapanyCD: "",
|
|
1117
|
+
branchCD: "",
|
|
1118
|
+
contactUser: ""
|
|
1075
1119
|
};
|
|
1076
1120
|
}
|
|
1077
1121
|
case "inititatePasswordVerification": {
|
|
@@ -1088,6 +1132,9 @@ const reducer$1 = (state, action) => {
|
|
|
1088
1132
|
username: "",
|
|
1089
1133
|
transactionID: "",
|
|
1090
1134
|
access_token: "",
|
|
1135
|
+
comapanyCD: "",
|
|
1136
|
+
branchCD: "",
|
|
1137
|
+
contactUser: ""
|
|
1091
1138
|
};
|
|
1092
1139
|
}
|
|
1093
1140
|
case "passwordRotation": {
|
|
@@ -1112,6 +1159,9 @@ const reducer$1 = (state, action) => {
|
|
|
1112
1159
|
loading: false,
|
|
1113
1160
|
otploading: false,
|
|
1114
1161
|
transactionID: action?.payload?.transactionID,
|
|
1162
|
+
comapanyCD: action?.payload?.comapanyCD,
|
|
1163
|
+
branchCD: action?.payload?.branchCD,
|
|
1164
|
+
contactUser: action?.payload?.contactUser,
|
|
1115
1165
|
username: action?.payload?.username,
|
|
1116
1166
|
auth_type: action?.payload?.auth_type,
|
|
1117
1167
|
OtpuserMessage: "",
|
|
@@ -1122,7 +1172,6 @@ const reducer$1 = (state, action) => {
|
|
|
1122
1172
|
authType: action?.payload?.authType,
|
|
1123
1173
|
auth_data: action?.payload?.auth_data,
|
|
1124
1174
|
otpValidFor: action?.payload?.otpValidFor,
|
|
1125
|
-
company_ID: action?.paylod?.company_ID,
|
|
1126
1175
|
};
|
|
1127
1176
|
}
|
|
1128
1177
|
case "inititatebiometricVerification": {
|
|
@@ -1187,7 +1236,7 @@ const reducer$1 = (state, action) => {
|
|
|
1187
1236
|
}
|
|
1188
1237
|
}
|
|
1189
1238
|
};
|
|
1190
|
-
const AuthControllerWrapper = ({ bannerDetails, logoUrl, logoTitle, loginFn, veirfyUsernameandPassword, verifyOTP, OTPResendRequest, ResetPassword, LanguageComponent, forgotPasswordEndpoint, }) => {
|
|
1239
|
+
const AuthControllerWrapper = ({ bannerDetails, logoUrl, logoTitle, loginFn, veirfyUsernameandPassword, validatePasswordFn, verifyOTP, OTPResendRequest, ResetPassword, LanguageComponent, forgotPasswordEndpoint, }) => {
|
|
1191
1240
|
const classes = useStyles$3();
|
|
1192
1241
|
const [loginState, dispath] = useReducer(reducer$1, inititalState$1);
|
|
1193
1242
|
const [openpwdreset, setOpenPwdReset] = useState(false);
|
|
@@ -1196,6 +1245,7 @@ const AuthControllerWrapper = ({ bannerDetails, logoUrl, logoTitle, loginFn, vei
|
|
|
1196
1245
|
const urlObj = useRef(null);
|
|
1197
1246
|
const { t } = useTranslation();
|
|
1198
1247
|
const otpResendRef = useRef(1);
|
|
1248
|
+
const { MessageBox } = usePopupContext();
|
|
1199
1249
|
useEffect(() => {
|
|
1200
1250
|
if (Boolean(logoUrl)) {
|
|
1201
1251
|
if (isBase64(logoUrl)) {
|
|
@@ -1231,20 +1281,26 @@ const AuthControllerWrapper = ({ bannerDetails, logoUrl, logoTitle, loginFn, vei
|
|
|
1231
1281
|
dispath({
|
|
1232
1282
|
type: "passwordVerificationSuccessful",
|
|
1233
1283
|
payload: {
|
|
1284
|
+
comapanyCD: data?.BASE_COMP_CD,
|
|
1285
|
+
branchCD: data?.BASE_BRANCH_CD,
|
|
1286
|
+
contactUser: data?.CONTACT2,
|
|
1234
1287
|
transactionID: data?.REQUEST_CD,
|
|
1235
1288
|
username: username,
|
|
1236
1289
|
access_token: access_token?.access_token,
|
|
1237
1290
|
token_type: access_token?.token_type,
|
|
1238
1291
|
authType: data?.AUTH_TYPE,
|
|
1239
|
-
auth_data:
|
|
1240
|
-
{
|
|
1241
|
-
company_ID: data?.BASE_COMP_CD ?? "",
|
|
1242
|
-
branch_cd: data?.BASE_BRANCH_CD,
|
|
1243
|
-
},
|
|
1244
|
-
],
|
|
1292
|
+
auth_data: data?.AUTH_DATA,
|
|
1245
1293
|
otpValidFor: data?.OTP_VALID,
|
|
1246
1294
|
},
|
|
1247
1295
|
});
|
|
1296
|
+
if (data?.STATUS === "0") {
|
|
1297
|
+
for (let i = 0; i < data?.ALERT_MSG_LIST.length; i++) {
|
|
1298
|
+
await MessageBox({
|
|
1299
|
+
messageTitle: "Password Alert",
|
|
1300
|
+
message: data?.ALERT_MSG_LIST[i],
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1248
1304
|
}
|
|
1249
1305
|
else {
|
|
1250
1306
|
dispath({
|
|
@@ -1417,7 +1473,7 @@ const AuthControllerWrapper = ({ bannerDetails, logoUrl, logoTitle, loginFn, vei
|
|
|
1417
1473
|
});
|
|
1418
1474
|
}
|
|
1419
1475
|
};
|
|
1420
|
-
return (jsx(Fragment$1, { children: jsxs(Grid, { container: true, style: { height: "100vh", overflow: "hidden" }, children: [jsx(BankDetails, { bannerDetails: bannerDetails }), jsxs(Grid, { item: true, xs: 11, md: 6, lg: 6, sm: 6, children: [logoUrl ? (jsx(Grid, { container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", padding: "25px", maxWidth: "210px", ml: "auto", children: jsx(Tooltip, { describeChild: true, title: logoTitle ?? "", children: jsx("img", { src: Boolean(dashboardLogoURL) ? dashboardLogoURL : "", alt: "Logo", width: "100%" }) }) })) : null, LanguageComponent ? (jsx(Grid, { container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", padding: "0 35px 0 0", maxWidth: "180px", ml: "auto", children: jsx(LanguageComponent, {}) })) : null, openpwdreset ? (jsx(PasswordRotation, { classes: classes, ResetPassword: ResetPassword, open: openpwdreset, username: loginState.username, accessToken: loginState.access_token, tokenType: loginState.token_type, handleClose: handlePasswordRotationClose })) : (jsx(Fragment$1, { children: loginState.currentFlow === "username" ? (jsx(UsernamePasswordField, { classes: classes, loginState: loginState, verifyUsernamePassword: verifyUsernamePassword, forgotPasswordEndpoint: forgotPasswordEndpoint }, "username")) : (jsx(Fragment$1, { children: loginState.authType === "OTP" ? (jsx(OTPModel, { OTPResendRequest: OTPResendRequest, classes: classes, loginState: loginState, VerifyOTP: VerifyOTP, previousStep: changeUserName, OTPError: t(loginState?.OtpuserMessage ?? ""), setOTPError: (error) => {
|
|
1476
|
+
return (jsx(Fragment$1, { children: jsxs(Grid, { container: true, style: { height: "100vh", overflow: "hidden" }, children: [jsx(BankDetails, { bannerDetails: bannerDetails }), jsxs(Grid, { item: true, xs: 11, md: 6, lg: 6, sm: 6, children: [logoUrl ? (jsx(Grid, { container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", padding: "25px", maxWidth: "210px", ml: "auto", children: jsx(Tooltip, { describeChild: true, title: logoTitle ?? "", children: jsx("img", { src: Boolean(dashboardLogoURL) ? dashboardLogoURL : "", alt: "Logo", width: "100%" }) }) })) : null, LanguageComponent ? (jsx(Grid, { container: true, direction: "row", justifyContent: "flex-end", alignItems: "center", padding: "0 35px 0 0", maxWidth: "180px", ml: "auto", children: jsx(LanguageComponent, {}) })) : null, openpwdreset ? (jsx(PasswordRotation, { classes: classes, ResetPassword: ResetPassword, open: openpwdreset, username: loginState.username, accessToken: loginState.access_token, tokenType: loginState.token_type, handleClose: handlePasswordRotationClose, validatePasswordFn: validatePasswordFn })) : (jsx(Fragment$1, { children: loginState.currentFlow === "username" ? (jsx(UsernamePasswordField, { classes: classes, loginState: loginState, verifyUsernamePassword: verifyUsernamePassword, forgotPasswordEndpoint: forgotPasswordEndpoint }, "username")) : (jsx(Fragment$1, { children: loginState.authType === "OTP" ? (jsx(OTPModel, { OTPResendRequest: OTPResendRequest, classes: classes, loginState: loginState, VerifyOTP: VerifyOTP, previousStep: changeUserName, OTPError: t(loginState?.OtpuserMessage ?? ""), setOTPError: (error) => {
|
|
1421
1477
|
dispath({
|
|
1422
1478
|
type: "OTPVerificationFailed",
|
|
1423
1479
|
payload: { error: error },
|
|
@@ -1576,6 +1632,7 @@ const inititalState = {
|
|
|
1576
1632
|
username: "",
|
|
1577
1633
|
auth_type: "O",
|
|
1578
1634
|
transactionID: "",
|
|
1635
|
+
contactUser: "",
|
|
1579
1636
|
};
|
|
1580
1637
|
const reducer = (state, action) => {
|
|
1581
1638
|
switch (action.type) {
|
|
@@ -1591,6 +1648,7 @@ const reducer = (state, action) => {
|
|
|
1591
1648
|
apierrorMessage: action?.payload?.apierrorMessage ?? "",
|
|
1592
1649
|
requestCd: "",
|
|
1593
1650
|
username: "",
|
|
1651
|
+
contactUser: "",
|
|
1594
1652
|
};
|
|
1595
1653
|
}
|
|
1596
1654
|
case "initverifyUserNameandMobileNo": {
|
|
@@ -1618,6 +1676,7 @@ const reducer = (state, action) => {
|
|
|
1618
1676
|
company_ID: action?.payload?.company_ID,
|
|
1619
1677
|
branch_cd: action?.payload?.branch_cd,
|
|
1620
1678
|
otpValidFor: action?.payload?.otpValidFor,
|
|
1679
|
+
contactUser: action?.payload?.contactUser,
|
|
1621
1680
|
};
|
|
1622
1681
|
}
|
|
1623
1682
|
case "inititateOTPVerification": {
|
|
@@ -1686,7 +1745,7 @@ const reducer = (state, action) => {
|
|
|
1686
1745
|
}
|
|
1687
1746
|
}
|
|
1688
1747
|
};
|
|
1689
|
-
const ForgotPasswordControllerWrapper = ({ screenFlag, updatenewPassword, veirfyUsernameandMobileNo, verifyOTPForPWDReset, logoUrl, logoTitle, LanguageComponent, bannerDetails, navigate, loginPageEndpoint, }) => {
|
|
1748
|
+
const ForgotPasswordControllerWrapper = ({ screenFlag, updatenewPassword, validatePasswordFn, veirfyUsernameandMobileNo, verifyOTPForPWDReset, logoUrl, logoTitle, LanguageComponent, bannerDetails, navigate, loginPageEndpoint, }) => {
|
|
1690
1749
|
const classes = useStyles$3();
|
|
1691
1750
|
const [loginState, dispath] = useReducer(reducer, inititalState);
|
|
1692
1751
|
const [open, setOpen] = useState(false);
|
|
@@ -1725,6 +1784,7 @@ const ForgotPasswordControllerWrapper = ({ screenFlag, updatenewPassword, veirfy
|
|
|
1725
1784
|
company_ID: resdata?.COMP_CD,
|
|
1726
1785
|
branch_cd: resdata?.BRANCH_CD,
|
|
1727
1786
|
otpValidFor: resdata?.OTP_VALID,
|
|
1787
|
+
contactUser: resdata?.CONTACT2,
|
|
1728
1788
|
},
|
|
1729
1789
|
});
|
|
1730
1790
|
setOpen(true);
|
|
@@ -1741,29 +1801,59 @@ const ForgotPasswordControllerWrapper = ({ screenFlag, updatenewPassword, veirfy
|
|
|
1741
1801
|
}
|
|
1742
1802
|
else if (flag === 1) {
|
|
1743
1803
|
dispath({ type: "initverifyPasswordSetReq" });
|
|
1744
|
-
const {
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1804
|
+
const { validateStatus, validateData } = await validatePasswordFn({
|
|
1805
|
+
USER_ID: data?.userName,
|
|
1806
|
+
PASSWORD: data?.password,
|
|
1807
|
+
SCREEN_REF: "FORGET_PW"
|
|
1808
|
+
});
|
|
1809
|
+
// console.log("validateData", validateData?.O_MESSAGE, validateStatus)
|
|
1810
|
+
if (validateStatus === "0") {
|
|
1811
|
+
switch (validateData?.O_STATUS) {
|
|
1812
|
+
case "999":
|
|
1813
|
+
dispath({
|
|
1814
|
+
type: "verifyPasswordFailed",
|
|
1815
|
+
payload: {
|
|
1816
|
+
isPasswordError: true,
|
|
1817
|
+
userMessageforPassword: validateData?.O_MESSAGE,
|
|
1818
|
+
apierrorMessage: validateData?.O_MESSAGE,
|
|
1819
|
+
},
|
|
1820
|
+
});
|
|
1821
|
+
break;
|
|
1822
|
+
case "0":
|
|
1823
|
+
const { status, data: resdata, message } = await updatenewPassword(loginState?.requestCd, loginState?.username, data?.password);
|
|
1824
|
+
if (status === "0") {
|
|
1825
|
+
dispath({ type: "passwordRegistaredSuccess" });
|
|
1826
|
+
enqueueSnackbar("Password successfully reset", {
|
|
1827
|
+
variant: "success",
|
|
1828
|
+
});
|
|
1829
|
+
navigate(loginPageEndpoint);
|
|
1830
|
+
}
|
|
1831
|
+
else if (status === "99") {
|
|
1832
|
+
dispath({
|
|
1833
|
+
type: "verifyPasswordFailed",
|
|
1834
|
+
payload: {
|
|
1835
|
+
isApiError: true,
|
|
1836
|
+
apierrorMessage: message,
|
|
1837
|
+
},
|
|
1838
|
+
});
|
|
1839
|
+
}
|
|
1840
|
+
else {
|
|
1841
|
+
enqueueSnackbar(message, {
|
|
1842
|
+
variant: "error",
|
|
1843
|
+
});
|
|
1844
|
+
navigate(loginPageEndpoint);
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1751
1847
|
}
|
|
1752
|
-
else
|
|
1848
|
+
else {
|
|
1753
1849
|
dispath({
|
|
1754
1850
|
type: "verifyPasswordFailed",
|
|
1755
1851
|
payload: {
|
|
1756
1852
|
isApiError: true,
|
|
1757
|
-
apierrorMessage:
|
|
1853
|
+
apierrorMessage: validateData?.O_MESSAGE,
|
|
1758
1854
|
},
|
|
1759
1855
|
});
|
|
1760
1856
|
}
|
|
1761
|
-
else {
|
|
1762
|
-
enqueueSnackbar(message, {
|
|
1763
|
-
variant: "error",
|
|
1764
|
-
});
|
|
1765
|
-
navigate(loginPageEndpoint);
|
|
1766
|
-
}
|
|
1767
1857
|
}
|
|
1768
1858
|
}
|
|
1769
1859
|
};
|