@acuteinfo/common-screens 1.0.59 → 1.0.60
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,7 +473,7 @@ 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
479
|
border: "var(--theme-color3)1px solid",
|
|
@@ -508,9 +521,12 @@ const OTPModelForm = ({ classes, OTPResendRequest, handleClose, loginState, Veri
|
|
|
508
521
|
};
|
|
509
522
|
const handleResendClick = async () => {
|
|
510
523
|
setResendotpLoading(true);
|
|
511
|
-
const { status, data, message } = await OTPResendRequest(
|
|
512
|
-
|
|
513
|
-
|
|
524
|
+
const { status, data, message } = await OTPResendRequest(
|
|
525
|
+
// resendFlag === "FORGET_PW"
|
|
526
|
+
// ? loginState?.requestCd
|
|
527
|
+
// : loginState?.transactionID,
|
|
528
|
+
// resendFlag,
|
|
529
|
+
loginState?.company_ID, loginState?.branch_cd, loginState?.contactUser, resendFlag, loginState?.otpValidFor, loginState?.username);
|
|
514
530
|
setResendotpLoading(false);
|
|
515
531
|
if (status === "0") {
|
|
516
532
|
setNewRequestID(data?.TRAN_CD);
|
|
@@ -559,19 +575,19 @@ const OTPModelForm = ({ classes, OTPResendRequest, handleClose, loginState, Veri
|
|
|
559
575
|
if (e.key === "Enter") {
|
|
560
576
|
inputButtonRef?.current?.click?.();
|
|
561
577
|
}
|
|
562
|
-
}, children: [jsx(OTPInput, { value: OTP, onChange: setOTP, autoFocus: true, OTPLength: 6, otpType: "number", disabled:
|
|
578
|
+
}, 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
579
|
if (!showPassword) {
|
|
564
580
|
setShowPasswordTime(Date.now() + 5000);
|
|
565
581
|
timerRef.current = setTimeout(() => forceUpdate(Date.now()), 5000);
|
|
566
582
|
}
|
|
567
583
|
else if (showPassword)
|
|
568
584
|
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,
|
|
585
|
+
}, 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
586
|
display: "flex",
|
|
571
587
|
gap: "10px",
|
|
572
588
|
margin: "42px 0 0 42px",
|
|
573
589
|
width: "60%",
|
|
574
|
-
}, children: [jsx(GradientButton, { fullWidth: true, disabled: loginState.otploading, onClick: handleCloseEvent, className: classes.otpButtons, starticon: "West", textColor: "var(--white) !important", sx: {
|
|
590
|
+
}, children: [jsx(GradientButton, { fullWidth: true, disabled: loginState.otploading || loginState.loading, onClick: handleCloseEvent, className: classes.otpButtons, starticon: "West", textColor: "var(--white) !important", sx: {
|
|
575
591
|
"&:disabled": {
|
|
576
592
|
color: "var(-theme-color3) !important",
|
|
577
593
|
},
|
|
@@ -836,7 +852,7 @@ const BankDetails = ({ bannerDetails }) => {
|
|
|
836
852
|
}, children: banner?.bannerNote ?? "" })] }) })] }) }));
|
|
837
853
|
};
|
|
838
854
|
|
|
839
|
-
const PasswordRotation = ({ classes, ResetPassword, open, username, accessToken, tokenType, handleClose, }) => {
|
|
855
|
+
const PasswordRotation = ({ classes, ResetPassword, open, username, accessToken, tokenType, handleClose, validatePasswordFn }) => {
|
|
840
856
|
const inputButtonRef = useRef(null);
|
|
841
857
|
const { enqueueSnackbar } = useSnackbar();
|
|
842
858
|
const { t } = useTranslation();
|
|
@@ -873,6 +889,7 @@ const PasswordRotation = ({ classes, ResetPassword, open, username, accessToken,
|
|
|
873
889
|
isconfirmnewpwdError: false,
|
|
874
890
|
confirmnewpassworderror: "",
|
|
875
891
|
};
|
|
892
|
+
// Local validation
|
|
876
893
|
if (!Boolean(input.oldpassword)) {
|
|
877
894
|
setPwdData.isoldPwdError = true;
|
|
878
895
|
setPwdData.oldpassworderror = "Current Password is required.";
|
|
@@ -888,8 +905,7 @@ const PasswordRotation = ({ classes, ResetPassword, open, username, accessToken,
|
|
|
888
905
|
Boolean(input.password) &&
|
|
889
906
|
input.oldpassword === input.password) {
|
|
890
907
|
setPwdData.isnewpwdError = true;
|
|
891
|
-
setPwdData.newpassworderror =
|
|
892
|
-
"The new password cannot be the same as the old password";
|
|
908
|
+
setPwdData.newpassworderror = "The new password cannot be the same as the old password";
|
|
893
909
|
isError = true;
|
|
894
910
|
}
|
|
895
911
|
if (!Boolean(input.confirmpassword)) {
|
|
@@ -900,29 +916,46 @@ const PasswordRotation = ({ classes, ResetPassword, open, username, accessToken,
|
|
|
900
916
|
else if (Boolean(input.password) &&
|
|
901
917
|
input.password !== input.confirmpassword) {
|
|
902
918
|
setPwdData.isconfirmnewpwdError = true;
|
|
903
|
-
setPwdData.confirmnewpassworderror =
|
|
904
|
-
"New Password and Confirm Password did not matched";
|
|
919
|
+
setPwdData.confirmnewpassworderror = "New Password and Confirm Password did not match";
|
|
905
920
|
isError = true;
|
|
906
921
|
}
|
|
907
922
|
if (isError) {
|
|
908
923
|
setPasswordReset(setPwdData);
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
924
|
+
return;
|
|
925
|
+
}
|
|
926
|
+
// API validation
|
|
927
|
+
setPasswordReset((values) => ({ ...values, isLoading: true }));
|
|
928
|
+
const { validateStatus, validateData } = await validatePasswordFn({
|
|
929
|
+
USER_ID: input.userName,
|
|
930
|
+
PASSWORD: input.password,
|
|
931
|
+
SCREEN_REF: "LOGIN"
|
|
932
|
+
});
|
|
933
|
+
setPasswordReset((values) => ({ ...values, isLoading: false }));
|
|
934
|
+
if (validateStatus === "0") {
|
|
935
|
+
switch (validateData?.O_STATUS) {
|
|
936
|
+
case "999":
|
|
937
|
+
setPwdData.isnewpwdError = true;
|
|
938
|
+
setPwdData.newpassworderror = validateData?.O_MESSAGE;
|
|
939
|
+
setPasswordReset(setPwdData);
|
|
940
|
+
return;
|
|
941
|
+
case "0":
|
|
942
|
+
let response = await ResetPassword(input.userName, input.oldpassword, input.password, accessToken, tokenType);
|
|
943
|
+
setPasswordReset((values) => ({ ...values, isLoading: true }));
|
|
944
|
+
if (response.status === "0") {
|
|
945
|
+
enqueueSnackbar("Password successfully changed.", {
|
|
946
|
+
variant: "success",
|
|
947
|
+
});
|
|
948
|
+
handleClose("0");
|
|
949
|
+
setPasswordReset((values) => ({ ...values, isLoading: false }));
|
|
950
|
+
}
|
|
951
|
+
else {
|
|
952
|
+
setPasswordReset((values) => ({
|
|
953
|
+
...values,
|
|
954
|
+
isError: true,
|
|
955
|
+
errorMessage: response.message,
|
|
956
|
+
}));
|
|
957
|
+
}
|
|
958
|
+
break;
|
|
926
959
|
}
|
|
927
960
|
}
|
|
928
961
|
};
|
|
@@ -1003,14 +1036,14 @@ const inititalState$1 = {
|
|
|
1003
1036
|
userMessageforusername: "",
|
|
1004
1037
|
currentFlow: "username",
|
|
1005
1038
|
transactionID: "",
|
|
1039
|
+
comapanyCD: "",
|
|
1040
|
+
branchCD: "",
|
|
1041
|
+
contactUser: "",
|
|
1006
1042
|
access_token: "",
|
|
1007
1043
|
token_type: "",
|
|
1008
1044
|
otpmodelClose: false,
|
|
1009
1045
|
authType: "",
|
|
1010
1046
|
isScanning: false,
|
|
1011
|
-
auth_data: [],
|
|
1012
|
-
company_ID: "",
|
|
1013
|
-
Branch_CD: "",
|
|
1014
1047
|
auth_type: "O",
|
|
1015
1048
|
otpValidFor: 60,
|
|
1016
1049
|
};
|
|
@@ -1045,6 +1078,9 @@ const reducer$1 = (state, action) => {
|
|
|
1045
1078
|
userMessageforusername: action?.payload?.errorUsername,
|
|
1046
1079
|
username: "",
|
|
1047
1080
|
transactionID: "",
|
|
1081
|
+
comapanyCD: "",
|
|
1082
|
+
branchCD: "",
|
|
1083
|
+
contactUser: ""
|
|
1048
1084
|
};
|
|
1049
1085
|
}
|
|
1050
1086
|
case "passwordVerificationFailure":
|
|
@@ -1059,6 +1095,8 @@ const reducer$1 = (state, action) => {
|
|
|
1059
1095
|
userMessageforpassword: action?.payload?.errorPassword,
|
|
1060
1096
|
username: "",
|
|
1061
1097
|
transactionID: "",
|
|
1098
|
+
comapanyCD: "",
|
|
1099
|
+
branchCD: ""
|
|
1062
1100
|
};
|
|
1063
1101
|
case "usernameVerificationFailure": {
|
|
1064
1102
|
return {
|
|
@@ -1072,6 +1110,9 @@ const reducer$1 = (state, action) => {
|
|
|
1072
1110
|
userMessageforusername: action?.payload?.errorUsername,
|
|
1073
1111
|
username: "",
|
|
1074
1112
|
transactionID: "",
|
|
1113
|
+
comapanyCD: "",
|
|
1114
|
+
branchCD: "",
|
|
1115
|
+
contactUser: ""
|
|
1075
1116
|
};
|
|
1076
1117
|
}
|
|
1077
1118
|
case "inititatePasswordVerification": {
|
|
@@ -1088,6 +1129,9 @@ const reducer$1 = (state, action) => {
|
|
|
1088
1129
|
username: "",
|
|
1089
1130
|
transactionID: "",
|
|
1090
1131
|
access_token: "",
|
|
1132
|
+
comapanyCD: "",
|
|
1133
|
+
branchCD: "",
|
|
1134
|
+
contactUser: ""
|
|
1091
1135
|
};
|
|
1092
1136
|
}
|
|
1093
1137
|
case "passwordRotation": {
|
|
@@ -1112,6 +1156,9 @@ const reducer$1 = (state, action) => {
|
|
|
1112
1156
|
loading: false,
|
|
1113
1157
|
otploading: false,
|
|
1114
1158
|
transactionID: action?.payload?.transactionID,
|
|
1159
|
+
comapanyCD: action?.payload?.comapanyCD,
|
|
1160
|
+
branchCD: action?.payload?.branchCD,
|
|
1161
|
+
contactUser: action?.payload?.contactUser,
|
|
1115
1162
|
username: action?.payload?.username,
|
|
1116
1163
|
auth_type: action?.payload?.auth_type,
|
|
1117
1164
|
OtpuserMessage: "",
|
|
@@ -1122,7 +1169,6 @@ const reducer$1 = (state, action) => {
|
|
|
1122
1169
|
authType: action?.payload?.authType,
|
|
1123
1170
|
auth_data: action?.payload?.auth_data,
|
|
1124
1171
|
otpValidFor: action?.payload?.otpValidFor,
|
|
1125
|
-
company_ID: action?.paylod?.company_ID,
|
|
1126
1172
|
};
|
|
1127
1173
|
}
|
|
1128
1174
|
case "inititatebiometricVerification": {
|
|
@@ -1187,7 +1233,7 @@ const reducer$1 = (state, action) => {
|
|
|
1187
1233
|
}
|
|
1188
1234
|
}
|
|
1189
1235
|
};
|
|
1190
|
-
const AuthControllerWrapper = ({ bannerDetails, logoUrl, logoTitle, loginFn, veirfyUsernameandPassword, verifyOTP, OTPResendRequest, ResetPassword, LanguageComponent, forgotPasswordEndpoint, }) => {
|
|
1236
|
+
const AuthControllerWrapper = ({ bannerDetails, logoUrl, logoTitle, loginFn, veirfyUsernameandPassword, validatePasswordFn, verifyOTP, OTPResendRequest, ResetPassword, LanguageComponent, forgotPasswordEndpoint, }) => {
|
|
1191
1237
|
const classes = useStyles$3();
|
|
1192
1238
|
const [loginState, dispath] = useReducer(reducer$1, inititalState$1);
|
|
1193
1239
|
const [openpwdreset, setOpenPwdReset] = useState(false);
|
|
@@ -1196,6 +1242,7 @@ const AuthControllerWrapper = ({ bannerDetails, logoUrl, logoTitle, loginFn, vei
|
|
|
1196
1242
|
const urlObj = useRef(null);
|
|
1197
1243
|
const { t } = useTranslation();
|
|
1198
1244
|
const otpResendRef = useRef(1);
|
|
1245
|
+
const { MessageBox } = usePopupContext();
|
|
1199
1246
|
useEffect(() => {
|
|
1200
1247
|
if (Boolean(logoUrl)) {
|
|
1201
1248
|
if (isBase64(logoUrl)) {
|
|
@@ -1231,20 +1278,26 @@ const AuthControllerWrapper = ({ bannerDetails, logoUrl, logoTitle, loginFn, vei
|
|
|
1231
1278
|
dispath({
|
|
1232
1279
|
type: "passwordVerificationSuccessful",
|
|
1233
1280
|
payload: {
|
|
1281
|
+
comapanyCD: data?.BASE_COMP_CD,
|
|
1282
|
+
branchCD: data?.BASE_BRANCH_CD,
|
|
1283
|
+
contactUser: data?.CONTACT2,
|
|
1234
1284
|
transactionID: data?.REQUEST_CD,
|
|
1235
1285
|
username: username,
|
|
1236
1286
|
access_token: access_token?.access_token,
|
|
1237
1287
|
token_type: access_token?.token_type,
|
|
1238
1288
|
authType: data?.AUTH_TYPE,
|
|
1239
|
-
auth_data:
|
|
1240
|
-
{
|
|
1241
|
-
company_ID: data?.BASE_COMP_CD ?? "",
|
|
1242
|
-
branch_cd: data?.BASE_BRANCH_CD,
|
|
1243
|
-
},
|
|
1244
|
-
],
|
|
1289
|
+
auth_data: data?.AUTH_DATA,
|
|
1245
1290
|
otpValidFor: data?.OTP_VALID,
|
|
1246
1291
|
},
|
|
1247
1292
|
});
|
|
1293
|
+
if (data?.STATUS === "0") {
|
|
1294
|
+
for (let i = 0; i < data?.ALERT_MSG_LIST.length; i++) {
|
|
1295
|
+
await MessageBox({
|
|
1296
|
+
messageTitle: "Password Alert",
|
|
1297
|
+
message: data?.ALERT_MSG_LIST[i],
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1248
1301
|
}
|
|
1249
1302
|
else {
|
|
1250
1303
|
dispath({
|
|
@@ -1417,7 +1470,7 @@ const AuthControllerWrapper = ({ bannerDetails, logoUrl, logoTitle, loginFn, vei
|
|
|
1417
1470
|
});
|
|
1418
1471
|
}
|
|
1419
1472
|
};
|
|
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) => {
|
|
1473
|
+
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
1474
|
dispath({
|
|
1422
1475
|
type: "OTPVerificationFailed",
|
|
1423
1476
|
payload: { error: error },
|
|
@@ -1576,6 +1629,7 @@ const inititalState = {
|
|
|
1576
1629
|
username: "",
|
|
1577
1630
|
auth_type: "O",
|
|
1578
1631
|
transactionID: "",
|
|
1632
|
+
contactUser: "",
|
|
1579
1633
|
};
|
|
1580
1634
|
const reducer = (state, action) => {
|
|
1581
1635
|
switch (action.type) {
|
|
@@ -1591,6 +1645,7 @@ const reducer = (state, action) => {
|
|
|
1591
1645
|
apierrorMessage: action?.payload?.apierrorMessage ?? "",
|
|
1592
1646
|
requestCd: "",
|
|
1593
1647
|
username: "",
|
|
1648
|
+
contactUser: "",
|
|
1594
1649
|
};
|
|
1595
1650
|
}
|
|
1596
1651
|
case "initverifyUserNameandMobileNo": {
|
|
@@ -1618,6 +1673,7 @@ const reducer = (state, action) => {
|
|
|
1618
1673
|
company_ID: action?.payload?.company_ID,
|
|
1619
1674
|
branch_cd: action?.payload?.branch_cd,
|
|
1620
1675
|
otpValidFor: action?.payload?.otpValidFor,
|
|
1676
|
+
contactUser: action?.payload?.contactUser,
|
|
1621
1677
|
};
|
|
1622
1678
|
}
|
|
1623
1679
|
case "inititateOTPVerification": {
|
|
@@ -1686,7 +1742,7 @@ const reducer = (state, action) => {
|
|
|
1686
1742
|
}
|
|
1687
1743
|
}
|
|
1688
1744
|
};
|
|
1689
|
-
const ForgotPasswordControllerWrapper = ({ screenFlag, updatenewPassword, veirfyUsernameandMobileNo, verifyOTPForPWDReset, logoUrl, logoTitle, LanguageComponent, bannerDetails, navigate, loginPageEndpoint, }) => {
|
|
1745
|
+
const ForgotPasswordControllerWrapper = ({ screenFlag, updatenewPassword, validatePasswordFn, veirfyUsernameandMobileNo, verifyOTPForPWDReset, logoUrl, logoTitle, LanguageComponent, bannerDetails, navigate, loginPageEndpoint, }) => {
|
|
1690
1746
|
const classes = useStyles$3();
|
|
1691
1747
|
const [loginState, dispath] = useReducer(reducer, inititalState);
|
|
1692
1748
|
const [open, setOpen] = useState(false);
|
|
@@ -1725,6 +1781,7 @@ const ForgotPasswordControllerWrapper = ({ screenFlag, updatenewPassword, veirfy
|
|
|
1725
1781
|
company_ID: resdata?.COMP_CD,
|
|
1726
1782
|
branch_cd: resdata?.BRANCH_CD,
|
|
1727
1783
|
otpValidFor: resdata?.OTP_VALID,
|
|
1784
|
+
contactUser: resdata?.CONTACT2,
|
|
1728
1785
|
},
|
|
1729
1786
|
});
|
|
1730
1787
|
setOpen(true);
|
|
@@ -1741,29 +1798,59 @@ const ForgotPasswordControllerWrapper = ({ screenFlag, updatenewPassword, veirfy
|
|
|
1741
1798
|
}
|
|
1742
1799
|
else if (flag === 1) {
|
|
1743
1800
|
dispath({ type: "initverifyPasswordSetReq" });
|
|
1744
|
-
const {
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1801
|
+
const { validateStatus, validateData } = await validatePasswordFn({
|
|
1802
|
+
USER_ID: data?.userName,
|
|
1803
|
+
PASSWORD: data?.password,
|
|
1804
|
+
SCREEN_REF: "FORGET_PW"
|
|
1805
|
+
});
|
|
1806
|
+
// console.log("validateData", validateData?.O_MESSAGE, validateStatus)
|
|
1807
|
+
if (validateStatus === "0") {
|
|
1808
|
+
switch (validateData?.O_STATUS) {
|
|
1809
|
+
case "999":
|
|
1810
|
+
dispath({
|
|
1811
|
+
type: "verifyPasswordFailed",
|
|
1812
|
+
payload: {
|
|
1813
|
+
isPasswordError: true,
|
|
1814
|
+
userMessageforPassword: validateData?.O_MESSAGE,
|
|
1815
|
+
apierrorMessage: validateData?.O_MESSAGE,
|
|
1816
|
+
},
|
|
1817
|
+
});
|
|
1818
|
+
break;
|
|
1819
|
+
case "0":
|
|
1820
|
+
const { status, data: resdata, message } = await updatenewPassword(loginState?.requestCd, loginState?.username, data?.password);
|
|
1821
|
+
if (status === "0") {
|
|
1822
|
+
dispath({ type: "passwordRegistaredSuccess" });
|
|
1823
|
+
enqueueSnackbar("Password successfully reset", {
|
|
1824
|
+
variant: "success",
|
|
1825
|
+
});
|
|
1826
|
+
navigate(loginPageEndpoint);
|
|
1827
|
+
}
|
|
1828
|
+
else if (status === "99") {
|
|
1829
|
+
dispath({
|
|
1830
|
+
type: "verifyPasswordFailed",
|
|
1831
|
+
payload: {
|
|
1832
|
+
isApiError: true,
|
|
1833
|
+
apierrorMessage: message,
|
|
1834
|
+
},
|
|
1835
|
+
});
|
|
1836
|
+
}
|
|
1837
|
+
else {
|
|
1838
|
+
enqueueSnackbar(message, {
|
|
1839
|
+
variant: "error",
|
|
1840
|
+
});
|
|
1841
|
+
navigate(loginPageEndpoint);
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1751
1844
|
}
|
|
1752
|
-
else
|
|
1845
|
+
else {
|
|
1753
1846
|
dispath({
|
|
1754
1847
|
type: "verifyPasswordFailed",
|
|
1755
1848
|
payload: {
|
|
1756
1849
|
isApiError: true,
|
|
1757
|
-
apierrorMessage:
|
|
1850
|
+
apierrorMessage: validateData?.O_MESSAGE,
|
|
1758
1851
|
},
|
|
1759
1852
|
});
|
|
1760
1853
|
}
|
|
1761
|
-
else {
|
|
1762
|
-
enqueueSnackbar(message, {
|
|
1763
|
-
variant: "error",
|
|
1764
|
-
});
|
|
1765
|
-
navigate(loginPageEndpoint);
|
|
1766
|
-
}
|
|
1767
1854
|
}
|
|
1768
1855
|
}
|
|
1769
1856
|
};
|