strapi-plugin-firebase-authentication 1.1.11 → 1.2.0

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.
Files changed (33) hide show
  1. package/dist/_chunks/{App-DZQe17x8.js → App-B7d4qS3T.js} +203 -141
  2. package/dist/_chunks/{App-BY1gNGKH.mjs → App-CQ9ehArz.mjs} +112 -29
  3. package/dist/_chunks/{api-D_4cdJU5.mjs → api-BM2UtpvM.mjs} +1 -1
  4. package/dist/_chunks/{api-DR4wmAFN.js → api-DYP-1kdx.js} +1 -1
  5. package/dist/_chunks/{index-D8pv1Q6h.mjs → index-0tTyhxbb.mjs} +148 -34
  6. package/dist/_chunks/{index-BnT1fFPr.js → index-B5EwGI_y.js} +2 -2
  7. package/dist/_chunks/{index-DtGfwf9S.mjs → index-CMFutRyI.mjs} +2 -2
  8. package/dist/_chunks/{index-dVTLVmwU.js → index-Cwp9xkG4.js} +148 -34
  9. package/dist/admin/index.js +1 -1
  10. package/dist/admin/index.mjs +1 -1
  11. package/dist/admin/src/components/user-management/ResendVerification/ResendVerification.d.ts +9 -0
  12. package/dist/admin/src/components/user-management/index.d.ts +1 -0
  13. package/dist/admin/src/pages/Settings/api.d.ts +4 -0
  14. package/dist/admin/src/pages/utils/api.d.ts +2 -1
  15. package/dist/server/index.js +6447 -2301
  16. package/dist/server/index.mjs +6444 -2298
  17. package/dist/server/src/config/index.d.ts +1 -1
  18. package/dist/server/src/content-types/index.d.ts +23 -0
  19. package/dist/server/src/controllers/firebaseController.d.ts +24 -0
  20. package/dist/server/src/controllers/index.d.ts +4 -0
  21. package/dist/server/src/controllers/userController.d.ts +1 -0
  22. package/dist/server/src/index.d.ts +65 -2
  23. package/dist/server/src/services/emailService.d.ts +19 -0
  24. package/dist/server/src/services/firebaseService.d.ts +19 -2
  25. package/dist/server/src/services/index.d.ts +37 -1
  26. package/dist/server/src/services/settingsService.d.ts +2 -0
  27. package/dist/server/src/services/tokenService.d.ts +49 -0
  28. package/dist/server/src/services/userService.d.ts +27 -1
  29. package/dist/server/src/templates/defaults/email-verification.d.ts +2 -0
  30. package/dist/server/src/templates/defaults/index.d.ts +2 -0
  31. package/dist/server/src/templates/defaults/password-changed.d.ts +2 -0
  32. package/dist/server/src/templates/types.d.ts +6 -2
  33. package/package.json +1 -1
@@ -47,7 +47,7 @@ declare const _default: {
47
47
  env: any;
48
48
  }) => {
49
49
  firebaseJsonEncryptionKey: any;
50
- emailRequired: boolean;
50
+ emailRequired: any;
51
51
  emailPattern: string;
52
52
  };
53
53
  validator(config: FirebaseAuthConfig): void;
@@ -66,6 +66,15 @@ declare const _default: {
66
66
  maximum: number;
67
67
  description: string;
68
68
  };
69
+ emailVerificationUrl: {
70
+ type: string;
71
+ default: string;
72
+ description: string;
73
+ };
74
+ emailVerificationEmailSubject: {
75
+ type: string;
76
+ default: string;
77
+ };
69
78
  };
70
79
  };
71
80
  };
@@ -105,6 +114,20 @@ declare const _default: {
105
114
  type: string;
106
115
  private: boolean;
107
116
  };
117
+ resetTokenHash: {
118
+ type: string;
119
+ private: boolean;
120
+ };
121
+ resetTokenExpiresAt: {
122
+ type: string;
123
+ };
124
+ verificationTokenHash: {
125
+ type: string;
126
+ private: boolean;
127
+ };
128
+ verificationTokenExpiresAt: {
129
+ type: string;
130
+ };
108
131
  };
109
132
  };
110
133
  };
