@better-auth-ui/heroui 1.6.16 → 1.6.18
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
|
@@ -627,7 +627,7 @@ function $e({ className: t, socialLayout: n, socialPosition: i = "bottom", varia
|
|
|
627
627
|
}),
|
|
628
628
|
/* @__PURE__ */ $(j.Footer, {
|
|
629
629
|
className: "flex-col gap-3",
|
|
630
|
-
children: [d?.forgotPassword && /* @__PURE__ */ Q(B, {
|
|
630
|
+
children: [d?.enabled && d?.forgotPassword && /* @__PURE__ */ Q(B, {
|
|
631
631
|
href: `${l.auth}/${_.auth.forgotPassword}`,
|
|
632
632
|
className: "no-underline hover:underline",
|
|
633
633
|
children: f.auth.forgotPasswordLink
|
|
@@ -1300,8 +1300,16 @@ function ht({ className: e, variant: t, ...n }) {
|
|
|
1300
1300
|
});
|
|
1301
1301
|
}
|
|
1302
1302
|
function gt({ className: e, variant: t, ...n }) {
|
|
1303
|
-
let { authClient: r, localization: i } = m(), { data:
|
|
1304
|
-
|
|
1303
|
+
let { authClient: r, localization: i, plugins: a } = m(), { data: o } = C(r), { fetchOptions: s, resetFetchOptions: c } = v(), { mutate: l, isPending: u } = x(r, {
|
|
1304
|
+
onError: () => {
|
|
1305
|
+
c();
|
|
1306
|
+
},
|
|
1307
|
+
onSuccess: () => Y.success(i.auth.passwordResetEmailSent)
|
|
1308
|
+
}), d = a.find((e) => e.captchaComponent)?.captchaComponent, f = () => {
|
|
1309
|
+
o?.user.email && l({
|
|
1310
|
+
email: o.user.email,
|
|
1311
|
+
fetchOptions: s
|
|
1312
|
+
});
|
|
1305
1313
|
};
|
|
1306
1314
|
return /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("h2", {
|
|
1307
1315
|
className: J("text-sm font-semibold mb-3"),
|
|
@@ -1318,15 +1326,18 @@ function gt({ className: e, variant: t, ...n }) {
|
|
|
1318
1326
|
}), /* @__PURE__ */ Q("p", {
|
|
1319
1327
|
className: "text-muted text-xs mt-0.5",
|
|
1320
1328
|
children: i.settings.setPasswordDescription
|
|
1321
|
-
})] }), /* @__PURE__ */ $(
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1329
|
+
})] }), /* @__PURE__ */ $("div", {
|
|
1330
|
+
className: "flex flex-col gap-3 items-start sm:items-end",
|
|
1331
|
+
children: [d && /* @__PURE__ */ Q("div", { children: d }), /* @__PURE__ */ $(k, {
|
|
1332
|
+
size: "sm",
|
|
1333
|
+
isPending: u,
|
|
1334
|
+
isDisabled: !o?.user.email,
|
|
1335
|
+
onPress: f,
|
|
1336
|
+
children: [u && /* @__PURE__ */ Q(G, {
|
|
1337
|
+
color: "current",
|
|
1338
|
+
size: "sm"
|
|
1339
|
+
}), i.auth.sendResetLink]
|
|
1340
|
+
})]
|
|
1330
1341
|
})]
|
|
1331
1342
|
})
|
|
1332
1343
|
})] });
|
package/dist/plugins.js
CHANGED
|
@@ -2825,7 +2825,7 @@ function zn({ className: n, socialLayout: i, socialPosition: a = "bottom", varia
|
|
|
2825
2825
|
}),
|
|
2826
2826
|
/* @__PURE__ */ Z(j.Footer, {
|
|
2827
2827
|
className: "flex-col gap-3",
|
|
2828
|
-
children: [d?.forgotPassword && /* @__PURE__ */ X(et, {
|
|
2828
|
+
children: [d?.enabled && d?.forgotPassword && /* @__PURE__ */ X(et, {
|
|
2829
2829
|
href: `${l.auth}/${v.auth.forgotPassword}`,
|
|
2830
2830
|
className: "no-underline hover:underline",
|
|
2831
2831
|
children: f.auth.forgotPasswordLink
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useAuth,
|
|
3
3
|
useChangePassword,
|
|
4
|
+
useFetchOptions,
|
|
4
5
|
useListAccounts,
|
|
5
6
|
useRequestPasswordReset,
|
|
6
7
|
useSession
|
|
@@ -73,19 +74,27 @@ function SetPassword({
|
|
|
73
74
|
variant,
|
|
74
75
|
...props
|
|
75
76
|
}: Omit<CardProps, "children">) {
|
|
76
|
-
const { authClient, localization } = useAuth()
|
|
77
|
+
const { authClient, localization, plugins } = useAuth()
|
|
77
78
|
const { data: session } = useSession(authClient)
|
|
79
|
+
const { fetchOptions, resetFetchOptions } = useFetchOptions()
|
|
78
80
|
|
|
79
81
|
const { mutate: requestPasswordReset, isPending } = useRequestPasswordReset(
|
|
80
82
|
authClient,
|
|
81
83
|
{
|
|
84
|
+
onError: () => {
|
|
85
|
+
resetFetchOptions()
|
|
86
|
+
},
|
|
82
87
|
onSuccess: () => toast.success(localization.auth.passwordResetEmailSent)
|
|
83
88
|
}
|
|
84
89
|
)
|
|
85
90
|
|
|
91
|
+
const Captcha = plugins.find(
|
|
92
|
+
(plugin) => plugin.captchaComponent
|
|
93
|
+
)?.captchaComponent
|
|
94
|
+
|
|
86
95
|
const handleSetPassword = () => {
|
|
87
96
|
if (!session?.user.email) return
|
|
88
|
-
requestPasswordReset({ email: session.user.email })
|
|
97
|
+
requestPasswordReset({ email: session.user.email, fetchOptions })
|
|
89
98
|
}
|
|
90
99
|
|
|
91
100
|
return (
|
|
@@ -106,15 +115,19 @@ function SetPassword({
|
|
|
106
115
|
</p>
|
|
107
116
|
</div>
|
|
108
117
|
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
<div className="flex flex-col gap-3 items-start sm:items-end">
|
|
119
|
+
{Captcha && <div>{Captcha}</div>}
|
|
120
|
+
|
|
121
|
+
<Button
|
|
122
|
+
size="sm"
|
|
123
|
+
isPending={isPending}
|
|
124
|
+
isDisabled={!session?.user.email}
|
|
125
|
+
onPress={handleSetPassword}
|
|
126
|
+
>
|
|
127
|
+
{isPending && <Spinner color="current" size="sm" />}
|
|
128
|
+
{localization.auth.sendResetLink}
|
|
129
|
+
</Button>
|
|
130
|
+
</div>
|
|
118
131
|
</Card.Content>
|
|
119
132
|
</Card>
|
|
120
133
|
</div>
|
|
@@ -260,7 +260,7 @@ export function SignIn({
|
|
|
260
260
|
</Card.Content>
|
|
261
261
|
|
|
262
262
|
<Card.Footer className="flex-col gap-3">
|
|
263
|
-
{emailAndPassword?.forgotPassword && (
|
|
263
|
+
{emailAndPassword?.enabled && emailAndPassword?.forgotPassword && (
|
|
264
264
|
<Link
|
|
265
265
|
href={`${basePaths.auth}/${viewPaths.auth.forgotPassword}`}
|
|
266
266
|
className="no-underline hover:underline"
|
|
@@ -288,7 +288,7 @@ export function SignInUsername({
|
|
|
288
288
|
</Card.Content>
|
|
289
289
|
|
|
290
290
|
<Card.Footer className="flex-col gap-3">
|
|
291
|
-
{emailAndPassword?.forgotPassword && (
|
|
291
|
+
{emailAndPassword?.enabled && emailAndPassword?.forgotPassword && (
|
|
292
292
|
<Link
|
|
293
293
|
href={`${basePaths.auth}/${viewPaths.auth.forgotPassword}`}
|
|
294
294
|
className="no-underline hover:underline"
|