@contentgrowth/content-auth 0.2.3 → 0.2.4
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/backend/index.d.ts
CHANGED
|
@@ -1083,6 +1083,18 @@ declare function getInvitationLink(data: any, baseUrl: string): {
|
|
|
1083
1083
|
* @returns The session token or null if not found
|
|
1084
1084
|
*/
|
|
1085
1085
|
declare function getSessionToken(req: Request): string | null;
|
|
1086
|
+
/**
|
|
1087
|
+
* Programmatically triggers a password reset email for a user.
|
|
1088
|
+
* This bypasses the need for an HTTP call by using better-auth's internal API.
|
|
1089
|
+
*
|
|
1090
|
+
* @param auth The auth instance created by createAuth()
|
|
1091
|
+
* @param email The user's email address
|
|
1092
|
+
* @returns Promise that resolves when the reset email is triggered
|
|
1093
|
+
*/
|
|
1094
|
+
declare function triggerPasswordReset(auth: any, email: string): Promise<{
|
|
1095
|
+
success: boolean;
|
|
1096
|
+
error?: string;
|
|
1097
|
+
}>;
|
|
1086
1098
|
|
|
1087
1099
|
interface AuthConfig {
|
|
1088
1100
|
/**
|
|
@@ -1113,4 +1125,4 @@ declare const createAuthApp: (config: AuthConfig) => {
|
|
|
1113
1125
|
auth: better_auth.Auth<any>;
|
|
1114
1126
|
};
|
|
1115
1127
|
|
|
1116
|
-
export { type AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, getSessionToken, schema };
|
|
1128
|
+
export { type AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, getSessionToken, schema, triggerPasswordReset };
|
package/dist/backend/index.js
CHANGED
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
createAuthApp,
|
|
6
6
|
getInvitationLink,
|
|
7
7
|
getSessionToken,
|
|
8
|
-
schema_exports
|
|
9
|
-
|
|
8
|
+
schema_exports,
|
|
9
|
+
triggerPasswordReset
|
|
10
|
+
} from "../chunk-43OBL3NC.js";
|
|
10
11
|
import "../chunk-R5U7XKVJ.js";
|
|
11
12
|
export {
|
|
12
13
|
Hono,
|
|
@@ -15,5 +16,6 @@ export {
|
|
|
15
16
|
createAuthApp,
|
|
16
17
|
getInvitationLink,
|
|
17
18
|
getSessionToken,
|
|
18
|
-
schema_exports as schema
|
|
19
|
+
schema_exports as schema,
|
|
20
|
+
triggerPasswordReset
|
|
19
21
|
};
|
|
@@ -191,6 +191,17 @@ function getSessionToken(req) {
|
|
|
191
191
|
});
|
|
192
192
|
return cookies["better-auth.session_token"] || cookies["session_token"] || cookies["__Secure-better-auth.session_token"] || null;
|
|
193
193
|
}
|
|
194
|
+
async function triggerPasswordReset(auth, email) {
|
|
195
|
+
try {
|
|
196
|
+
await auth.api.forgetPassword({
|
|
197
|
+
body: { email }
|
|
198
|
+
});
|
|
199
|
+
return { success: true };
|
|
200
|
+
} catch (e) {
|
|
201
|
+
console.error("[triggerPasswordReset] Failed:", e);
|
|
202
|
+
return { success: false, error: e.message || "Failed to trigger password reset" };
|
|
203
|
+
}
|
|
204
|
+
}
|
|
194
205
|
|
|
195
206
|
// src/backend/index.ts
|
|
196
207
|
var createAuth = (config) => {
|
|
@@ -252,6 +263,7 @@ export {
|
|
|
252
263
|
schema_exports,
|
|
253
264
|
getInvitationLink,
|
|
254
265
|
getSessionToken,
|
|
266
|
+
triggerPasswordReset,
|
|
255
267
|
Hono,
|
|
256
268
|
createAuth,
|
|
257
269
|
authMiddleware,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, getSessionToken, schema } from './backend/index.js';
|
|
1
|
+
export { AuthConfig, authMiddleware, createAuth, createAuthApp, getInvitationLink, getSessionToken, schema, triggerPasswordReset } from './backend/index.js';
|
|
2
2
|
export { AuthForm, CreateOrganizationForm, InviteMemberForm, OrganizationSwitcher } from './frontend/index.js';
|
|
3
3
|
export { authClient, createClient } from './frontend/client.js';
|
|
4
4
|
export * from 'better-auth';
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
createAuthApp,
|
|
6
6
|
getInvitationLink,
|
|
7
7
|
getSessionToken,
|
|
8
|
-
schema_exports
|
|
9
|
-
|
|
8
|
+
schema_exports,
|
|
9
|
+
triggerPasswordReset
|
|
10
|
+
} from "./chunk-43OBL3NC.js";
|
|
10
11
|
import {
|
|
11
12
|
AuthForm,
|
|
12
13
|
CreateOrganizationForm,
|
|
@@ -31,5 +32,6 @@ export {
|
|
|
31
32
|
createClient,
|
|
32
33
|
getInvitationLink,
|
|
33
34
|
getSessionToken,
|
|
34
|
-
schema_exports as schema
|
|
35
|
+
schema_exports as schema,
|
|
36
|
+
triggerPasswordReset
|
|
35
37
|
};
|