@@ -34,5 +34,29 @@ 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>;
46
+ /**
47
+ * Send email verification - public endpoint
48
+ * POST /api/firebase-authentication/sendVerificationEmail
49
+ * Public endpoint - no authentication required
50
+ */
51
+ sendVerificationEmail(ctx: Context): Promise<void>;
52
+ /**
53
+ * Verify email using custom JWT token
54
+ * POST /api/firebase-authentication/verifyEmail
55
+ * Public endpoint - token provides authentication
56
+ *
57
+ * @param ctx - Koa context with { token } in body
58
+ * @returns { success: true, message: "Email verified successfully" }
59
+ */
60
+ verifyEmail(ctx: Context): Promise<void>;
37
61
  };
38
62
  export default firebaseController;
@@ -7,6 +7,9 @@ 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>;
11
+ sendVerificationEmail(ctx: import("koa").Context): Promise<void>;
12
+ verifyEmail(ctx: import("koa").Context): Promise<void>;
10
13
  };
11
14
  userController: {
12
15
  list: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
@@ -17,6 +20,7 @@ declare const _default: {
17
20
  deleteMany: (ctx: any) => Promise<void>;
18
21
  resetPassword: (ctx: any) => Promise<void>;
19
22
  sendResetEmail: (ctx: any) => Promise<void>;
23
+ sendVerificationEmail: (ctx: any) => Promise<void>;
20
24
  };
21
25
  settingsController: {
22
26
  setFirebaseConfigJson: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
@@ -8,5 +8,6 @@ declare const _default: {
8
8
  deleteMany: (ctx: any) => Promise<void>;
9
9
  resetPassword: (ctx: any) => Promise<void>;
10
10
  sendResetEmail: (ctx: any) => Promise<void>;
11
+ sendVerificationEmail: (ctx: any) => Promise<void>;
11
12
  };
12
13
  export default _default;
@@ -14,7 +14,7 @@ declare const _default: {
14
14
  env: any;
15
15
  }) => {
16
16
  firebaseJsonEncryptionKey: any;
17
- emailRequired: boolean;
17
+ emailRequired: any;
18
18
  emailPattern: string;
19
19
  };
20
20
  validator(config: import("./config").FirebaseAuthConfig): void;
@@ -28,6 +28,9 @@ 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>;
32
+ sendVerificationEmail(ctx: import("koa").Context): Promise<void>;
33
+ verifyEmail(ctx: import("koa").Context): Promise<void>;
31
34
  };
