@solidstarters/solid-core-ui 1.1.8 → 1.1.10
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/components/auth/SolidForgotPassword.d.ts.map +1 -1
- package/dist/components/auth/SolidForgotPassword.js +1 -4
- package/dist/components/auth/SolidForgotPassword.js.map +1 -1
- package/dist/components/auth/SolidInitialLoginOtp.d.ts +5 -0
- package/dist/components/auth/SolidInitialLoginOtp.d.ts.map +1 -0
- package/dist/components/auth/SolidInitialLoginOtp.js +122 -0
- package/dist/components/auth/SolidInitialLoginOtp.js.map +1 -0
- package/dist/components/auth/SolidInitiateRegisterOtp.d.ts +5 -0
- package/dist/components/auth/SolidInitiateRegisterOtp.d.ts.map +1 -0
- package/dist/components/auth/SolidInitiateRegisterOtp.js +122 -0
- package/dist/components/auth/SolidInitiateRegisterOtp.js.map +1 -0
- package/dist/components/auth/SolidLogin.d.ts.map +1 -1
- package/dist/components/auth/SolidLogin.js +62 -19
- package/dist/components/auth/SolidLogin.js.map +1 -1
- package/dist/components/auth/SolidOTPVerify.d.ts.map +1 -1
- package/dist/components/auth/SolidOTPVerify.js +12 -9
- package/dist/components/auth/SolidOTPVerify.js.map +1 -1
- package/dist/components/auth/SolidRegister.d.ts.map +1 -1
- package/dist/components/auth/SolidRegister.js +123 -75
- package/dist/components/auth/SolidRegister.js.map +1 -1
- package/dist/components/auth/SolidResetPassword.d.ts.map +1 -1
- package/dist/components/auth/SolidResetPassword.js +11 -9
- package/dist/components/auth/SolidResetPassword.js.map +1 -1
- package/dist/components/common/SocialMediaLogin.d.ts.map +1 -1
- package/dist/components/common/SocialMediaLogin.js +4 -2
- package/dist/components/common/SocialMediaLogin.js.map +1 -1
- package/dist/components/core/common/LoadDynamicJsxComponent.d.ts.map +1 -1
- package/dist/components/core/common/LoadDynamicJsxComponent.js +42 -62
- package/dist/components/core/common/LoadDynamicJsxComponent.js.map +1 -1
- package/dist/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.d.ts.map +1 -1
- package/dist/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.js +24 -4
- package/dist/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.js.map +1 -1
- package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.d.ts +2 -1
- package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.d.ts.map +1 -1
- package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.js +10 -8
- package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.js.map +1 -1
- package/dist/components/core/filter/fields/SolidIntField.js +2 -2
- package/dist/components/core/filter/fields/SolidIntField.js.map +1 -1
- package/dist/components/core/model/CreateModel.d.ts.map +1 -1
- package/dist/components/core/model/CreateModel.js +1 -1
- package/dist/components/core/model/CreateModel.js.map +1 -1
- package/dist/components/core/model/FieldMetaData.d.ts +1 -1
- package/dist/components/core/model/FieldMetaData.d.ts.map +1 -1
- package/dist/components/core/model/FieldMetaData.js +5 -4
- package/dist/components/core/model/FieldMetaData.js.map +1 -1
- package/dist/components/core/model/FieldMetaDataForm.d.ts +1 -1
- package/dist/components/core/model/FieldMetaDataForm.d.ts.map +1 -1
- package/dist/components/core/model/FieldMetaDataForm.js +18 -15
- package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/redux/api/authApi.d.ts +5 -1
- package/dist/redux/api/authApi.d.ts.map +1 -1
- package/dist/redux/api/authApi.js +37 -1
- package/dist/redux/api/authApi.js.map +1 -1
- package/dist/redux/api/testApi.d.ts +5 -0
- package/dist/redux/api/testApi.d.ts.map +1 -0
- package/dist/redux/api/testApi.js +19 -0
- package/dist/redux/api/testApi.js.map +1 -0
- package/package.json +1 -1
- package/src/components/auth/SolidForgotPassword.tsx +0 -2
- package/src/components/auth/SolidInitialLoginOtp.tsx +134 -0
- package/src/components/auth/SolidInitiateRegisterOtp.tsx +134 -0
- package/src/components/auth/SolidLogin.tsx +72 -17
- package/src/components/auth/SolidOTPVerify.tsx +9 -6
- package/src/components/auth/SolidRegister.tsx +205 -154
- package/src/components/auth/SolidResetPassword.tsx +9 -7
- package/src/components/common/SocialMediaLogin.tsx +6 -1
- package/src/components/core/common/LoadDynamicJsxComponent.tsx +49 -25
- package/src/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.tsx +14 -2
- package/src/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.tsx +5 -4
- package/src/components/core/filter/fields/SolidIntField.tsx +2 -2
- package/src/components/core/model/CreateModel.tsx +1 -0
- package/src/components/core/model/FieldMetaData.tsx +22 -3
- package/src/components/core/model/FieldMetaDataForm.tsx +18 -15
- package/src/index.ts +8 -2
- package/src/redux/api/authApi.ts +48 -8
- package/src/redux/api/testApi.ts +21 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authApi.js","sourceRoot":"","sources":["../../../src/redux/api/authApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,CAAC,IAAM,OAAO,GAAG,SAAS,CAAC;IAC/B,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,UAAC,OAAO,IAAK,OAAA,CAAC;QACvB,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC;YACzB,KAAK,YAAC,IAAI;gBACR,OAAO;oBACL,GAAG,EAAE,eAAe;oBACpB,MAAM,EAAE,MAAM;oBACd,IAAI,MAAA;iBACL,CAAC;YACJ,CAAC;SACF,CAAC;QACF,eAAe,EAAE,OAAO,CAAC,QAAQ,CAAC;YAChC,KAAK,YAAC,I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YACH,CAAC;SACF,CAAC;QACF,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC;YAC/B,KAAK,YAAC,IAAI;gBACR,OAAO;oBACL,GAAG,EAAE,sBAAsB;oBAC3B,MAAM,EAAE,MAAM;oBACd,IAAI,MAAA;iBACL,CAAC;YACJ,CAAC;SACF,CAAC;KACH,CAAC,EA3GsB,CA2GtB;CACH,CAAC,CAAC;AAEH,MAAM,CACJ,IAAA,mBAAmB,GAYjB,OAAO,oBAZU,EACnB,0BAA0B,GAWxB,OAAO,2BAXiB,EAC1B,qBAAqB,GAUnB,OAAO,sBAVY,EACrB,yBAAyB,GASvB,OAAO,0BATgB,EACzB,wBAAwB,GAQtB,OAAO,yBARe,EACxB,iCAAiC,GAO/B,OAAO,kCAPwB,EACjC,gCAAgC,GAM9B,OAAO,iCANuB,EAChC,yBAAyB,GAKvB,OAAO,0BALgB,EACzB,uBAAuB,GAIrB,OAAO,wBAJc,EACvB,0BAA0B,GAGxB,OAAO,2BAHiB,EAC1B,0BAA0B,GAExB,OAAO,2BAFiB,EAC1B,6BAA6B,GAC3B,OAAO,8BADoB,CACnB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const testApi: import("@reduxjs/toolkit/query/react").Api<import("@reduxjs/toolkit/query/react").BaseQueryFn<string | import("@reduxjs/toolkit/query/react").FetchArgs, unknown, import("@reduxjs/toolkit/query/react").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query/react").FetchBaseQueryMeta>, {
|
|
2
|
+
seeder: import("@reduxjs/toolkit/query/react").MutationDefinition<any, import("@reduxjs/toolkit/query/react").BaseQueryFn<string | import("@reduxjs/toolkit/query/react").FetchArgs, unknown, import("@reduxjs/toolkit/query/react").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query/react").FetchBaseQueryMeta>, never, any, "testApi">;
|
|
3
|
+
}, "testApi", never, typeof import("@reduxjs/toolkit/query/react").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
|
4
|
+
export declare const useSeederMutation: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseMutation<import("@reduxjs/toolkit/query/react").MutationDefinition<any, import("@reduxjs/toolkit/query/react").BaseQueryFn<string | import("@reduxjs/toolkit/query/react").FetchArgs, unknown, import("@reduxjs/toolkit/query/react").FetchBaseQueryError, {}, import("@reduxjs/toolkit/query/react").FetchBaseQueryMeta>, never, any, "testApi">>;
|
|
5
|
+
//# sourceMappingURL=testApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testApi.d.ts","sourceRoot":"","sources":["../../../src/redux/api/testApi.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO;;uJAelB,CAAC;AAEH,eAAO,MAAO,iBAAiB,8YAAW,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createApi } from '@reduxjs/toolkit/query/react';
|
|
2
|
+
import { baseQueryWithAuth } from './fetchBaseQuery';
|
|
3
|
+
export var testApi = createApi({
|
|
4
|
+
reducerPath: 'testApi',
|
|
5
|
+
baseQuery: baseQueryWithAuth,
|
|
6
|
+
endpoints: function (builder) { return ({
|
|
7
|
+
seeder: builder.mutation({
|
|
8
|
+
query: function (name) { return ({
|
|
9
|
+
url: '/test/seed',
|
|
10
|
+
method: 'POST',
|
|
11
|
+
body: {
|
|
12
|
+
"seeder": name
|
|
13
|
+
}
|
|
14
|
+
}); },
|
|
15
|
+
}),
|
|
16
|
+
}); }
|
|
17
|
+
});
|
|
18
|
+
export var useSeederMutation = testApi.useSeederMutation;
|
|
19
|
+
//# sourceMappingURL=testApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testApi.js","sourceRoot":"","sources":["../../../src/redux/api/testApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,CAAC,IAAM,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,UAAC,OAAO,IAAK,OAAA,CAAC;QACrB,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC;YACrB,KAAK,EAAE,UAAC,IAAI,IAAK,OAAA,CAAC;gBACd,GAAG,EAAE,YAAY;gBACjB,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACF,QAAQ,EAAE,IAAI;iBACjB;aACJ,CAAC,EANe,CAMf;SACL,CAAC;KACL,CAAC,EAVsB,CAUtB;CAEL,CAAC,CAAC;AAEH,MAAM,CAAQ,IAAA,iBAAiB,GAAI,OAAO,kBAAX,CAAW"}
|
package/package.json
CHANGED
|
@@ -19,8 +19,6 @@ const SolidForgotPassword = () => {
|
|
|
19
19
|
useEffect(() => {
|
|
20
20
|
trigger("") // Fetch settings on mount
|
|
21
21
|
}, [trigger])
|
|
22
|
-
const { layoutConfig } = useContext(LayoutContext);
|
|
23
|
-
const { authLayout } = layoutConfig;
|
|
24
22
|
const toast = useRef<Toast>(null);
|
|
25
23
|
const router = useRouter();
|
|
26
24
|
const showToast = (severity: "success" | "error", summary: string, detail: string) => {
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useConfirmOtpLoginMutation } from "@/redux/api/authApi";
|
|
4
|
+
import { useLazyGetAuthSettingsQuery } from "@/redux/api/solidSettingsApi";
|
|
5
|
+
import { Form, Formik } from "formik";
|
|
6
|
+
import Link from "next/link";
|
|
7
|
+
import { useRouter } from "next/navigation";
|
|
8
|
+
import { Button } from "primereact/button";
|
|
9
|
+
import { InputOtp } from "primereact/inputotp";
|
|
10
|
+
import { Message } from "primereact/message";
|
|
11
|
+
import { Toast } from "primereact/toast";
|
|
12
|
+
import { useEffect, useRef } from "react";
|
|
13
|
+
import * as Yup from "yup";
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const SolidInitialLoginOtp = ({ email }: { email: string }) => {
|
|
17
|
+
const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
trigger("")
|
|
20
|
+
}, [trigger])
|
|
21
|
+
const [initiateOtpLogin] = useConfirmOtpLoginMutation();
|
|
22
|
+
|
|
23
|
+
const toast = useRef<Toast>(null);
|
|
24
|
+
const router = useRouter();
|
|
25
|
+
|
|
26
|
+
const validationSchema = Yup.object({
|
|
27
|
+
otp: Yup.string()
|
|
28
|
+
.matches(/^\d{6}$/, "OTP must be a 6-digit number")
|
|
29
|
+
.required("OTP is required"),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const showToast = (severity: "success" | "error", summary: string, detail: string) => {
|
|
33
|
+
toast.current?.show({
|
|
34
|
+
severity,
|
|
35
|
+
summary,
|
|
36
|
+
detail,
|
|
37
|
+
life: 3000,
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const isFormFieldValid = (formik: any, fieldName: string) =>
|
|
42
|
+
formik.touched[fieldName] && formik.errors[fieldName];
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<Toast ref={toast} />
|
|
47
|
+
<div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'center' : 'side'}`} style={{ minWidth: 480 }}>
|
|
48
|
+
{solidSettingsData?.data?.authPagesLayout === 'center' &&
|
|
49
|
+
<div className="flex justify-content-center">
|
|
50
|
+
<div className="solid-logo flex align-items-center gap-3">
|
|
51
|
+
<img
|
|
52
|
+
alt="solid logo"
|
|
53
|
+
src={'/images/SS-Logo-1 1.png'}
|
|
54
|
+
className="position-relative img-fluid"
|
|
55
|
+
/>
|
|
56
|
+
<div>
|
|
57
|
+
<p className="solid-logo-title">
|
|
58
|
+
Solid<br />Starters
|
|
59
|
+
</p>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
}
|
|
64
|
+
<h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>OTP Verification</h2>
|
|
65
|
+
<p className="solid-auth-subtitle text-sm">
|
|
66
|
+
Please enter the OTP sent to your email to complete verification
|
|
67
|
+
</p>
|
|
68
|
+
<>
|
|
69
|
+
<Formik
|
|
70
|
+
initialValues={{
|
|
71
|
+
otp: "",
|
|
72
|
+
}}
|
|
73
|
+
validationSchema={validationSchema}
|
|
74
|
+
onSubmit={async (values, { setSubmitting }) => {
|
|
75
|
+
try {
|
|
76
|
+
const payload = {
|
|
77
|
+
type: "email",
|
|
78
|
+
identifier: email,
|
|
79
|
+
otp: values.otp
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const response = await initiateOtpLogin(payload).unwrap(); // Call mutation trigger
|
|
83
|
+
|
|
84
|
+
if (response?.statusCode === 200) {
|
|
85
|
+
showToast("success", "Login Successfully", "Login");
|
|
86
|
+
router.push(`/admin/core/solid-core/user/list`);
|
|
87
|
+
} else {
|
|
88
|
+
showToast("error", "Login Error", response.error);
|
|
89
|
+
}
|
|
90
|
+
} catch (err: any) {
|
|
91
|
+
showToast("error", "Login Error", err?.data ? err?.data?.message : "Something Went Wrong");
|
|
92
|
+
} finally {
|
|
93
|
+
setSubmitting(false);
|
|
94
|
+
}
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
{(formik) => (
|
|
98
|
+
<Form>
|
|
99
|
+
<div className="flex flex-column gap-2 px-3">
|
|
100
|
+
<label htmlFor="otp" className="solid-auth-input-label">Enter OTP</label>
|
|
101
|
+
<InputOtp
|
|
102
|
+
value={formik.values.otp}
|
|
103
|
+
onChange={(e) => formik.setFieldValue("otp", e.value)}
|
|
104
|
+
length={6}
|
|
105
|
+
style={{ width: '100%' }}
|
|
106
|
+
/>
|
|
107
|
+
{isFormFieldValid(formik, "otp") && (
|
|
108
|
+
<Message className="text-red-500 text-sm" severity="error" text={formik.errors.otp?.toString()} />
|
|
109
|
+
)}
|
|
110
|
+
<div className="flex align-items-center justify-content-between">
|
|
111
|
+
<Button type="button" icon='pi pi-refresh' iconPos="left" link label="Resend Code" className="px-0 text-sm font-normal" />
|
|
112
|
+
<p className="m-0 text-sm text-color">
|
|
113
|
+
Time left: 00:28
|
|
114
|
+
</p>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
<div className="mt-4">
|
|
118
|
+
<Button type="submit" className="w-full font-light auth-submit-button" label="Verify" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
|
|
119
|
+
</div>
|
|
120
|
+
</Form>
|
|
121
|
+
)}
|
|
122
|
+
</Formik>
|
|
123
|
+
</>
|
|
124
|
+
</div>
|
|
125
|
+
<div className="text-center mt-5">
|
|
126
|
+
<div className="text-sm text-400 secondary-dark-color">
|
|
127
|
+
{'<'} Back to <Link className="font-bold" href="/auth/login">Sign In</Link>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export default SolidInitialLoginOtp;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useConfirmOtpRegisterMutation } from "@/redux/api/authApi";
|
|
4
|
+
import { useLazyGetAuthSettingsQuery } from "@/redux/api/solidSettingsApi";
|
|
5
|
+
import { Form, Formik } from "formik";
|
|
6
|
+
import Link from "next/link";
|
|
7
|
+
import { useRouter } from "next/navigation";
|
|
8
|
+
import { Button } from "primereact/button";
|
|
9
|
+
import { InputOtp } from "primereact/inputotp";
|
|
10
|
+
import { Message } from "primereact/message";
|
|
11
|
+
import { Toast } from "primereact/toast";
|
|
12
|
+
import { useEffect, useRef } from "react";
|
|
13
|
+
import * as Yup from "yup";
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const SolidInitiateRegisterOtp = ({ email }: { email: string }) => {
|
|
17
|
+
const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
trigger("")
|
|
20
|
+
}, [trigger])
|
|
21
|
+
const [initiateOtpRegister] = useConfirmOtpRegisterMutation();
|
|
22
|
+
|
|
23
|
+
const toast = useRef<Toast>(null);
|
|
24
|
+
const router = useRouter();
|
|
25
|
+
|
|
26
|
+
const validationSchema = Yup.object({
|
|
27
|
+
otp: Yup.string()
|
|
28
|
+
.matches(/^\d{6}$/, "OTP must be a 6-digit number")
|
|
29
|
+
.required("OTP is required"),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const showToast = (severity: "success" | "error", summary: string, detail: string) => {
|
|
33
|
+
toast.current?.show({
|
|
34
|
+
severity,
|
|
35
|
+
summary,
|
|
36
|
+
detail,
|
|
37
|
+
life: 3000,
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const isFormFieldValid = (formik: any, fieldName: string) =>
|
|
42
|
+
formik.touched[fieldName] && formik.errors[fieldName];
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<Toast ref={toast} />
|
|
47
|
+
<div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'center' : 'side'}`} style={{ minWidth: 480 }}>
|
|
48
|
+
{solidSettingsData?.data?.authPagesLayout === 'center' &&
|
|
49
|
+
<div className="flex justify-content-center">
|
|
50
|
+
<div className="solid-logo flex align-items-center gap-3">
|
|
51
|
+
<img
|
|
52
|
+
alt="solid logo"
|
|
53
|
+
src={'/images/SS-Logo-1 1.png'}
|
|
54
|
+
className="position-relative img-fluid"
|
|
55
|
+
/>
|
|
56
|
+
<div>
|
|
57
|
+
<p className="solid-logo-title">
|
|
58
|
+
Solid<br />Starters
|
|
59
|
+
</p>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
}
|
|
64
|
+
<h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>OTP Verification</h2>
|
|
65
|
+
<p className="solid-auth-subtitle text-sm">
|
|
66
|
+
Please enter the OTP sent to your email to complete verification
|
|
67
|
+
</p>
|
|
68
|
+
<>
|
|
69
|
+
<Formik
|
|
70
|
+
initialValues={{
|
|
71
|
+
otp: "",
|
|
72
|
+
}}
|
|
73
|
+
validationSchema={validationSchema}
|
|
74
|
+
onSubmit={async (values, { setSubmitting }) => {
|
|
75
|
+
try {
|
|
76
|
+
const payload = {
|
|
77
|
+
type: "email",
|
|
78
|
+
identifier: email,
|
|
79
|
+
otp: values.otp
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const response = await initiateOtpRegister(payload).unwrap(); // Call mutation trigger
|
|
83
|
+
|
|
84
|
+
if (response?.statusCode === 200) {
|
|
85
|
+
showToast("success", "Login Successfully", "Login");
|
|
86
|
+
router.push(`/auth/login`);
|
|
87
|
+
} else {
|
|
88
|
+
showToast("error", "Login Error", response.error);
|
|
89
|
+
}
|
|
90
|
+
} catch (err: any) {
|
|
91
|
+
showToast("error", "Login Error", err?.data ? err?.data?.message : "Something Went Wrong");
|
|
92
|
+
} finally {
|
|
93
|
+
setSubmitting(false);
|
|
94
|
+
}
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
{(formik) => (
|
|
98
|
+
<Form>
|
|
99
|
+
<div className="flex flex-column gap-2 px-3">
|
|
100
|
+
<label htmlFor="otp" className="solid-auth-input-label">Enter OTP</label>
|
|
101
|
+
<InputOtp
|
|
102
|
+
value={formik.values.otp}
|
|
103
|
+
onChange={(e) => formik.setFieldValue("otp", e.value)}
|
|
104
|
+
length={6}
|
|
105
|
+
style={{ width: '100%' }}
|
|
106
|
+
/>
|
|
107
|
+
{isFormFieldValid(formik, "otp") && (
|
|
108
|
+
<Message className="text-red-500 text-sm" severity="error" text={formik.errors.otp?.toString()} />
|
|
109
|
+
)}
|
|
110
|
+
<div className="flex align-items-center justify-content-between">
|
|
111
|
+
<Button type="button" icon='pi pi-refresh' iconPos="left" link label="Resend Code" className="px-0 text-sm font-normal" />
|
|
112
|
+
<p className="m-0 text-sm text-color">
|
|
113
|
+
Time left: 00:28
|
|
114
|
+
</p>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
<div className="mt-4">
|
|
118
|
+
<Button type="submit" className="w-full font-light auth-submit-button" label="Verify" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
|
|
119
|
+
</div>
|
|
120
|
+
</Form>
|
|
121
|
+
)}
|
|
122
|
+
</Formik>
|
|
123
|
+
</>
|
|
124
|
+
</div>
|
|
125
|
+
<div className="text-center mt-5">
|
|
126
|
+
<div className="text-sm text-400 secondary-dark-color">
|
|
127
|
+
{'<'} Back to <Link className="font-bold" href="/auth/login">Sign In</Link>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
</>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export default SolidInitiateRegisterOtp;
|
|
@@ -17,27 +17,20 @@ import * as Yup from "yup";
|
|
|
17
17
|
import { SocialMediaLogin } from "../common/SocialMediaLogin";
|
|
18
18
|
import { LayoutContext } from "../layout/context/layoutcontext";
|
|
19
19
|
import { useLazyGetAuthSettingsQuery } from "@/redux/api/solidSettingsApi";
|
|
20
|
-
|
|
20
|
+
import { useInitateLoginMutation } from "@/redux/api/authApi";
|
|
21
21
|
|
|
22
22
|
const SolidLogin = () => {
|
|
23
|
-
const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery()
|
|
23
|
+
const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
|
|
24
|
+
const [initiateLogin] = useInitateLoginMutation();
|
|
25
|
+
|
|
24
26
|
useEffect(() => {
|
|
25
27
|
trigger("") // Fetch settings on mount
|
|
26
28
|
}, [trigger])
|
|
27
|
-
const { layoutConfig } = useContext(LayoutContext);
|
|
28
|
-
const { authLayout } = layoutConfig;
|
|
29
29
|
const toast = useRef<Toast>(null);
|
|
30
30
|
const router = useRouter();
|
|
31
31
|
|
|
32
32
|
const [password, setPassword] = useState('');
|
|
33
33
|
|
|
34
|
-
const validationSchema = Yup.object({
|
|
35
|
-
email: Yup.string()
|
|
36
|
-
.email("Invalid email address")
|
|
37
|
-
.required("Email is required"),
|
|
38
|
-
password: Yup.string().required("Password is required"),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
34
|
const showToast = (severity: "success" | "error", summary: string, detail: string) => {
|
|
42
35
|
toast.current?.show({
|
|
43
36
|
severity,
|
|
@@ -73,14 +66,19 @@ const SolidLogin = () => {
|
|
|
73
66
|
<h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>Sign In To Your Account</h2>
|
|
74
67
|
{/* <p className="solid-auth-subtitle text-sm">By continuing, you agree to the <Link href={'#'}>Terms of Service</Link> and acknowledge you’ve read our <Link href={'#'}>Privacy Policy.</Link> </p> */}
|
|
75
68
|
|
|
76
|
-
<TabView>
|
|
77
|
-
<TabPanel header="
|
|
69
|
+
<TabView className="solid-auth-tabview">
|
|
70
|
+
<TabPanel header="With Password">
|
|
78
71
|
<Formik
|
|
79
72
|
initialValues={{
|
|
80
73
|
email: "",
|
|
81
74
|
password: "",
|
|
82
75
|
}}
|
|
83
|
-
validationSchema={
|
|
76
|
+
validationSchema={Yup.object({
|
|
77
|
+
email: Yup.string()
|
|
78
|
+
.email("Invalid email address")
|
|
79
|
+
.required("Email is required"),
|
|
80
|
+
password: Yup.string().required("Password is required"),
|
|
81
|
+
})}
|
|
84
82
|
onSubmit={async (values, { setSubmitting }) => {
|
|
85
83
|
try {
|
|
86
84
|
const response = await signIn("credentials", {
|
|
@@ -95,8 +93,8 @@ const SolidLogin = () => {
|
|
|
95
93
|
showToast("success", "Login Success", "Redirecting to dashboard...");
|
|
96
94
|
router.push("/admin/core/solid-core/user/list");
|
|
97
95
|
}
|
|
98
|
-
} catch (error) {
|
|
99
|
-
showToast("error", "Login
|
|
96
|
+
} catch (error: any) {
|
|
97
|
+
showToast("error", "Login Error", error?.data ? error?.data?.message : "Something Went Wrong");
|
|
100
98
|
} finally {
|
|
101
99
|
setSubmitting(false); // Re-enable the button after submission
|
|
102
100
|
}
|
|
@@ -156,7 +154,64 @@ const SolidLogin = () => {
|
|
|
156
154
|
)}
|
|
157
155
|
</Formik>
|
|
158
156
|
</TabPanel>
|
|
159
|
-
<TabPanel header="
|
|
157
|
+
<TabPanel header="Without Password">
|
|
158
|
+
<Formik
|
|
159
|
+
initialValues={{
|
|
160
|
+
email: "",
|
|
161
|
+
}}
|
|
162
|
+
validationSchema={Yup.object({
|
|
163
|
+
email: Yup.string()
|
|
164
|
+
.email("Invalid email address")
|
|
165
|
+
})}
|
|
166
|
+
onSubmit={async (values, { setSubmitting }) => {
|
|
167
|
+
try {
|
|
168
|
+
const payload = {
|
|
169
|
+
type: "email",
|
|
170
|
+
identifier: values.email,
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const response = await initiateLogin(payload).unwrap(); // Call mutation trigger
|
|
174
|
+
|
|
175
|
+
if (response?.statusCode === 200) {
|
|
176
|
+
showToast("success", "OTP sent Successfully", response?.data?.message);
|
|
177
|
+
const email = values.email;
|
|
178
|
+
router.push(`/auth/initiate-login?email=${email}`);
|
|
179
|
+
} else {
|
|
180
|
+
showToast("error", "Login Error", response.error);
|
|
181
|
+
}
|
|
182
|
+
} catch (err: any) {
|
|
183
|
+
showToast("error", "Login Error", err?.data ? err?.data?.message : "Something Went Wrong");
|
|
184
|
+
} finally {
|
|
185
|
+
setSubmitting(false);
|
|
186
|
+
}
|
|
187
|
+
}}
|
|
188
|
+
>
|
|
189
|
+
{(formik) => (
|
|
190
|
+
<Form>
|
|
191
|
+
<div className="flex flex-column gap-2">
|
|
192
|
+
<label htmlFor="email" className="solid-auth-input-label">Email</label>
|
|
193
|
+
<InputText
|
|
194
|
+
id="email"
|
|
195
|
+
name="email"
|
|
196
|
+
placeholder="Email ID"
|
|
197
|
+
onChange={formik.handleChange}
|
|
198
|
+
value={formik.values.email}
|
|
199
|
+
/>
|
|
200
|
+
{isFormFieldValid(formik, "email") && <Message
|
|
201
|
+
className="text-red-500 text-sm"
|
|
202
|
+
severity="error"
|
|
203
|
+
text={formik?.errors?.email?.toString()}
|
|
204
|
+
/>}
|
|
205
|
+
</div>
|
|
206
|
+
<div className="mt-4 text-right">
|
|
207
|
+
<Link href={"/auth/initiate-forgot-password"} className="solid-auth-input-label">Forgot Password?</Link>
|
|
208
|
+
</div>
|
|
209
|
+
<div className="mt-4">
|
|
210
|
+
<Button className="w-full font-light auth-submit-button" label="Sign In" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
|
|
211
|
+
</div>
|
|
212
|
+
</Form>
|
|
213
|
+
)}
|
|
214
|
+
</Formik>
|
|
160
215
|
</TabPanel>
|
|
161
216
|
</TabView>
|
|
162
217
|
{solidSettingsData?.data?.iamGoogleOAuthEnabled &&
|
|
@@ -8,14 +8,17 @@ import { Button } from "primereact/button";
|
|
|
8
8
|
import { InputOtp } from "primereact/inputotp";
|
|
9
9
|
import { Message } from "primereact/message";
|
|
10
10
|
import { Toast } from "primereact/toast";
|
|
11
|
-
import { useContext, useRef, useState } from "react";
|
|
11
|
+
import { useContext, useEffect, useRef, useState } from "react";
|
|
12
12
|
import * as Yup from "yup";
|
|
13
13
|
import { LayoutContext } from "../layout/context/layoutcontext";
|
|
14
|
+
import { useLazyGetAuthSettingsQuery } from "@/redux/api/solidSettingsApi";
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
const SolidOTPVerify = () => {
|
|
17
|
-
const {
|
|
18
|
-
|
|
18
|
+
const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
trigger("")
|
|
21
|
+
}, [trigger])
|
|
19
22
|
const [otp, setOTP] = useState<number | any>();
|
|
20
23
|
|
|
21
24
|
const toast = useRef<Toast>(null);
|
|
@@ -45,8 +48,8 @@ const SolidOTPVerify = () => {
|
|
|
45
48
|
return (
|
|
46
49
|
<>
|
|
47
50
|
<Toast ref={toast} />
|
|
48
|
-
<div className={`auth-container ${
|
|
49
|
-
{
|
|
51
|
+
<div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'center' : 'side'}`} style={{ minWidth: 480 }}>
|
|
52
|
+
{solidSettingsData?.data?.authPagesLayout === 'center' &&
|
|
50
53
|
<div className="flex justify-content-center">
|
|
51
54
|
<div className="solid-logo flex align-items-center gap-3">
|
|
52
55
|
<img
|
|
@@ -62,7 +65,7 @@ const SolidOTPVerify = () => {
|
|
|
62
65
|
</div>
|
|
63
66
|
</div>
|
|
64
67
|
}
|
|
65
|
-
<h2 className={`solid-auth-title ${
|
|
68
|
+
<h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>OTP Verification</h2>
|
|
66
69
|
<p className="solid-auth-subtitle text-sm">
|
|
67
70
|
Please enter the OTP sent to your email to complete verification
|
|
68
71
|
</p>
|