@insforge/react 0.3.1 → 0.3.2
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.js +29 -2
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +29 -2
- package/dist/components.mjs.map +1 -1
- package/dist/forms.d.mts +1 -1
- package/dist/forms.d.ts +1 -1
- package/dist/forms.js +21 -1
- package/dist/forms.js.map +1 -1
- package/dist/forms.mjs +21 -1
- package/dist/forms.mjs.map +1 -1
- package/dist/index.js +29 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -2
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.mts +3 -0
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1918,6 +1918,7 @@ function ResetPasswordForm({
|
|
|
1918
1918
|
onSubmit,
|
|
1919
1919
|
error,
|
|
1920
1920
|
loading = false,
|
|
1921
|
+
success = false,
|
|
1921
1922
|
emailAuthConfig,
|
|
1922
1923
|
appearance = {},
|
|
1923
1924
|
title = "Reset Password",
|
|
@@ -1929,8 +1930,27 @@ function ResetPasswordForm({
|
|
|
1929
1930
|
submitButtonText = "Reset Password",
|
|
1930
1931
|
loadingButtonText = "Resetting...",
|
|
1931
1932
|
backToSignInText = "",
|
|
1932
|
-
backToSignInUrl = "/sign-in"
|
|
1933
|
+
backToSignInUrl = "/sign-in",
|
|
1934
|
+
successTitle = "Password Reset Successful!",
|
|
1935
|
+
successMessage = "Your password has been successfully reset. You can now sign in with your new password."
|
|
1933
1936
|
}) {
|
|
1937
|
+
if (success) {
|
|
1938
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1939
|
+
AuthContainer,
|
|
1940
|
+
{
|
|
1941
|
+
appearance: {
|
|
1942
|
+
containerClassName: appearance.container,
|
|
1943
|
+
cardClassName: appearance.card
|
|
1944
|
+
},
|
|
1945
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4", children: [
|
|
1946
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-16 h-16 rounded-full bg-green-100 dark:bg-green-900 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-8 h-8 text-green-600 dark:text-green-400", fill: "none", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 13l4 4L19 7" }) }) }),
|
|
1947
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl font-semibold text-black dark:text-white text-center", children: successTitle }),
|
|
1948
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: successMessage }),
|
|
1949
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: backToSignInUrl, className: "mt-4 text-black dark:text-white font-medium", children: "Back to Sign In" })
|
|
1950
|
+
] })
|
|
1951
|
+
}
|
|
1952
|
+
);
|
|
1953
|
+
}
|
|
1934
1954
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1935
1955
|
AuthContainer,
|
|
1936
1956
|
{
|
|
@@ -2043,6 +2063,7 @@ function ResetPassword({
|
|
|
2043
2063
|
const [confirmPassword, setConfirmPassword] = react.useState("");
|
|
2044
2064
|
const [error, setError] = react.useState("");
|
|
2045
2065
|
const [loading, setLoading] = react.useState(false);
|
|
2066
|
+
const [success, setSuccess] = react.useState(false);
|
|
2046
2067
|
async function handleSubmit(e) {
|
|
2047
2068
|
e.preventDefault();
|
|
2048
2069
|
setLoading(true);
|
|
@@ -2079,6 +2100,7 @@ function ResetPassword({
|
|
|
2079
2100
|
try {
|
|
2080
2101
|
const result = await resetPassword(token, newPassword);
|
|
2081
2102
|
if (result?.message) {
|
|
2103
|
+
setSuccess(true);
|
|
2082
2104
|
if (onSuccess) {
|
|
2083
2105
|
onSuccess(result.redirectTo);
|
|
2084
2106
|
}
|
|
@@ -2112,6 +2134,7 @@ function ResetPassword({
|
|
|
2112
2134
|
onSubmit: handleSubmit,
|
|
2113
2135
|
error,
|
|
2114
2136
|
loading,
|
|
2137
|
+
success,
|
|
2115
2138
|
emailAuthConfig: emailConfig,
|
|
2116
2139
|
backToSignInUrl,
|
|
2117
2140
|
...uiProps
|
|
@@ -2228,10 +2251,14 @@ function ForgotPassword({
|
|
|
2228
2251
|
setIsSendingCode(false);
|
|
2229
2252
|
}
|
|
2230
2253
|
}, [email, sendPasswordResetCode]);
|
|
2231
|
-
function handlePasswordResetSuccess() {
|
|
2254
|
+
function handlePasswordResetSuccess(redirectTo) {
|
|
2255
|
+
const targetUrl = redirectTo || backToSignInUrl;
|
|
2232
2256
|
if (onSuccess) {
|
|
2233
2257
|
onSuccess();
|
|
2234
2258
|
}
|
|
2259
|
+
setTimeout(() => {
|
|
2260
|
+
window.location.href = targetUrl;
|
|
2261
|
+
}, 1500);
|
|
2235
2262
|
}
|
|
2236
2263
|
if (!emailConfig) {
|
|
2237
2264
|
return null;
|