32
35
  userController: {
33
36
  list: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
@@ -38,6 +41,7 @@ declare const _default: {
38
41
  deleteMany: (ctx: any) => Promise<void>;
39
42
  resetPassword: (ctx: any) => Promise<void>;
40
43
  sendResetEmail: (ctx: any) => Promise<void>;
44
+ sendVerificationEmail: (ctx: any) => Promise<void>;
41
45
  };
42
46
  settingsController: {
43
47
  setFirebaseConfigJson: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
@@ -92,6 +96,8 @@ declare const _default: {
92
96
  magicLinkUrl: any;
93
97
  magicLinkEmailSubject: any;
94
98
  magicLinkExpiryHours: any;
99
+ emailVerificationUrl: any;
100
+ emailVerificationEmailSubject: any;
95
101
  }>;
96
102
  setFirebaseConfigJson(requestBody: any): Promise<any>;
97
103
  delFirebaseConfigJson: () => Promise<any>;
@@ -128,7 +134,16 @@ declare const _default: {
128
134
  deleteStrapiUser: (entityId: any) => Promise<any>;
129
135
  deleteMany: (entityIDs: any) => Promise<any>;
130
136
  setSocialMetaData(): Promise<void>;
131
- sendPasswordResetEmail: (entityId: any) => Promise<any>;
137
+ sendPasswordResetEmail: (entityId: string) => Promise<any>;
138
+ sendPasswordResetEmailByEmail: (email: string) => Promise<{
139
+ success: boolean;
140
+ message: string;
141
+ }>;
142
+ resetPasswordWithToken: (token: string, newPassword: string) => Promise<{
143
+ success: boolean;
144
+ message: string;
145
+ }>;
146
+ sendVerificationEmail: (entityId: string) => Promise<any>;
132
147
  };
133
148
  firebaseService: ({ strapi }: {
134
149
  strapi: any;
@@ -178,6 +193,13 @@ declare const _default: {
178
193
  requiresFrontend: boolean;
179
194
  verificationUrl: any;
180
195
  }>;
196
+ sendVerificationEmail(email: string): Promise<{
197
+ message: string;
198
+ }>;
199
+ verifyEmail(token: string): Promise<{
200
+ success: boolean;
201
+ message: string;
202
+ }>;
181
203
  };
182
204
  templateService: ({ strapi }: {
183
205
  strapi: any;
@@ -198,6 +220,14 @@ declare const _default: {
198
220
  success: boolean;
199
221
  message: string;
200
222
  }>;
223
+ sendPasswordChangedEmail(user: any): Promise<{
224
+ success: boolean;
225
+ message: string;
226
+ }>;
227
+ sendVerificationEmail(user: any, verificationLink: string): Promise<{
228
+ success: boolean;
229
+ message: string;
230
+ }>;
201
231
  };
202
232
  firebaseUserDataService: ({ strapi }: {
203
233
  strapi: any;
@@ -218,6 +248,16 @@ declare const _default: {
218
248
  buildUserMap(): Promise<Map<any, any>>;
219
249
  linkFirebaseUsers(firebaseUsers: any[], uidToUserMap: Map<string, any>, allStrapiUsers: any[]): any[];
220
250
  };
251
+ tokenService: ({ strapi }: {
252
+ strapi: any;
253
+ }) => {
254
+ generateResetToken(firebaseUserDataDocumentId: string): Promise<string>;
255
+ validateResetToken(token: string): Promise<import("./services/tokenService").TokenValidationResult>;
256
+ invalidateResetToken(firebaseUserDataDocumentId: string): Promise<void>;
257
+ generateVerificationToken(firebaseUserDataDocumentId: string, email: string): Promise<string>;
258
+ validateVerificationToken(token: string): Promise<import("./services/tokenService").VerificationTokenValidationResult>;
259
+ invalidateVerificationToken(firebaseUserDataDocumentId: string): Promise<void>;
260
+ };
221
261
  };
222
262
  contentTypes: {
223
263
  "firebase-authentication-configuration": {
@@ -287,6 +327,15 @@ declare const _default: {
287
327
  maximum: number;
288
328
  description: string;
289
329
  };
330
+ emailVerificationUrl: {
331
+ type: string;
332
+ default: string;
333
+ description: string;
334
+ };
335
+ emailVerificationEmailSubject: {
336
+ type: string;
337
+ default: string;
338
+ };
290
339
  };
291
340
  };
292
341
  };
@@ -326,6 +375,20 @@ declare const _default: {
326
375
  type: string;
327
376
  private: boolean;
328
377
  };
378
+ resetTokenHash: {
379
+ type: string;
380
+ private: boolean;
381
+ };
382
+ resetTokenExpiresAt: {
383
+ type: string;
384
+ };
385
+ verificationTokenHash: {
386
+ type: string;
387
+ private: boolean;
388
+ };
389
+ verificationTokenExpiresAt: {
390
+ type: string;
391
+ };
329
392
  };
330
393
  };
331
394
  };
@@ -25,6 +25,25 @@ 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
+ }>;
37
+ /**
38
+ * Send email verification email with three-tier fallback system
39
+ * Tier 1: Strapi Email Plugin (if configured)
40
+ * Tier 2: Custom Hook Function (if provided in config)
41
+ * Tier 3: Development Console Logging (dev mode only)
42
+ */
43
+ sendVerificationEmail(user: any, verificationLink: string): Promise<{
44
+ success: boolean;
45
+ message: string;
46
+ }>;
28
47
  }
