strapi-plugin-firebase-authentication 1.1.11 → 1.1.12

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.
@@ -105,6 +105,13 @@ declare const _default: {
105
105
  type: string;
106
106
  private: boolean;
107
107
  };
108
+ resetTokenHash: {
109
+ type: string;
110
+ private: boolean;
111
+ };
112
+ resetTokenExpiresAt: {
113
+ type: string;
114
+ };
108
115
  };
109
116
  };
110
117
  };
@@ -34,5 +34,14 @@ declare const firebaseController: {
34
34
  */
35
35
  resetPassword(ctx: any): Promise<void>;
36
36
  requestMagicLink(ctx: Context): Promise<void>;
37
+ /**
38
+ * Reset password using custom JWT token
39
+ * POST /api/firebase-authentication/resetPasswordWithToken
40
+ * Public endpoint - token provides authentication
41
+ *
42
+ * @param ctx - Koa context with { token, newPassword } in body
43
+ * @returns { success: true, message: "Password has been reset successfully" }
44
+ */
45
+ resetPasswordWithToken(ctx: Context): Promise<void>;
37
46
  };
38
47
  export default firebaseController;
@@ -7,6 +7,7 @@ declare const _default: {
7
7
  forgotPassword(ctx: any): Promise<void>;
8
8
  resetPassword(ctx: any): Promise<void>;
9
9
  requestMagicLink(ctx: import("koa").Context): Promise<void>;
10
+ resetPasswordWithToken(ctx: import("koa").Context): Promise<void>;
10
11
  };
