@solidstarters/solid-core-ui 1.1.15 → 1.1.17
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/AuthLayout.d.ts +4 -0
- package/dist/components/auth/AuthLayout.d.ts.map +1 -0
- package/dist/components/auth/AuthLayout.js +80 -0
- package/dist/components/auth/AuthLayout.js.map +1 -0
- package/dist/components/auth/ForgotPasswordThankYou.d.ts +2 -0
- package/dist/components/auth/ForgotPasswordThankYou.d.ts.map +1 -0
- package/dist/components/auth/ForgotPasswordThankYou.js +16 -0
- package/dist/components/auth/ForgotPasswordThankYou.js.map +1 -0
- package/dist/components/auth/GoogleAuthChecking.d.ts +2 -0
- package/dist/components/auth/GoogleAuthChecking.d.ts.map +1 -0
- package/dist/components/auth/GoogleAuthChecking.js +99 -0
- package/dist/components/auth/GoogleAuthChecking.js.map +1 -0
- package/dist/components/auth/SolidChangeForcePassword.d.ts.map +1 -1
- package/dist/components/auth/SolidChangeForcePassword.js +44 -39
- package/dist/components/auth/SolidChangeForcePassword.js.map +1 -1
- package/dist/components/auth/SolidForgotPassword.d.ts.map +1 -1
- package/dist/components/auth/SolidForgotPassword.js +1 -2
- package/dist/components/auth/SolidForgotPassword.js.map +1 -1
- package/dist/components/auth/SolidInitialLoginOtp.d.ts +1 -3
- package/dist/components/auth/SolidInitialLoginOtp.d.ts.map +1 -1
- package/dist/components/auth/SolidInitialLoginOtp.js +16 -12
- package/dist/components/auth/SolidInitialLoginOtp.js.map +1 -1
- package/dist/components/auth/SolidInitiateRegisterOtp.d.ts +1 -3
- package/dist/components/auth/SolidInitiateRegisterOtp.d.ts.map +1 -1
- package/dist/components/auth/SolidInitiateRegisterOtp.js +16 -12
- package/dist/components/auth/SolidInitiateRegisterOtp.js.map +1 -1
- package/dist/components/auth/SolidLogin.d.ts.map +1 -1
- package/dist/components/auth/SolidLogin.js +12 -8
- package/dist/components/auth/SolidLogin.js.map +1 -1
- package/dist/components/auth/SolidRegister.d.ts.map +1 -1
- package/dist/components/auth/SolidRegister.js +13 -9
- package/dist/components/auth/SolidRegister.js.map +1 -1
- package/dist/components/auth/SolidResetPassword.d.ts +1 -4
- package/dist/components/auth/SolidResetPassword.d.ts.map +1 -1
- package/dist/components/auth/SolidResetPassword.js +14 -10
- package/dist/components/auth/SolidResetPassword.js.map +1 -1
- package/dist/components/common/GeneralSettings.d.ts +1 -3
- package/dist/components/common/GeneralSettings.d.ts.map +1 -1
- package/dist/components/common/GeneralSettings.js +21 -18
- package/dist/components/common/GeneralSettings.js.map +1 -1
- package/dist/components/common/NotFound.d.ts +2 -0
- package/dist/components/common/NotFound.d.ts.map +1 -0
- package/dist/components/common/NotFound.js +7 -0
- package/dist/components/common/NotFound.js.map +1 -0
- package/dist/components/common/SingleSelectAutoCompleteField.d.ts +1 -1
- package/dist/components/common/SingleSelectAutoCompleteField.d.ts.map +1 -1
- package/dist/components/common/SingleSelectAutoCompleteField.js +2 -2
- package/dist/components/common/SingleSelectAutoCompleteField.js.map +1 -1
- package/dist/components/common/SocialMediaLogin.d.ts.map +1 -1
- package/dist/components/common/SocialMediaLogin.js +3 -2
- package/dist/components/common/SocialMediaLogin.js.map +1 -1
- package/dist/components/common/SolidAdmin.d.ts +2 -0
- package/dist/components/common/SolidAdmin.d.ts.map +1 -0
- package/dist/components/common/SolidAdmin.js +5 -0
- package/dist/components/common/SolidAdmin.js.map +1 -0
- package/dist/components/common/SolidFormStepper.d.ts.map +1 -1
- package/dist/components/common/SolidFormStepper.js +8 -1
- package/dist/components/common/SolidFormStepper.js.map +1 -1
- package/dist/components/common/SolidThemeLink.d.ts +2 -0
- package/dist/components/common/SolidThemeLink.d.ts.map +1 -0
- package/dist/components/common/SolidThemeLink.js +5 -0
- package/dist/components/common/SolidThemeLink.js.map +1 -0
- package/dist/components/common/error.d.ts +9 -0
- package/dist/components/common/error.d.ts.map +1 -0
- package/dist/components/common/error.js +7 -0
- package/dist/components/common/error.js.map +1 -0
- package/dist/components/core/common/FilterComponent.js +7 -7
- package/dist/components/core/common/FilterComponent.js.map +1 -1
- package/dist/components/core/common/SolidConfigureLayoutElement.d.ts.map +1 -1
- package/dist/components/core/common/SolidConfigureLayoutElement.js +4 -3
- package/dist/components/core/common/SolidConfigureLayoutElement.js.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.js +35 -15
- package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
- package/dist/components/core/form/SolidFormLayouts.d.ts +3 -0
- package/dist/components/core/form/SolidFormLayouts.d.ts.map +1 -0
- package/dist/components/core/form/SolidFormLayouts.js +57 -0
- package/dist/components/core/form/SolidFormLayouts.js.map +1 -0
- package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
- package/dist/components/core/form/SolidFormView.js +13 -1
- package/dist/components/core/form/SolidFormView.js.map +1 -1
- package/dist/components/core/form/fields/SolidMediaMultipleField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidMediaMultipleField.js +11 -7
- package/dist/components/core/form/fields/SolidMediaMultipleField.js.map +1 -1
- package/dist/components/core/form/fields/SolidMediaSingleField.js +3 -2
- package/dist/components/core/form/fields/SolidMediaSingleField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +4 -4
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
- package/dist/components/core/kanban/SolidKanbanView.js +2 -2
- package/dist/components/core/kanban/SolidKanbanView.js.map +1 -1
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +6 -28
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/model/CreateModel.d.ts.map +1 -1
- package/dist/components/core/model/CreateModel.js +66 -18
- package/dist/components/core/model/CreateModel.js.map +1 -1
- package/dist/components/core/model/FieldMetaData.d.ts.map +1 -1
- package/dist/components/core/model/FieldMetaData.js +2 -2
- package/dist/components/core/model/FieldMetaData.js.map +1 -1
- package/dist/components/core/model/FieldMetaDataForm.js +21 -21
- package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
- package/dist/components/core/model/ModelMetaData.js +15 -15
- package/dist/components/core/model/ModelMetaData.js.map +1 -1
- package/dist/components/core/module/CreateModule.d.ts.map +1 -1
- package/dist/components/core/module/CreateModule.js +5 -2
- package/dist/components/core/module/CreateModule.js.map +1 -1
- package/dist/components/core/users/CreateUser.js +2 -2
- package/dist/components/layout/AdminLayout.d.ts +4 -0
- package/dist/components/layout/AdminLayout.d.ts.map +1 -0
- package/dist/components/layout/AdminLayout.js +86 -0
- package/dist/components/layout/AdminLayout.js.map +1 -0
- package/dist/components/layout/AppConfig.d.ts.map +1 -1
- package/dist/components/layout/AppConfig.js +4 -9
- package/dist/components/layout/AppConfig.js.map +1 -1
- package/dist/components/layout/user-profile-menu.js +1 -1
- package/dist/components/layout/user-profile-menu.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/nextAuth/authProviders.d.ts +4 -0
- package/dist/nextAuth/authProviders.d.ts.map +1 -0
- package/dist/nextAuth/authProviders.js +231 -0
- package/dist/nextAuth/authProviders.js.map +1 -0
- package/dist/nextAuth/refreshAccessToken.d.ts +2 -0
- package/dist/nextAuth/refreshAccessToken.d.ts.map +1 -0
- package/dist/nextAuth/refreshAccessToken.js +76 -0
- package/dist/nextAuth/refreshAccessToken.js.map +1 -0
- package/package.json +1 -1
- package/src/components/auth/AuthLayout.tsx +126 -0
- package/src/components/auth/ForgotPasswordThankYou.tsx +45 -0
- package/src/components/auth/GoogleAuthChecking.tsx +60 -0
- package/src/components/auth/SolidChangeForcePassword.tsx +21 -32
- package/src/components/auth/SolidForgotPassword.tsx +3 -2
- package/src/components/auth/SolidInitialLoginOtp.tsx +16 -8
- package/src/components/auth/SolidInitiateRegisterOtp.tsx +17 -9
- package/src/components/auth/SolidLogin.tsx +16 -10
- package/src/components/auth/SolidRegister.tsx +17 -9
- package/src/components/auth/SolidResetPassword.tsx +13 -6
- package/src/components/common/GeneralSettings.tsx +7 -2
- package/src/components/common/NotFound.tsx +22 -0
- package/src/components/common/SingleSelectAutoCompleteField.tsx +2 -2
- package/src/components/common/SocialMediaLogin.tsx +24 -25
- package/src/components/common/SolidAdmin.tsx +7 -0
- package/src/components/common/SolidFormStepper.tsx +55 -2
- package/src/components/common/SolidThemeLink.tsx +5 -0
- package/src/components/common/error.tsx +30 -0
- package/src/components/core/common/FilterComponent.tsx +70 -70
- package/src/components/core/common/SolidConfigureLayoutElement.tsx +6 -1
- package/src/components/core/common/SolidGlobalSearchElement.tsx +45 -17
- package/src/components/core/form/SolidFormLayouts.tsx +93 -0
- package/src/components/core/form/SolidFormView.tsx +64 -3
- package/src/components/core/form/fields/SolidMediaMultipleField.tsx +14 -9
- package/src/components/core/form/fields/SolidMediaSingleField.tsx +3 -3
- package/src/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +25 -23
- package/src/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +1 -1
- package/src/components/core/kanban/SolidKanbanView.tsx +4 -4
- package/src/components/core/list/SolidListView.tsx +4 -61
- package/src/components/core/model/CreateModel.tsx +119 -18
- package/src/components/core/model/FieldMetaData.tsx +2 -0
- package/src/components/core/model/FieldMetaDataForm.tsx +26 -26
- package/src/components/core/model/ModelMetaData.tsx +21 -21
- package/src/components/core/module/CreateModule.tsx +11 -3
- package/src/components/core/users/CreateUser.tsx +2 -2
- package/src/components/layout/AdminLayout.tsx +62 -0
- package/src/components/layout/AppConfig.tsx +4 -3
- package/src/components/layout/user-profile-menu.tsx +1 -1
- package/src/index.ts +17 -1
- package/src/nextAuth/authProviders.tsx +220 -0
- package/src/nextAuth/refreshAccessToken.tsx +27 -0
|
@@ -39,24 +39,34 @@ const SolidChangeForcePassword = () => {
|
|
|
39
39
|
id: session?.data?.user?.user?.id,
|
|
40
40
|
},
|
|
41
41
|
validationSchema,
|
|
42
|
-
onSubmit: async (values) => {
|
|
42
|
+
onSubmit: async (values, { setErrors }) => {
|
|
43
43
|
try {
|
|
44
44
|
const payload = {
|
|
45
45
|
id: values.id,
|
|
46
|
-
email:
|
|
46
|
+
email: session?.data?.user?.user?.email,
|
|
47
47
|
currentPassword: values.currentPassword,
|
|
48
48
|
newPassword: values.newPassword,
|
|
49
49
|
};
|
|
50
|
+
console.log("Payload:", payload);
|
|
51
|
+
|
|
50
52
|
// Call the mutation and handle the response
|
|
51
53
|
const response = await changePassword(payload).unwrap(); // Await the API call and unwrap to handle errors.
|
|
52
|
-
if (response?.
|
|
54
|
+
if (response?.error) {
|
|
55
|
+
showToast("error", "Error", response.error)
|
|
56
|
+
setErrors({
|
|
57
|
+
currentPassword: "Incorrect Current Password",
|
|
58
|
+
newPassword: "Passwords must match",
|
|
59
|
+
confirmPassword: "Passwords must match",
|
|
60
|
+
})
|
|
61
|
+
} else {
|
|
53
62
|
showToast("success", "Force Password Change Success", "Password Change Successfully");
|
|
54
63
|
signOut({ callbackUrl: "/auth/login" })
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
)
|
|
58
|
-
} catch (err:any) {
|
|
64
|
+
}
|
|
65
|
+
} catch (err: any) {
|
|
59
66
|
showToast("error", "Login Failed", err?.data?.message);
|
|
67
|
+
setErrors({
|
|
68
|
+
currentPassword: "Incorrect Current Password",
|
|
69
|
+
})
|
|
60
70
|
}
|
|
61
71
|
},
|
|
62
72
|
});
|
|
@@ -68,31 +78,16 @@ const SolidChangeForcePassword = () => {
|
|
|
68
78
|
<Toast ref={toast} />
|
|
69
79
|
|
|
70
80
|
<form onSubmit={formik.handleSubmit} className='d-flex flex-column gap-3 auth-form'>
|
|
71
|
-
<div className="flex flex-column gap-2 mt-2">
|
|
72
|
-
<label htmlFor="email" className="solid-auth-input-label">Email Id</label>
|
|
73
|
-
<InputText
|
|
74
|
-
id="email"
|
|
75
|
-
name="email"
|
|
76
|
-
placeholder="Email ID"
|
|
77
|
-
value={formik.values.email}
|
|
78
|
-
onChange={formik.handleChange}
|
|
79
|
-
onBlur={formik.handleBlur}
|
|
80
|
-
readOnly
|
|
81
|
-
/>
|
|
82
|
-
</div>
|
|
83
|
-
<div className="flex flex-column gap-2 mt-4" style={{}}>
|
|
81
|
+
<div className="flex flex-column gap-2 mt-2" style={{}}>
|
|
84
82
|
<label htmlFor="currentPassword" className="solid-auth-input-label">Current Password</label>
|
|
85
83
|
<Password
|
|
86
84
|
id="currentPassword"
|
|
87
85
|
name="currentPassword"
|
|
88
|
-
placeholder="***************"
|
|
89
86
|
value={formik.values.currentPassword}
|
|
90
87
|
onChange={formik.handleChange}
|
|
91
88
|
onBlur={formik.handleBlur}
|
|
92
89
|
toggleMask
|
|
93
|
-
|
|
94
|
-
"p-invalid": isFormFieldValid(formik, "password"),
|
|
95
|
-
})}
|
|
90
|
+
invalid={!!formik.errors.currentPassword}
|
|
96
91
|
inputClassName="w-full"
|
|
97
92
|
feedback={false}
|
|
98
93
|
/>
|
|
@@ -107,14 +102,11 @@ const SolidChangeForcePassword = () => {
|
|
|
107
102
|
<Password
|
|
108
103
|
id="newPassword"
|
|
109
104
|
name="newPassword"
|
|
110
|
-
placeholder="***************"
|
|
111
105
|
value={formik.values.newPassword}
|
|
112
106
|
onChange={formik.handleChange}
|
|
113
107
|
onBlur={formik.handleBlur}
|
|
114
108
|
toggleMask
|
|
115
|
-
|
|
116
|
-
"p-invalid": isFormFieldValid(formik, "newPassword"),
|
|
117
|
-
})}
|
|
109
|
+
invalid={!!formik.errors.newPassword}
|
|
118
110
|
inputClassName="w-full"
|
|
119
111
|
feedback={false}
|
|
120
112
|
/>
|
|
@@ -129,14 +121,11 @@ const SolidChangeForcePassword = () => {
|
|
|
129
121
|
<Password
|
|
130
122
|
id="confirmPassword"
|
|
131
123
|
name="confirmPassword"
|
|
132
|
-
placeholder="***************"
|
|
133
124
|
value={formik.values.confirmPassword}
|
|
134
125
|
onChange={formik.handleChange}
|
|
135
126
|
onBlur={formik.handleBlur}
|
|
136
127
|
toggleMask
|
|
137
|
-
|
|
138
|
-
"p-invalid": isFormFieldValid(formik, "confirmPassword"),
|
|
139
|
-
})}
|
|
128
|
+
invalid={!!formik.errors.confirmPassword}
|
|
140
129
|
inputClassName="w-full"
|
|
141
130
|
feedback={false}
|
|
142
131
|
/>
|
|
@@ -106,14 +106,15 @@ const SolidForgotPassword = () => {
|
|
|
106
106
|
</div>
|
|
107
107
|
<div className="mt-4">
|
|
108
108
|
<Button className="w-full font-light auth-submit-button" label="Send OTP" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
|
|
109
|
+
<Button type="button" label="Back" className="w-full auth-back-button text-center" link onClick={() => (window.location.href = '/auth/login')} />
|
|
109
110
|
</div>
|
|
110
111
|
</form>
|
|
111
112
|
</div>
|
|
112
|
-
<div className="text-center mt-5">
|
|
113
|
+
{/* <div className="text-center mt-5">
|
|
113
114
|
<div className="text-sm text-400 secondary-dark-color">
|
|
114
115
|
{'<'} Back to <Link className="font-bold" href="/auth/login">Sign In</Link>
|
|
115
116
|
</div>
|
|
116
|
-
</div>
|
|
117
|
+
</div> */}
|
|
117
118
|
</>
|
|
118
119
|
);
|
|
119
120
|
};
|
|
@@ -5,7 +5,7 @@ import { useConfirmOtpLoginMutation } from "@/redux/api/authApi";
|
|
|
5
5
|
import { useLazyGetAuthSettingsQuery } from "@/redux/api/solidSettingsApi";
|
|
6
6
|
import { Form, Formik } from "formik";
|
|
7
7
|
import Link from "next/link";
|
|
8
|
-
import { useRouter } from "next/navigation";
|
|
8
|
+
import { useRouter, useSearchParams } from "next/navigation";
|
|
9
9
|
import { Button } from "primereact/button";
|
|
10
10
|
import { InputOtp } from "primereact/inputotp";
|
|
11
11
|
import { Message } from "primereact/message";
|
|
@@ -13,7 +13,10 @@ import { Toast } from "primereact/toast";
|
|
|
13
13
|
import { useEffect, useRef } from "react";
|
|
14
14
|
import * as Yup from "yup";
|
|
15
15
|
|
|
16
|
-
const SolidInitialLoginOtp = (
|
|
16
|
+
const SolidInitialLoginOtp = () => {
|
|
17
|
+
const searchParams = useSearchParams();
|
|
18
|
+
const tempEmail = searchParams.get('email');
|
|
19
|
+
const email = tempEmail ? decodeURIComponent(tempEmail) : '';
|
|
17
20
|
const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
|
|
18
21
|
useEffect(() => {
|
|
19
22
|
trigger("")
|
|
@@ -67,7 +70,7 @@ const SolidInitialLoginOtp = ({ email }: { email: string }) => {
|
|
|
67
70
|
otp: "",
|
|
68
71
|
}}
|
|
69
72
|
validationSchema={validationSchema}
|
|
70
|
-
onSubmit={async (values, { setSubmitting }) => {
|
|
73
|
+
onSubmit={async (values, { setSubmitting, setErrors }) => {
|
|
71
74
|
try {
|
|
72
75
|
const payload = {
|
|
73
76
|
type: "email",
|
|
@@ -81,7 +84,10 @@ const SolidInitialLoginOtp = ({ email }: { email: string }) => {
|
|
|
81
84
|
showToast("success", "Login Successfully", "Login");
|
|
82
85
|
router.push(`/admin/core/solid-core/user/list`);
|
|
83
86
|
} else {
|
|
84
|
-
showToast("error", "
|
|
87
|
+
showToast("error", "Invalid OTP", response.error);
|
|
88
|
+
setErrors({
|
|
89
|
+
otp: "Invalid OTP",
|
|
90
|
+
});
|
|
85
91
|
}
|
|
86
92
|
} catch (err: any) {
|
|
87
93
|
showToast("error", "Login Error", err?.data ? err?.data?.message : "Something Went Wrong");
|
|
@@ -92,13 +98,14 @@ const SolidInitialLoginOtp = ({ email }: { email: string }) => {
|
|
|
92
98
|
>
|
|
93
99
|
{(formik) => (
|
|
94
100
|
<Form>
|
|
95
|
-
<div className="flex flex-column gap-2
|
|
101
|
+
<div className="flex flex-column gap-2">
|
|
96
102
|
<label htmlFor="otp" className="solid-auth-input-label">Enter OTP</label>
|
|
97
103
|
<InputOtp
|
|
98
104
|
value={formik.values.otp}
|
|
99
105
|
onChange={(e) => formik.setFieldValue("otp", e.value)}
|
|
100
106
|
length={6}
|
|
101
107
|
style={{ width: '100%' }}
|
|
108
|
+
invalid={!!formik.errors.otp}
|
|
102
109
|
/>
|
|
103
110
|
{isFormFieldValid(formik, "otp") && (
|
|
104
111
|
<Message className="text-red-500 text-sm" severity="error" text={formik.errors.otp?.toString()} />
|
|
@@ -112,17 +119,18 @@ const SolidInitialLoginOtp = ({ email }: { email: string }) => {
|
|
|
112
119
|
</div>
|
|
113
120
|
<div className="mt-4">
|
|
114
121
|
<Button type="submit" className="w-full font-light auth-submit-button" label="Verify" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
|
|
122
|
+
<Button type="button" label="Back" className="w-full auth-back-button text-center" link onClick={() => (window.location.href = '/auth/login')} />
|
|
115
123
|
</div>
|
|
116
124
|
</Form>
|
|
117
125
|
)}
|
|
118
126
|
</Formik>
|
|
119
127
|
</>
|
|
120
128
|
</div>
|
|
121
|
-
<div className="text-center mt-5">
|
|
129
|
+
{/* <div className="text-center mt-5">
|
|
122
130
|
<div className="text-sm text-400 secondary-dark-color">
|
|
123
|
-
{'<'} Back to <Link className="font-bold" href="/auth/login">
|
|
131
|
+
{'<'} Back to <Link className="font-bold" href="/auth/login">Back</Link>
|
|
124
132
|
</div>
|
|
125
|
-
</div>
|
|
133
|
+
</div> */}
|
|
126
134
|
</>
|
|
127
135
|
);
|
|
128
136
|
};
|
|
@@ -5,7 +5,7 @@ import { useConfirmOtpRegisterMutation } from "@/redux/api/authApi";
|
|
|
5
5
|
import { useLazyGetAuthSettingsQuery } from "@/redux/api/solidSettingsApi";
|
|
6
6
|
import { Form, Formik } from "formik";
|
|
7
7
|
import Link from "next/link";
|
|
8
|
-
import { useRouter } from "next/navigation";
|
|
8
|
+
import { useRouter, useSearchParams } from "next/navigation";
|
|
9
9
|
import { Button } from "primereact/button";
|
|
10
10
|
import { InputOtp } from "primereact/inputotp";
|
|
11
11
|
import { Message } from "primereact/message";
|
|
@@ -13,7 +13,10 @@ import { Toast } from "primereact/toast";
|
|
|
13
13
|
import { useEffect, useRef } from "react";
|
|
14
14
|
import * as Yup from "yup";
|
|
15
15
|
|
|
16
|
-
const SolidInitiateRegisterOtp = (
|
|
16
|
+
const SolidInitiateRegisterOtp = () => {
|
|
17
|
+
const searchParams = useSearchParams();
|
|
18
|
+
const tempEmail = searchParams.get('email');
|
|
19
|
+
const email = tempEmail ? decodeURIComponent(tempEmail) : '';
|
|
17
20
|
const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
|
|
18
21
|
useEffect(() => {
|
|
19
22
|
trigger("")
|
|
@@ -67,7 +70,7 @@ const SolidInitiateRegisterOtp = ({ email }: { email: string }) => {
|
|
|
67
70
|
otp: "",
|
|
68
71
|
}}
|
|
69
72
|
validationSchema={validationSchema}
|
|
70
|
-
onSubmit={async (values, { setSubmitting }) => {
|
|
73
|
+
onSubmit={async (values, { setSubmitting, setErrors }) => {
|
|
71
74
|
try {
|
|
72
75
|
const payload = {
|
|
73
76
|
type: "email",
|
|
@@ -81,7 +84,10 @@ const SolidInitiateRegisterOtp = ({ email }: { email: string }) => {
|
|
|
81
84
|
showToast("success", "Login Successfully", "Login");
|
|
82
85
|
router.push(`/auth/login`);
|
|
83
86
|
} else {
|
|
84
|
-
showToast("error", "
|
|
87
|
+
showToast("error", "Invalid OTP", response.error);
|
|
88
|
+
setErrors({
|
|
89
|
+
otp: "Invalid OTP",
|
|
90
|
+
});
|
|
85
91
|
}
|
|
86
92
|
} catch (err: any) {
|
|
87
93
|
showToast("error", "Login Error", err?.data ? err?.data?.message : "Something Went Wrong");
|
|
@@ -92,13 +98,14 @@ const SolidInitiateRegisterOtp = ({ email }: { email: string }) => {
|
|
|
92
98
|
>
|
|
93
99
|
{(formik) => (
|
|
94
100
|
<Form>
|
|
95
|
-
<div className="flex flex-column gap-2
|
|
101
|
+
<div className="flex flex-column gap-2">
|
|
96
102
|
<label htmlFor="otp" className="solid-auth-input-label">Enter OTP</label>
|
|
97
103
|
<InputOtp
|
|
98
104
|
value={formik.values.otp}
|
|
99
105
|
onChange={(e) => formik.setFieldValue("otp", e.value)}
|
|
100
106
|
length={6}
|
|
101
107
|
style={{ width: '100%' }}
|
|
108
|
+
invalid={!!formik.errors.otp}
|
|
102
109
|
/>
|
|
103
110
|
{isFormFieldValid(formik, "otp") && (
|
|
104
111
|
<Message className="text-red-500 text-sm" severity="error" text={formik.errors.otp?.toString()} />
|
|
@@ -112,17 +119,18 @@ const SolidInitiateRegisterOtp = ({ email }: { email: string }) => {
|
|
|
112
119
|
</div>
|
|
113
120
|
<div className="mt-4">
|
|
114
121
|
<Button type="submit" className="w-full font-light auth-submit-button" label="Verify" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
|
|
122
|
+
<Button type="button" label="Back" className="w-full auth-back-button text-center" link onClick={() => (window.location.href = '/auth/login')} />
|
|
115
123
|
</div>
|
|
116
124
|
</Form>
|
|
117
125
|
)}
|
|
118
126
|
</Formik>
|
|
119
127
|
</>
|
|
120
128
|
</div>
|
|
121
|
-
<div className="text-center mt-5">
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
</div>
|
|
129
|
+
{/* <div className="text-center mt-5">
|
|
130
|
+
<div className="text-sm text-400 secondary-dark-color">
|
|
131
|
+
{'<'} Back to <Link className="font-bold" href="/auth/login">Sign In</Link>
|
|
125
132
|
</div>
|
|
133
|
+
</div> */}
|
|
126
134
|
</>
|
|
127
135
|
);
|
|
128
136
|
};
|
|
@@ -76,7 +76,7 @@ const SolidLogin = () => {
|
|
|
76
76
|
.required("Email is required"),
|
|
77
77
|
password: Yup.string().required("Password is required"),
|
|
78
78
|
})}
|
|
79
|
-
onSubmit={async (values, { setSubmitting }) => {
|
|
79
|
+
onSubmit={async (values, { setSubmitting, setErrors }) => {
|
|
80
80
|
try {
|
|
81
81
|
const response = await signIn("credentials", {
|
|
82
82
|
redirect: false,
|
|
@@ -86,6 +86,10 @@ const SolidLogin = () => {
|
|
|
86
86
|
|
|
87
87
|
if (response?.error) {
|
|
88
88
|
showToast("error", "Login Error", response.error);
|
|
89
|
+
setErrors({
|
|
90
|
+
email: "Invalid email or password",
|
|
91
|
+
password: "Invalid email or password",
|
|
92
|
+
});
|
|
89
93
|
} else {
|
|
90
94
|
showToast("success", "Login Success", "Redirecting to dashboard...");
|
|
91
95
|
router.push("/admin/core/solid-core/user/list");
|
|
@@ -107,6 +111,7 @@ const SolidLogin = () => {
|
|
|
107
111
|
placeholder="Email ID"
|
|
108
112
|
onChange={formik.handleChange}
|
|
109
113
|
value={formik.values.email}
|
|
114
|
+
invalid={!!formik.errors.email}
|
|
110
115
|
/>
|
|
111
116
|
{isFormFieldValid(formik, "email") && <Message
|
|
112
117
|
className="text-red-500 text-sm"
|
|
@@ -114,20 +119,17 @@ const SolidLogin = () => {
|
|
|
114
119
|
text={formik?.errors?.email?.toString()}
|
|
115
120
|
/>}
|
|
116
121
|
</div>
|
|
117
|
-
<div className="flex flex-column gap-
|
|
122
|
+
<div className="flex flex-column gap-1 mt-4" style={{}}>
|
|
118
123
|
<label htmlFor="password" className="solid-auth-input-label">Password</label>
|
|
119
124
|
<Password
|
|
120
125
|
id="password"
|
|
121
|
-
placeholder="***************"
|
|
122
126
|
value={password}
|
|
123
127
|
onChange={(e) => {
|
|
124
128
|
setPassword(e.target.value);
|
|
125
129
|
formik.setFieldValue("password", e.target.value);
|
|
126
130
|
}}
|
|
127
131
|
toggleMask
|
|
128
|
-
|
|
129
|
-
"p-invalid": isFormFieldValid(formik, "password"),
|
|
130
|
-
})}
|
|
132
|
+
invalid={!!formik.errors.password}
|
|
131
133
|
inputClassName="w-full"
|
|
132
134
|
feedback={false}
|
|
133
135
|
/>
|
|
@@ -138,9 +140,9 @@ const SolidLogin = () => {
|
|
|
138
140
|
/>}
|
|
139
141
|
</div>
|
|
140
142
|
{/* <div className="flex align-items-center mt-4">
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
<Checkbox inputId="remember" onChange={(e: any) => setChecked(e.checked)} checked={checked} />
|
|
144
|
+
<label htmlFor="remember" className="ml-2">Remember me</label>
|
|
145
|
+
</div> */}
|
|
144
146
|
<div className="mt-4 text-right">
|
|
145
147
|
<Link href={"/auth/initiate-forgot-password"} className="solid-auth-input-label">Forgot Password?</Link>
|
|
146
148
|
</div>
|
|
@@ -160,7 +162,7 @@ const SolidLogin = () => {
|
|
|
160
162
|
email: Yup.string()
|
|
161
163
|
.email("Invalid email address")
|
|
162
164
|
})}
|
|
163
|
-
onSubmit={async (values, { setSubmitting }) => {
|
|
165
|
+
onSubmit={async (values, { setSubmitting, setErrors }) => {
|
|
164
166
|
try {
|
|
165
167
|
const payload = {
|
|
166
168
|
type: "email",
|
|
@@ -178,6 +180,9 @@ const SolidLogin = () => {
|
|
|
178
180
|
}
|
|
179
181
|
} catch (err: any) {
|
|
180
182
|
showToast("error", "Login Error", err?.data ? err?.data?.message : "Something Went Wrong");
|
|
183
|
+
setErrors({
|
|
184
|
+
email: "Invalid email",
|
|
185
|
+
});
|
|
181
186
|
} finally {
|
|
182
187
|
setSubmitting(false);
|
|
183
188
|
}
|
|
@@ -193,6 +198,7 @@ const SolidLogin = () => {
|
|
|
193
198
|
placeholder="Email ID"
|
|
194
199
|
onChange={formik.handleChange}
|
|
195
200
|
value={formik.values.email}
|
|
201
|
+
invalid={!!formik.errors.email}
|
|
196
202
|
/>
|
|
197
203
|
{isFormFieldValid(formik, "email") && <Message
|
|
198
204
|
className="text-red-500 text-sm"
|
|
@@ -102,7 +102,7 @@ const SolidRegister = () => {
|
|
|
102
102
|
.required("Email is required"),
|
|
103
103
|
password: Yup.string().required("Password is required"),
|
|
104
104
|
})}
|
|
105
|
-
onSubmit={async (values, { setSubmitting }) => {
|
|
105
|
+
onSubmit={async (values, { setSubmitting, setErrors }) => {
|
|
106
106
|
try {
|
|
107
107
|
const userData = {
|
|
108
108
|
username: values.username,
|
|
@@ -113,12 +113,19 @@ const SolidRegister = () => {
|
|
|
113
113
|
const response = await register(userData).unwrap();
|
|
114
114
|
if (response?.statusCode === 200) {
|
|
115
115
|
showToast("success", "User Registered", response?.data?.message);
|
|
116
|
-
|
|
116
|
+
setTimeout(() => {
|
|
117
|
+
router.push(`/auth/login`);
|
|
118
|
+
}, 3000);
|
|
117
119
|
} else {
|
|
118
120
|
showToast("error", "Login Error", response.error);
|
|
121
|
+
// setErrors({
|
|
122
|
+
// username: 'Invalid email or password',
|
|
123
|
+
// email: "Invalid email or password",
|
|
124
|
+
// password: "Invalid email or password",
|
|
125
|
+
// });
|
|
119
126
|
}
|
|
120
127
|
} catch (err: any) {
|
|
121
|
-
showToast("error", "Login
|
|
128
|
+
showToast("error", "Login Conflict", err?.data ? err?.data?.message : "Something Went Wrong");
|
|
122
129
|
} finally {
|
|
123
130
|
setSubmitting(false);
|
|
124
131
|
}
|
|
@@ -134,6 +141,7 @@ const SolidRegister = () => {
|
|
|
134
141
|
placeholder="username"
|
|
135
142
|
onChange={formik.handleChange}
|
|
136
143
|
value={formik.values.username}
|
|
144
|
+
invalid={!!formik.errors.username}
|
|
137
145
|
/>
|
|
138
146
|
{isFormFieldValid(formik, "username") && <Message
|
|
139
147
|
className="text-red-500 text-sm"
|
|
@@ -149,6 +157,7 @@ const SolidRegister = () => {
|
|
|
149
157
|
placeholder="Yourgmail@123.com"
|
|
150
158
|
onChange={formik.handleChange}
|
|
151
159
|
value={formik.values.email}
|
|
160
|
+
invalid={!!formik.errors.email}
|
|
152
161
|
/>
|
|
153
162
|
{isFormFieldValid(formik, "email") && <Message
|
|
154
163
|
className="text-red-500 text-sm"
|
|
@@ -163,13 +172,10 @@ const SolidRegister = () => {
|
|
|
163
172
|
name="password"
|
|
164
173
|
value={formik.values.password}
|
|
165
174
|
onChange={formik.handleChange}
|
|
166
|
-
placeholder="***************"
|
|
167
175
|
toggleMask
|
|
168
|
-
className={classNames("", {
|
|
169
|
-
"p-invalid": isFormFieldValid(formik, "password"),
|
|
170
|
-
})}
|
|
171
176
|
inputClassName="w-full"
|
|
172
177
|
feedback={false}
|
|
178
|
+
invalid={!!formik.errors.password}
|
|
173
179
|
/>
|
|
174
180
|
{isFormFieldValid(formik, "password") && <Message
|
|
175
181
|
className="text-red-500 text-sm"
|
|
@@ -233,6 +239,7 @@ const SolidRegister = () => {
|
|
|
233
239
|
placeholder="username"
|
|
234
240
|
onChange={formik.handleChange}
|
|
235
241
|
value={formik.values.username}
|
|
242
|
+
invalid={!!formik.errors.username}
|
|
236
243
|
/>
|
|
237
244
|
{isFormFieldValid(formik, "username") && <Message
|
|
238
245
|
className="text-red-500 text-sm"
|
|
@@ -248,6 +255,7 @@ const SolidRegister = () => {
|
|
|
248
255
|
placeholder="Yourgmail@123.com"
|
|
249
256
|
onChange={formik.handleChange}
|
|
250
257
|
value={formik.values.email}
|
|
258
|
+
invalid={!!formik.errors.email}
|
|
251
259
|
/>
|
|
252
260
|
{isFormFieldValid(formik, "email") && <Message
|
|
253
261
|
className="text-red-500 text-sm"
|
|
@@ -264,7 +272,7 @@ const SolidRegister = () => {
|
|
|
264
272
|
)
|
|
265
273
|
}
|
|
266
274
|
|
|
267
|
-
const AuthTabs: React.FC<AuthTabsProps> = ({iamPasswordRegistrationEnabled, iamPasswordLessRegistrationEnabled}) => {
|
|
275
|
+
const AuthTabs: React.FC<AuthTabsProps> = ({ iamPasswordRegistrationEnabled, iamPasswordLessRegistrationEnabled }) => {
|
|
268
276
|
if (iamPasswordRegistrationEnabled && iamPasswordLessRegistrationEnabled) {
|
|
269
277
|
return (
|
|
270
278
|
<TabView className="solid-auth-tabview">
|
|
@@ -300,7 +308,7 @@ const SolidRegister = () => {
|
|
|
300
308
|
</div>
|
|
301
309
|
</div>
|
|
302
310
|
}
|
|
303
|
-
<h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>Sign Up
|
|
311
|
+
<h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>Sign Up</h2>
|
|
304
312
|
{/* <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> */}
|
|
305
313
|
<AuthTabs iamPasswordRegistrationEnabled={solidSettingsData?.data?.iamPasswordRegistrationEnabled} iamPasswordLessRegistrationEnabled={solidSettingsData?.data?.iamPasswordLessRegistrationEnabled} />
|
|
306
314
|
{solidSettingsData?.data?.iamGoogleOAuthEnabled &&
|
|
@@ -5,7 +5,7 @@ import { useConfirmForgotPasswordMutation } from "@/redux/api/authApi";
|
|
|
5
5
|
import { useLazyGetAuthSettingsQuery } from "@/redux/api/solidSettingsApi";
|
|
6
6
|
import { useFormik } from "formik";
|
|
7
7
|
import Link from "next/link";
|
|
8
|
-
import { useRouter } from "next/navigation";
|
|
8
|
+
import { useRouter, useSearchParams } from "next/navigation";
|
|
9
9
|
import { Button } from "primereact/button";
|
|
10
10
|
import { Message } from "primereact/message";
|
|
11
11
|
import { Password } from "primereact/password";
|
|
@@ -14,7 +14,11 @@ import { classNames } from "primereact/utils";
|
|
|
14
14
|
import { useEffect, useRef } from "react";
|
|
15
15
|
import * as Yup from "yup";
|
|
16
16
|
|
|
17
|
-
const SolidResetPassword = (
|
|
17
|
+
const SolidResetPassword = () => {
|
|
18
|
+
const searchParams = useSearchParams();
|
|
19
|
+
const verificationToken = searchParams.get('token');
|
|
20
|
+
const decodedUsername = searchParams.get('username');
|
|
21
|
+
const username = decodedUsername ? decodeURIComponent(decodedUsername) : '';
|
|
18
22
|
const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
|
|
19
23
|
useEffect(() => {
|
|
20
24
|
trigger("")
|
|
@@ -52,6 +56,7 @@ const SolidResetPassword = ({ verificationToken, username }: { verificationToken
|
|
|
52
56
|
password: values.password,
|
|
53
57
|
verificationToken: values.verificationToken,
|
|
54
58
|
};
|
|
59
|
+
console.log("Paylod", payload);
|
|
55
60
|
const response = await confirmForgotPassword(payload).unwrap();
|
|
56
61
|
if (response?.statusCode === 200) {
|
|
57
62
|
showToast("success", "Login Successfull", "Password Updated Successfully")
|
|
@@ -60,6 +65,7 @@ const SolidResetPassword = ({ verificationToken, username }: { verificationToken
|
|
|
60
65
|
showToast("error", "Login Error", response.error)
|
|
61
66
|
)
|
|
62
67
|
} catch (err: any) {
|
|
68
|
+
console.log("Error", err);
|
|
63
69
|
showToast("error", "Login Error", err?.data ? err?.data?.message : "Something Went Wrong");
|
|
64
70
|
}
|
|
65
71
|
},
|
|
@@ -71,7 +77,7 @@ const SolidResetPassword = ({ verificationToken, username }: { verificationToken
|
|
|
71
77
|
return (
|
|
72
78
|
<>
|
|
73
79
|
<Toast ref={toast} />
|
|
74
|
-
<div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center'
|
|
80
|
+
<div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'center' : 'side'}`}>
|
|
75
81
|
{solidSettingsData?.data?.authPagesLayout === 'center' &&
|
|
76
82
|
<div className="flex justify-content-center">
|
|
77
83
|
<div className="solid-logo flex align-items-center gap-3">
|
|
@@ -109,7 +115,7 @@ const SolidResetPassword = ({ verificationToken, username }: { verificationToken
|
|
|
109
115
|
text={formik?.errors?.password?.toString()}
|
|
110
116
|
/>}
|
|
111
117
|
</div>
|
|
112
|
-
<div className="flex flex-column gap-
|
|
118
|
+
<div className="flex flex-column gap-1 mt-4" style={{}}>
|
|
113
119
|
<label htmlFor="password" className="solid-auth-input-label">Confirm Password</label>
|
|
114
120
|
<Password
|
|
115
121
|
id="confirmPassword"
|
|
@@ -137,14 +143,15 @@ const SolidResetPassword = ({ verificationToken, username }: { verificationToken
|
|
|
137
143
|
</div> */}
|
|
138
144
|
<div className="mt-4">
|
|
139
145
|
<Button className="w-full font-light auth-submit-button" label="Reset Password" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
|
|
146
|
+
<Button type="button" label="Back" className="w-full auth-back-button text-center" link onClick={() => (window.location.href = '/auth/login')} />
|
|
140
147
|
</div>
|
|
141
148
|
</form>
|
|
142
149
|
</div>
|
|
143
|
-
<div className="text-center mt-5">
|
|
150
|
+
{/* <div className="text-center mt-5">
|
|
144
151
|
<div className="text-sm text-400 secondary-dark-color">
|
|
145
152
|
{'<'} Back to <Link className="font-bold" href="/auth/login">Sign In</Link>
|
|
146
153
|
</div>
|
|
147
|
-
</div>
|
|
154
|
+
</div> */}
|
|
148
155
|
</>
|
|
149
156
|
);
|
|
150
157
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import { useCreateSolidSettingsMutation, useUpdateSolidSettingsMutation } from '@/redux/api/solidSettingsApi';
|
|
2
|
+
import { useCreateSolidSettingsMutation, useLazyGetSolidSettingsQuery, useUpdateSolidSettingsMutation } from '@/redux/api/solidSettingsApi';
|
|
3
3
|
import { useFormik } from 'formik';
|
|
4
4
|
import { Button } from 'primereact/button';
|
|
5
5
|
import { InputText } from 'primereact/inputtext';
|
|
@@ -11,7 +11,12 @@ import { RadioButton } from 'primereact/radiobutton';
|
|
|
11
11
|
import { handleError } from '@/helpers/ToastContainer';
|
|
12
12
|
import { usePathname } from 'next/navigation';
|
|
13
13
|
|
|
14
|
-
export const GeneralSettings = (
|
|
14
|
+
export const GeneralSettings = () => {
|
|
15
|
+
const [trigger, { data: solidSettingsData }] = useLazyGetSolidSettingsQuery()
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
trigger("") // Fetch settings on mount
|
|
19
|
+
}, [trigger])
|
|
15
20
|
const pathname = usePathname();
|
|
16
21
|
const [updateSolidSettings] = useUpdateSolidSettingsMutation();
|
|
17
22
|
const [
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
|
|
5
|
+
export const NotFound = () => {
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<div className="d-flex align-items-center justify-content-center vh-100">
|
|
9
|
+
<div className="text-center">
|
|
10
|
+
<h1 className="display-1 fw-bold">404</h1>
|
|
11
|
+
<p className="fs-3">
|
|
12
|
+
<span className="text-danger">Opps!</span> Page not found.
|
|
13
|
+
</p>
|
|
14
|
+
<p className="lead">The page you are looking for does not exist.</p>
|
|
15
|
+
<Link href="/" className="btn btn-primary">
|
|
16
|
+
Go Home
|
|
17
|
+
</Link>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -9,7 +9,7 @@ import { useEffect, useState } from "react";
|
|
|
9
9
|
// In case of relationType the Id field will always will be id
|
|
10
10
|
// Else the value will be whatever valuekey use passed
|
|
11
11
|
|
|
12
|
-
export const SingleSelectAutoCompleteField = ({ disabled, formik, isFormFieldValid, relationField, fieldName, fieldNameId, labelKey, valueKey, searchData, existingData, additionalAction }: any) => {
|
|
12
|
+
export const SingleSelectAutoCompleteField = ({ disabled, formik, isFormFieldValid, relationField, fieldName, fieldNameId, labelKey, valueKey, searchData, existingData, additionalAction, formErrors }: any) => {
|
|
13
13
|
|
|
14
14
|
const [selectedItem, setSelectedItem] = useState(existingData);
|
|
15
15
|
const [filteredItem, setFilteredItem] = useState([]);
|
|
@@ -32,7 +32,7 @@ export const SingleSelectAutoCompleteField = ({ disabled, formik, isFormFieldVal
|
|
|
32
32
|
disabled={disabled ? disabled : false}
|
|
33
33
|
value={selectedItem}
|
|
34
34
|
suggestions={filteredItem}
|
|
35
|
-
invalid={isFormFieldValid(formik, fieldName)}
|
|
35
|
+
invalid={(isFormFieldValid(formik, fieldName) || (formErrors[fieldName]))}
|
|
36
36
|
completeMethod={searchItems}
|
|
37
37
|
virtualScrollerOptions={{ itemSize: 38 }}
|
|
38
38
|
// style={{
|