@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.mjs
CHANGED
|
@@ -1916,6 +1916,7 @@ function ResetPasswordForm({
|
|
|
1916
1916
|
onSubmit,
|
|
1917
1917
|
error,
|
|
1918
1918
|
loading = false,
|
|
1919
|
+
success = false,
|
|
1919
1920
|
emailAuthConfig,
|
|
1920
1921
|
appearance = {},
|
|
1921
1922
|
title = "Reset Password",
|
|
@@ -1927,8 +1928,27 @@ function ResetPasswordForm({
|
|
|
1927
1928
|
submitButtonText = "Reset Password",
|
|
1928
1929
|
loadingButtonText = "Resetting...",
|
|
1929
1930
|
backToSignInText = "",
|
|
1930
|
-
backToSignInUrl = "/sign-in"
|
|
1931
|
+
backToSignInUrl = "/sign-in",
|
|
1932
|
+
successTitle = "Password Reset Successful!",
|
|
1933
|
+
successMessage = "Your password has been successfully reset. You can now sign in with your new password."
|
|
1931
1934
|
}) {
|
|
1935
|
+
if (success) {
|
|
1936
|
+
return /* @__PURE__ */ jsx(
|
|
1937
|
+
AuthContainer,
|
|
1938
|
+
{
|
|
1939
|
+
appearance: {
|
|
1940
|
+
containerClassName: appearance.container,
|
|
1941
|
+
cardClassName: appearance.card
|
|
1942
|
+
},
|
|
1943
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4", children: [
|
|
1944
|
+
/* @__PURE__ */ jsx("div", { className: "w-16 h-16 rounded-full bg-green-100 dark:bg-green-900 flex items-center justify-center", children: /* @__PURE__ */ 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__ */ jsx("path", { d: "M5 13l4 4L19 7" }) }) }),
|
|
1945
|
+
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold text-black dark:text-white text-center", children: successTitle }),
|
|
1946
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-neutral-600 dark:text-neutral-400 text-center", children: successMessage }),
|
|
1947
|
+
/* @__PURE__ */ jsx("a", { href: backToSignInUrl, className: "mt-4 text-black dark:text-white font-medium", children: "Back to Sign In" })
|
|
1948
|
+
] })
|
|
1949
|
+
}
|
|
1950
|
+
);
|
|
1951
|
+
}
|
|
1932
1952
|
return /* @__PURE__ */ jsxs(
|
|
1933
1953
|
AuthContainer,
|
|
1934
1954
|
{
|
|
@@ -2041,6 +2061,7 @@ function ResetPassword({
|
|
|
2041
2061
|
const [confirmPassword, setConfirmPassword] = useState("");
|
|
2042
2062
|
const [error, setError] = useState("");
|
|
2043
2063
|
const [loading, setLoading] = useState(false);
|
|
2064
|
+
const [success, setSuccess] = useState(false);
|
|
2044
2065
|
async function handleSubmit(e) {
|
|
2045
2066
|
e.preventDefault();
|
|
2046
2067
|
setLoading(true);
|
|
@@ -2077,6 +2098,7 @@ function ResetPassword({
|
|
|
2077
2098
|
try {
|
|
2078
2099
|
const result = await resetPassword(token, newPassword);
|
|
2079
2100
|
if (result?.message) {
|
|
2101
|
+
setSuccess(true);
|
|
2080
2102
|
if (onSuccess) {
|
|
2081
2103
|
onSuccess(result.redirectTo);
|
|
2082
2104
|
}
|
|
@@ -2110,6 +2132,7 @@ function ResetPassword({
|
|
|
2110
2132
|
onSubmit: handleSubmit,
|
|
2111
2133
|
error,
|
|
2112
2134
|
loading,
|
|
2135
|
+
success,
|
|
2113
2136
|
emailAuthConfig: emailConfig,
|
|
2114
2137
|
backToSignInUrl,
|
|
2115
2138
|
...uiProps
|
|
@@ -2226,10 +2249,14 @@ function ForgotPassword({
|
|
|
2226
2249
|
setIsSendingCode(false);
|
|
2227
2250
|
}
|
|
2228
2251
|
}, [email, sendPasswordResetCode]);
|
|
2229
|
-
function handlePasswordResetSuccess() {
|
|
2252
|
+
function handlePasswordResetSuccess(redirectTo) {
|
|
2253
|
+
const targetUrl = redirectTo || backToSignInUrl;
|
|
2230
2254
|
if (onSuccess) {
|
|
2231
2255
|
onSuccess();
|
|
2232
2256
|
}
|
|
2257
|
+
setTimeout(() => {
|
|
2258
|
+
window.location.href = targetUrl;
|
|
2259
|
+
}, 1500);
|
|
2233
2260
|
}
|
|
2234
2261
|
if (!emailConfig) {
|
|
2235
2262
|
return null;
|