11
12
  userController: {
12
13
  list: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
@@ -28,6 +28,7 @@ declare const _default: {
28
28
  forgotPassword(ctx: any): Promise<void>;
29
29
  resetPassword(ctx: any): Promise<void>;
30
30
  requestMagicLink(ctx: import("koa").Context): Promise<void>;
31
+ resetPasswordWithToken(ctx: import("koa").Context): Promise<void>;
31
32
  };
32
33
  userController: {
33
34
  list: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
@@ -128,7 +129,15 @@ declare const _default: {
128
129
  deleteStrapiUser: (entityId: any) => Promise<any>;
129
130
  deleteMany: (entityIDs: any) => Promise<any>;
130
131
  setSocialMetaData(): Promise<void>;
131
- sendPasswordResetEmail: (entityId: any) => Promise<any>;
132
+ sendPasswordResetEmail: (entityId: string) => Promise<any>;
133
+ sendPasswordResetEmailByEmail: (email: string) => Promise<{
134
+ success: boolean;
135
+ message: string;
136
+ }>;
137
+ resetPasswordWithToken: (token: string, newPassword: string) => Promise<{
138
+ success: boolean;
139
+ message: string;
140
+ }>;
132
141
  };
133
142
  firebaseService: ({ strapi }: {
134
143
  strapi: any;
@@ -198,6 +207,10 @@ declare const _default: {
198
207
  success: boolean;
199
208
  message: string;
200
209
  }>;
210
+ sendPasswordChangedEmail(user: any): Promise<{
211
+ success: boolean;
212
+ message: string;
213
+ }>;
201
214
  };
202
215
  firebaseUserDataService: ({ strapi }: {
203
216
  strapi: any;
@@ -218,6 +231,13 @@ declare const _default: {
218
231
  buildUserMap(): Promise<Map<any, any>>;
219
232
  linkFirebaseUsers(firebaseUsers: any[], uidToUserMap: Map<string, any>, allStrapiUsers: any[]): any[];
220
233
  };
234
+ tokenService: ({ strapi }: {
235
+ strapi: any;
236
+ }) => {
237
+ generateResetToken(firebaseUserDataDocumentId: string): Promise<string>;
238
+ validateResetToken(token: string): Promise<import("./services/tokenService").TokenValidationResult>;
239
+ invalidateResetToken(firebaseUserDataDocumentId: string): Promise<void>;
240
+ };
221
241
  };
222
242
  contentTypes: {
223
243
  "firebase-authentication-configuration": {
@@ -326,6 +346,13 @@ declare const _default: {
326
346
  type: string;
327
347
  private: boolean;
328
348
  };
349
+ resetTokenHash: {
350
+ type: string;
351
+ private: boolean;
352
+ };
353
+ resetTokenExpiresAt: {
354
+ type: string;
355
+ };
329
356
  };
330
357
  };
331
358
  };
@@ -25,6 +25,15 @@ declare class EmailService {
25
25
  success: boolean;
26
26
  message: string;
27
27
  }>;
28
+ /**
29
+ * Send password changed confirmation email
30
+ * Notifies user that their password was successfully changed
31
+ * Uses same three-tier fallback system
32
+ */
33
+ sendPasswordChangedEmail(user: any): Promise<{
34
+ success: boolean;
35
+ message: string;
36
+ }>;
28
37
  }
29
38
  declare const _default: ({ strapi }: {
30
39
  strapi: any;
@@ -65,8 +65,9 @@ declare const _default: ({ strapi }: {
65
65
  jwt: any;
66
66
  }>;
67
67
  /**
68
- * Forgot password flow - sends reset email
69
- * Public endpoint that sends a Firebase-hosted password reset email using Firebase's secure hosted UI
68
+ * Forgot password flow - sends reset email with custom JWT token
69
+ * Public endpoint that sends a password reset email with a custom token
70
+ * The token links to your frontend app, not Firebase's hosted UI
70
71
  */
71
72
  forgotPassword: (email: string) => Promise<{
72
73
  message: string;
@@ -51,7 +51,15 @@ declare const _default: {
51
51
  deleteStrapiUser: (entityId: any) => Promise<any>;
52
52
  deleteMany: (entityIDs: any) => Promise<any>;
53
53
  setSocialMetaData(): Promise<void>;
54
- sendPasswordResetEmail: (entityId: any) => Promise<any>;
54
+ sendPasswordResetEmail: (entityId: string) => Promise<any>;
55
+ sendPasswordResetEmailByEmail: (email: string) => Promise<{
56
+ success: boolean;
57
+ message: string;
58
+ }>;
59
+ resetPasswordWithToken: (token: string, newPassword: string) => Promise<{
60
+ success: boolean;
61
+ message: string;
62
+ }>;
55
63
  };
56
64
  firebaseService: ({ strapi }: {
57
65
  strapi: any;
@@ -121,6 +129,10 @@ declare const _default: {
121
129
  success: boolean;
122
130
  message: string;
123
131
  }>;
132
+ sendPasswordChangedEmail(user: any): Promise<{
133
+ success: boolean;
134
+ message: string;
135
+ }>;
124
136
  };
125
137
  firebaseUserDataService: ({ strapi }: {
126
138
  strapi: any;
@@ -141,5 +153,12 @@ declare const _default: {
141
153
  buildUserMap(): Promise<Map<any, any>>;
142
154
  linkFirebaseUsers(firebaseUsers: any[], uidToUserMap: Map<string, any>, allStrapiUsers: any[]): any[];
143
155
  };
156
+ tokenService: ({ strapi }: {
157
+ strapi: any;
158
+ }) => {
159
+ generateResetToken(firebaseUserDataDocumentId: string): Promise<string>;
160
+ validateResetToken(token: string): Promise<import("./tokenService").TokenValidationResult>;
161
+ invalidateResetToken(firebaseUserDataDocumentId: string): Promise<void>;
162
+ };
144
163
  };
145
164
  export default _default;
@@ -0,0 +1,28 @@
1
+ export interface TokenValidationResult {
2
+ valid: boolean;
3
+ firebaseUserDataDocumentId: string;
4
+ firebaseUID: string;
5
+ error?: string;
6
+ }
7
+ declare const _default: ({ strapi }: {
8
+ strapi: any;
9
+ }) => {
10
+ /**
11
+ * Generate a password reset token for a user
12
+ * @param firebaseUserDataDocumentId - The documentId of the firebase-user-data record
13
+ * @returns The JWT token to include in the reset URL
14
+ */
15
+ generateResetToken(firebaseUserDataDocumentId: string): Promise<string>;
16
+ /**
17
+ * Validate a password reset token
18
+ * @param token - The JWT token from the reset URL
19
+ * @returns Validation result with user info if valid
20
+ */
21
+ validateResetToken(token: string): Promise<TokenValidationResult>;
22
+ /**
23
+ * Invalidate a reset token after use
24
+ * @param firebaseUserDataDocumentId - The documentId of the firebase-user-data record
25
+ */
26
+ invalidateResetToken(firebaseUserDataDocumentId: string): Promise<void>;
27
+ };
28
+ export default _default;
@@ -21,6 +21,27 @@ declare const _default: ({ strapi }: {
21
21
  deleteStrapiUser: (entityId: any) => Promise<any>;
22
22
  deleteMany: (entityIDs: any) => Promise<any>;
23
23
  setSocialMetaData(): Promise<void>;
24
- sendPasswordResetEmail: (entityId: any) => Promise<any>;
24
+ /**
25
+ * Send password reset email with custom JWT token
26
+ * @param entityId - Firebase UID of the user
27
+ */
28
+ sendPasswordResetEmail: (entityId: string) => Promise<any>;
29
+ /**
30
+ * Send password reset email by email address (for public self-service)
31
+ * @param email - Email address of the user
32
+ */
33
+ sendPasswordResetEmailByEmail: (email: string) => Promise<{
34
+ success: boolean;
35
+ message: string;
36
+ }>;
37
+ /**
38
+ * Reset password using a custom JWT token
39
+ * @param token - The JWT token from the reset URL
40
+ * @param newPassword - The new password
41
+ */
42
+ resetPasswordWithToken: (token: string, newPassword: string) => Promise<{
43
+ success: boolean;
44
+ message: string;
45
+ }>;
25
46
  };
26
47
  export default _default;
@@ -1,2 +1,3 @@
1
1
  export { passwordResetTemplate } from "./password-reset";
2
2
  export { magicLinkTemplate } from "./magic-link";
3
+ export { passwordChangedTemplate } from "./password-changed";
@@ -0,0 +1,2 @@
1
+ import { EmailTemplate } from "../types";
2
+ export declare const passwordChangedTemplate: EmailTemplate;
@@ -8,6 +8,7 @@ export interface EmailTemplate {
8
8
  export interface EmailTemplateConfig {
9
9
  passwordReset?: Partial<EmailTemplate>;
10
10
  magicLink?: Partial<EmailTemplate>;
11
+ passwordChanged?: Partial<EmailTemplate>;
11
12
  }
12
13
  export interface TemplateVariables {
13
14
  user: {
@@ -21,10 +22,11 @@ export interface TemplateVariables {
21
22
  link?: string;
22
23
  resetLink?: string;
23
24
  magicLink?: string;
25
+ changedAt?: string;
24
26
  appName: string;
25
27
  appUrl: string;
26
- expiresIn: string;
28
+ expiresIn?: string;
27
29
  year: number;
28
30
  supportEmail?: string;
29
31
  }
30
- export type TemplateType = "passwordReset" | "magicLink";
32
+ export type TemplateType = "passwordReset" | "magicLink" | "passwordChanged";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-firebase-authentication",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "Allows easy integration between clients utilizing Firebase for authentication and Strapi",
5
5
  "license": "MIT",
6
6
  "repository": {