strapi-plugin-firebase-authentication 1.1.12 → 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.
- package/dist/_chunks/{App-BqjE8BHb.js → App-B7d4qS3T.js} +112 -29
- package/dist/_chunks/{App-BY1gNGKH.mjs → App-CQ9ehArz.mjs} +112 -29
- package/dist/_chunks/{api-D_4cdJU5.mjs → api-BM2UtpvM.mjs} +1 -1
- package/dist/_chunks/{api-DQCdqlCd.js → api-DYP-1kdx.js} +1 -1
- package/dist/_chunks/{index-D8pv1Q6h.mjs → index-0tTyhxbb.mjs} +148 -34
- package/dist/_chunks/{index-DlPxMuSK.js → index-B5EwGI_y.js} +2 -2
- package/dist/_chunks/{index-DtGfwf9S.mjs → index-CMFutRyI.mjs} +2 -2
- package/dist/_chunks/{index-C4t4JZZ_.js → index-Cwp9xkG4.js} +148 -34
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/user-management/ResendVerification/ResendVerification.d.ts +9 -0
- package/dist/admin/src/components/user-management/index.d.ts +1 -0
- package/dist/admin/src/pages/Settings/api.d.ts +4 -0
- package/dist/admin/src/pages/utils/api.d.ts +2 -1
- package/dist/server/index.js +691 -10
- package/dist/server/index.mjs +691 -10
- package/dist/server/src/config/index.d.ts +1 -1
- package/dist/server/src/content-types/index.d.ts +16 -0
- package/dist/server/src/controllers/firebaseController.d.ts +15 -0
- package/dist/server/src/controllers/index.d.ts +3 -0
- package/dist/server/src/controllers/userController.d.ts +1 -0
- package/dist/server/src/index.d.ts +37 -1
- package/dist/server/src/services/emailService.d.ts +10 -0
- package/dist/server/src/services/firebaseService.d.ts +16 -0
- package/dist/server/src/services/index.d.ts +17 -0
- package/dist/server/src/services/settingsService.d.ts +2 -0
- package/dist/server/src/services/tokenService.d.ts +21 -0
- package/dist/server/src/services/userService.d.ts +5 -0
- package/dist/server/src/templates/defaults/email-verification.d.ts +2 -0
- package/dist/server/src/templates/defaults/index.d.ts +1 -0
- package/dist/server/src/templates/types.d.ts +3 -1
- package/package.json +1 -1
|
@@ -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
|
};
|
|
@@ -112,6 +121,13 @@ declare const _default: {
|
|
|
112
121
|
resetTokenExpiresAt: {
|
|
113
122
|
type: string;
|
|
114
123
|
};
|
|
124
|
+
verificationTokenHash: {
|
|
125
|
+
type: string;
|
|
126
|
+
private: boolean;
|
|
127
|
+
};
|
|
128
|
+
verificationTokenExpiresAt: {
|
|
129
|
+
type: string;
|
|
130
|
+
};
|
|
115
131
|
};
|
|
116
132
|
};
|
|
117
133
|
};
|
|
@@ -43,5 +43,20 @@ declare const firebaseController: {
|
|
|
43
43
|
* @returns { success: true, message: "Password has been reset successfully" }
|
|
44
44
|
*/
|
|
45
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>;
|
|
46
61
|
};
|
|
47
62
|
export default firebaseController;
|
|
@@ -8,6 +8,8 @@ declare const _default: {
|
|
|
8
8
|
resetPassword(ctx: any): Promise<void>;
|
|
9
9
|
requestMagicLink(ctx: import("koa").Context): Promise<void>;
|
|
10
10
|
resetPasswordWithToken(ctx: import("koa").Context): Promise<void>;
|
|
11
|
+
sendVerificationEmail(ctx: import("koa").Context): Promise<void>;
|
|
12
|
+
verifyEmail(ctx: import("koa").Context): Promise<void>;
|
|
11
13
|
};
|
|
12
14
|
userController: {
|
|
13
15
|
list: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
|
|
@@ -18,6 +20,7 @@ declare const _default: {
|
|
|
18
20
|
deleteMany: (ctx: any) => Promise<void>;
|
|
19
21
|
resetPassword: (ctx: any) => Promise<void>;
|
|
20
22
|
sendResetEmail: (ctx: any) => Promise<void>;
|
|
23
|
+
sendVerificationEmail: (ctx: any) => Promise<void>;
|
|
21
24
|
};
|
|
22
25
|
settingsController: {
|
|
23
26
|
setFirebaseConfigJson: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
|
|
@@ -14,7 +14,7 @@ declare const _default: {
|
|
|
14
14
|
env: any;
|
|
15
15
|
}) => {
|
|
16
16
|
firebaseJsonEncryptionKey: any;
|
|
17
|
-
emailRequired:
|
|
17
|
+
emailRequired: any;
|
|
18
18
|
emailPattern: string;
|
|
19
19
|
};
|
|
20
20
|
validator(config: import("./config").FirebaseAuthConfig): void;
|
|
@@ -29,6 +29,8 @@ declare const _default: {
|
|
|
29
29
|
resetPassword(ctx: any): Promise<void>;
|
|
30
30
|
requestMagicLink(ctx: import("koa").Context): Promise<void>;
|
|
31
31
|
resetPasswordWithToken(ctx: import("koa").Context): Promise<void>;
|
|
32
|
+
sendVerificationEmail(ctx: import("koa").Context): Promise<void>;
|
|
33
|
+
verifyEmail(ctx: import("koa").Context): Promise<void>;
|
|
32
34
|
};
|
|
33
35
|
userController: {
|
|
34
36
|
list: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
|
|
@@ -39,6 +41,7 @@ declare const _default: {
|
|
|
39
41
|
deleteMany: (ctx: any) => Promise<void>;
|
|
40
42
|
resetPassword: (ctx: any) => Promise<void>;
|
|
41
43
|
sendResetEmail: (ctx: any) => Promise<void>;
|
|
44
|
+
sendVerificationEmail: (ctx: any) => Promise<void>;
|
|
42
45
|
};
|
|
43
46
|
settingsController: {
|
|
44
47
|
setFirebaseConfigJson: (ctx: import("koa").Context | import("koa").DefaultContext) => Promise<void>;
|
|
@@ -93,6 +96,8 @@ declare const _default: {
|
|
|
93
96
|
magicLinkUrl: any;
|
|
94
97
|
magicLinkEmailSubject: any;
|
|
95
98
|
magicLinkExpiryHours: any;
|
|
99
|
+
emailVerificationUrl: any;
|
|
100
|
+
emailVerificationEmailSubject: any;
|
|
96
101
|
}>;
|
|
97
102
|
setFirebaseConfigJson(requestBody: any): Promise<any>;
|
|
98
103
|
delFirebaseConfigJson: () => Promise<any>;
|
|
@@ -138,6 +143,7 @@ declare const _default: {
|
|
|
138
143
|
success: boolean;
|
|
139
144
|
message: string;
|
|
140
145
|
}>;
|
|
146
|
+
sendVerificationEmail: (entityId: string) => Promise<any>;
|
|
141
147
|
};
|
|
142
148
|
firebaseService: ({ strapi }: {
|
|
143
149
|
strapi: any;
|
|
@@ -187,6 +193,13 @@ declare const _default: {
|
|
|
187
193
|
requiresFrontend: boolean;
|
|
188
194
|
verificationUrl: any;
|
|
189
195
|
}>;
|
|
196
|
+
sendVerificationEmail(email: string): Promise<{
|
|
197
|
+
message: string;
|
|
198
|
+
}>;
|
|
199
|
+
verifyEmail(token: string): Promise<{
|
|
200
|
+
success: boolean;
|
|
201
|
+
message: string;
|
|
202
|
+
}>;
|
|
190
203
|
};
|
|
191
204
|
templateService: ({ strapi }: {
|
|
192
205
|
strapi: any;
|
|
@@ -211,6 +224,10 @@ declare const _default: {
|
|
|
211
224
|
success: boolean;
|
|
212
225
|
message: string;
|
|
213
226
|
}>;
|
|
227
|
+
sendVerificationEmail(user: any, verificationLink: string): Promise<{
|
|
228
|
+
success: boolean;
|
|
229
|
+
message: string;
|
|
230
|
+
}>;
|
|
214
231
|
};
|
|
215
232
|
firebaseUserDataService: ({ strapi }: {
|
|
216
233
|
strapi: any;
|
|
@@ -237,6 +254,9 @@ declare const _default: {
|
|
|
237
254
|
generateResetToken(firebaseUserDataDocumentId: string): Promise<string>;
|
|
238
255
|
validateResetToken(token: string): Promise<import("./services/tokenService").TokenValidationResult>;
|
|
239
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>;
|
|
240
260
|
};
|
|
241
261
|
};
|
|
242
262
|
contentTypes: {
|
|
@@ -307,6 +327,15 @@ declare const _default: {
|
|
|
307
327
|
maximum: number;
|
|
308
328
|
description: string;
|
|
309
329
|
};
|
|
330
|
+
emailVerificationUrl: {
|
|
331
|
+
type: string;
|
|
332
|
+
default: string;
|
|
333
|
+
description: string;
|
|
334
|
+
};
|
|
335
|
+
emailVerificationEmailSubject: {
|
|
336
|
+
type: string;
|
|
337
|
+
default: string;
|
|
338
|
+
};
|
|
310
339
|
};
|
|
311
340
|
};
|
|
312
341
|
};
|
|
@@ -353,6 +382,13 @@ declare const _default: {
|
|
|
353
382
|
resetTokenExpiresAt: {
|
|
354
383
|
type: string;
|
|
355
384
|
};
|
|
385
|
+
verificationTokenHash: {
|
|
386
|
+
type: string;
|
|
387
|
+
private: boolean;
|
|
388
|
+
};
|
|
389
|
+
verificationTokenExpiresAt: {
|
|
390
|
+
type: string;
|
|
391
|
+
};
|
|
356
392
|
};
|
|
357
393
|
};
|
|
358
394
|
};
|
|
@@ -34,6 +34,16 @@ declare class EmailService {
|
|
|
34
34
|
success: boolean;
|
|
35
35
|
message: string;
|
|
36
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
|
+
}>;
|
|
37
47
|
}
|
|
38
48
|
declare const _default: ({ strapi }: {
|
|
39
49
|
strapi: any;
|
|
@@ -111,5 +111,21 @@ declare const _default: ({ strapi }: {
|
|
|
111
111
|
requiresFrontend: boolean;
|
|
112
112
|
verificationUrl: any;
|
|
113
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
|
+
}>;
|
|
114
130
|
};
|
|
115
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>;
|
|
@@ -60,6 +62,7 @@ declare const _default: {
|
|
|
60
62
|
success: boolean;
|
|
61
63
|
message: string;
|
|
62
64
|
}>;
|
|
65
|
+
sendVerificationEmail: (entityId: string) => Promise<any>;
|
|
63
66
|
};
|
|
64
67
|
firebaseService: ({ strapi }: {
|
|
65
68
|
strapi: any;
|
|
@@ -109,6 +112,13 @@ declare const _default: {
|
|
|
109
112
|
requiresFrontend: boolean;
|
|
110
113
|
verificationUrl: any;
|
|
111
114
|
}>;
|
|
115
|
+
sendVerificationEmail(email: string): Promise<{
|
|
116
|
+
message: string;
|
|
117
|
+
}>;
|
|
118
|
+
verifyEmail(token: string): Promise<{
|
|
119
|
+
success: boolean;
|
|
120
|
+
message: string;
|
|
121
|
+
}>;
|
|
112
122
|
};
|
|
113
123
|
templateService: ({ strapi }: {
|
|
114
124
|
strapi: any;
|
|
@@ -133,6 +143,10 @@ declare const _default: {
|
|
|
133
143
|
success: boolean;
|
|
134
144
|
message: string;
|
|
135
145
|
}>;
|
|
146
|
+
sendVerificationEmail(user: any, verificationLink: string): Promise<{
|
|
147
|
+
success: boolean;
|
|
148
|
+
message: string;
|
|
149
|
+
}>;
|
|
136
150
|
};
|
|
137
151
|
firebaseUserDataService: ({ strapi }: {
|
|
138
152
|
strapi: any;
|
|
@@ -159,6 +173,9 @@ declare const _default: {
|
|
|
159
173
|
generateResetToken(firebaseUserDataDocumentId: string): Promise<string>;
|
|
160
174
|
validateResetToken(token: string): Promise<import("./tokenService").TokenValidationResult>;
|
|
161
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>;
|
|
162
179
|
};
|
|
163
180
|
};
|
|
164
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
|
|
@@ -4,6 +4,9 @@ export interface TokenValidationResult {
|
|
|
4
4
|
firebaseUID: string;
|
|
5
5
|
error?: string;
|
|
6
6
|
}
|
|
7
|
+
export interface VerificationTokenValidationResult extends TokenValidationResult {
|
|
8
|
+
email?: string;
|
|
9
|
+
}
|
|
7
10
|
declare const _default: ({ strapi }: {
|
|
8
11
|
strapi: any;
|
|
9
12
|
}) => {
|
|
@@ -24,5 +27,23 @@ declare const _default: ({ strapi }: {
|
|
|
24
27
|
* @param firebaseUserDataDocumentId - The documentId of the firebase-user-data record
|
|
25
28
|
*/
|
|
26
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>;
|
|
27
48
|
};
|
|
28
49
|
export default _default;
|
|
@@ -43,5 +43,10 @@ declare const _default: ({ strapi }: {
|
|
|
43
43
|
success: boolean;
|
|
44
44
|
message: string;
|
|
45
45
|
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Send email verification email (admin-initiated)
|
|
48
|
+
* @param entityId - Firebase UID of the user
|
|
49
|
+
*/
|
|
50
|
+
sendVerificationEmail: (entityId: string) => Promise<any>;
|
|
46
51
|
};
|
|
47
52
|
export default _default;
|
|
@@ -9,6 +9,7 @@ export interface EmailTemplateConfig {
|
|
|
9
9
|
passwordReset?: Partial<EmailTemplate>;
|
|
10
10
|
magicLink?: Partial<EmailTemplate>;
|
|
11
11
|
passwordChanged?: Partial<EmailTemplate>;
|
|
12
|
+
emailVerification?: Partial<EmailTemplate>;
|
|
12
13
|
}
|
|
13
14
|
export interface TemplateVariables {
|
|
14
15
|
user: {
|
|
@@ -22,6 +23,7 @@ export interface TemplateVariables {
|
|
|
22
23
|
link?: string;
|
|
23
24
|
resetLink?: string;
|
|
24
25
|
magicLink?: string;
|
|
26
|
+
verificationLink?: string;
|
|
25
27
|
changedAt?: string;
|
|
26
28
|
appName: string;
|
|
27
29
|
appUrl: string;
|
|
@@ -29,4 +31,4 @@ export interface TemplateVariables {
|
|
|
29
31
|
year: number;
|
|
30
32
|
supportEmail?: string;
|
|
31
33
|
}
|
|
32
|
-
export type TemplateType = "passwordReset" | "magicLink" | "passwordChanged";
|
|
34
|
+
export type TemplateType = "passwordReset" | "magicLink" | "passwordChanged" | "emailVerification";
|
package/package.json
CHANGED