29
48
  declare const _default: ({ strapi }: {
30
49
  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;
@@ -110,5 +111,21 @@ declare const _default: ({ strapi }: {
110
111
  requiresFrontend: boolean;
111
112
  verificationUrl: any;
112
113
  }>;
114
+ /**
115
+ * Send email verification - public endpoint
116
+ * Generates a verification token and sends an email to the user
117
+ * Security: Always returns generic success message to prevent email enumeration
118
+ */
119
+ sendVerificationEmail(email: string): Promise<{
120
+ message: string;
121
+ }>;
122
+ /**
123
+ * Verify email with token - public endpoint
124
+ * Validates the token and marks the user's email as verified in Firebase
125
+ */
126
+ verifyEmail(token: string): Promise<{
127
+ success: boolean;
128
+ message: string;
129
+ }>;
113
130
  };
114
131
  export default _default;
@@ -15,6 +15,8 @@ declare const _default: {
15
15
  magicLinkUrl: any;
16
16
  magicLinkEmailSubject: any;
17
17
  magicLinkExpiryHours: any;
18
+ emailVerificationUrl: any;
19
+ emailVerificationEmailSubject: any;
18
20
  }>;
19
21
  setFirebaseConfigJson(requestBody: any): Promise<any>;
20
22
  delFirebaseConfigJson: () => Promise<any>;
@@ -51,7 +53,16 @@ declare const _default: {
51
53
  deleteStrapiUser: (entityId: any) => Promise<any>;
52
54
  deleteMany: (entityIDs: any) => Promise<any>;
53
55
  setSocialMetaData(): Promise<void>;
54
- sendPasswordResetEmail: (entityId: any) => Promise<any>;
56
+ sendPasswordResetEmail: (entityId: string) => Promise<any>;
57
+ sendPasswordResetEmailByEmail: (email: string) => Promise<{
58
+ success: boolean;
59
+ message: string;
60
+ }>;
61
+ resetPasswordWithToken: (token: string, newPassword: string) => Promise<{
62
+ success: boolean;
63
+ message: string;
64
+ }>;
65
+ sendVerificationEmail: (entityId: string) => Promise<any>;
55
66
  };
56
67
  firebaseService: ({ strapi }: {
57
68
  strapi: any;
@@ -101,6 +112,13 @@ declare const _default: {
101
112
  requiresFrontend: boolean;
102
113
  verificationUrl: any;
103
114
  }>;
115
+ sendVerificationEmail(email: string): Promise<{
116
+ message: string;
117
+ }>;
118
+ verifyEmail(token: string): Promise<{
119
+ success: boolean;
120
+ message: string;
121
+ }>;
104
122
  };
105
123
  templateService: ({ strapi }: {
106
124
  strapi: any;
@@ -121,6 +139,14 @@ declare const _default: {
121
139
  success: boolean;
122
140
  message: string;
123
141
  }>;
142
+ sendPasswordChangedEmail(user: any): Promise<{
143
+ success: boolean;
144
+ message: string;
145
+ }>;
146
+ sendVerificationEmail(user: any, verificationLink: string): Promise<{
147
+ success: boolean;
148
+ message: string;
149
+ }>;
124
150
  };
125
151
  firebaseUserDataService: ({ strapi }: {
126
152
  strapi: any;
@@ -141,5 +167,15 @@ declare const _default: {
141
167
  buildUserMap(): Promise<Map<any, any>>;
142
168
  linkFirebaseUsers(firebaseUsers: any[], uidToUserMap: Map<string, any>, allStrapiUsers: any[]): any[];
143
169
  };
170
+ tokenService: ({ strapi }: {
171
+ strapi: any;
172
+ }) => {
173
+ generateResetToken(firebaseUserDataDocumentId: string): Promise<string>;
174
+ validateResetToken(token: string): Promise<import("./tokenService").TokenValidationResult>;
175
+ invalidateResetToken(firebaseUserDataDocumentId: string): Promise<void>;
176
+ generateVerificationToken(firebaseUserDataDocumentId: string, email: string): Promise<string>;
177
+ validateVerificationToken(token: string): Promise<import("./tokenService").VerificationTokenValidationResult>;
178
+ invalidateVerificationToken(firebaseUserDataDocumentId: string): Promise<void>;
179
+ };
144
180
  };
145
181
  export default _default;
@@ -29,6 +29,8 @@ declare const _default: ({ strapi }: {
29
29
  magicLinkUrl: any;
30
30
  magicLinkEmailSubject: any;
31
31
  magicLinkExpiryHours: any;
32
+ emailVerificationUrl: any;
33
+ emailVerificationEmailSubject: any;
32
34
  }>;
33
35
  /**
34
36
  * Stores and encrypts Firebase configuration including Web API key and password reset settings
@@ -0,0 +1,49 @@
1
+ export interface TokenValidationResult {
2
+ valid: boolean;
3
+ firebaseUserDataDocumentId: string;
4
+ firebaseUID: string;
5
+ error?: string;
6
+ }
7
+ export interface VerificationTokenValidationResult extends TokenValidationResult {
8
+ email?: string;
9
+ }
10
+ declare const _default: ({ strapi }: {
11
+ strapi: any;
12
+ }) => {
13
+ /**
14
+ * Generate a password reset token for a user
15
+ * @param firebaseUserDataDocumentId - The documentId of the firebase-user-data record
16
+ * @returns The JWT token to include in the reset URL
17
+ */
18
+ generateResetToken(firebaseUserDataDocumentId: string): Promise<string>;
19
+ /**
20
+ * Validate a password reset token
21
+ * @param token - The JWT token from the reset URL
22
+ * @returns Validation result with user info if valid
23
+ */
24
+ validateResetToken(token: string): Promise<TokenValidationResult>;
25
+ /**
26
+ * Invalidate a reset token after use
27
+ * @param firebaseUserDataDocumentId - The documentId of the firebase-user-data record
28
+ */
29
+ invalidateResetToken(firebaseUserDataDocumentId: string): Promise<void>;
30
+ /**
31
+ * Generate an email verification token for a user
32
+ * @param firebaseUserDataDocumentId - The documentId of the firebase-user-data record
33
+ * @param email - The email address at time of request (for change detection)
34
+ * @returns The JWT token to include in the verification URL
35
+ */
36
+ generateVerificationToken(firebaseUserDataDocumentId: string, email: string): Promise<string>;
37
+ /**
38
+ * Validate an email verification token
39
+ * @param token - The JWT token from the verification URL
40
+ * @returns Validation result with user info and email if valid
41
+ */
42
+ validateVerificationToken(token: string): Promise<VerificationTokenValidationResult>;
43
+ /**
44
+ * Invalidate a verification token after use
45
+ * @param firebaseUserDataDocumentId - The documentId of the firebase-user-data record
46
+ */
47
+ invalidateVerificationToken(firebaseUserDataDocumentId: string): Promise<void>;
48
+ };
49
+ export default _default;
@@ -21,6 +21,32 @@ 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
+ }>;
46
+ /**
47
+ * Send email verification email (admin-initiated)
48
+ * @param entityId - Firebase UID of the user
49
+ */
50
+ sendVerificationEmail: (entityId: string) => Promise<any>;
25
51
  };
26
52
  export default _default;
@@ -0,0 +1,2 @@
1
+ import { EmailTemplate } from "../types";
2
+ export declare const emailVerificationTemplate: EmailTemplate;
@@ -1,2 +1,4 @@
1
1
  export { passwordResetTemplate } from "./password-reset";
2
2
  export { magicLinkTemplate } from "./magic-link";
3
+ export { passwordChangedTemplate } from "./password-changed";
4
+ export { emailVerificationTemplate } from "./email-verification";
@@ -0,0 +1,2 @@
1
+ import { EmailTemplate } from "../types";
2
+ export declare const passwordChangedTemplate: EmailTemplate;
@@ -8,6 +8,8 @@ export interface EmailTemplate {
8
8
  export interface EmailTemplateConfig {
9
9
  passwordReset?: Partial<EmailTemplate>;
10
10
  magicLink?: Partial<EmailTemplate>;
11
+ passwordChanged?: Partial<EmailTemplate>;
12
+ emailVerification?: Partial<EmailTemplate>;
11
13
  }
12
14
  export interface TemplateVariables {
13
15
  user: {
@@ -21,10 +23,12 @@ export interface TemplateVariables {
21
23
  link?: string;
22
24
  resetLink?: string;
23
25
  magicLink?: string;
26
+ verificationLink?: string;
27
+ changedAt?: string;
24
28
  appName: string;
25
29
  appUrl: string;
26
- expiresIn: string;
30
+ expiresIn?: string;
27
31
  year: number;
28
32
  supportEmail?: string;
29
33
  }
30
- export type TemplateType = "passwordReset" | "magicLink";
34
+ export type TemplateType = "passwordReset" | "magicLink" | "passwordChanged" | "emailVerification";
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.2.0",
4
4
  "description": "Allows easy integration between clients utilizing Firebase for authentication and Strapi",
5
5
  "license": "MIT",
6
6
  "repository": {