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
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
3
|
import { Flex, Box, Typography, JSONInput, Button, TextInput, Badge, Textarea, Toggle, NumberInput, Modal } from "@strapi/design-system";
|
|
4
4
|
import { useNotification, Page } from "@strapi/strapi/admin";
|
|
5
|
-
import { g as getFirebaseConfig, s as saveFirebaseConfig, d as delFirebaseConfig, a as savePasswordSettings } from "./api-
|
|
5
|
+
import { g as getFirebaseConfig, s as saveFirebaseConfig, d as delFirebaseConfig, a as savePasswordSettings } from "./api-BM2UtpvM.mjs";
|
|
6
6
|
import { useNavigate } from "react-router-dom";
|
|
7
7
|
function SettingsPage() {
|
|
8
8
|
const { toggleNotification } = useNotification();
|
|
@@ -20,6 +20,10 @@ function SettingsPage() {
|
|
|
20
20
|
const [magicLinkUrl, setMagicLinkUrl] = useState("http://localhost:1338/verify-magic-link.html");
|
|
21
21
|
const [magicLinkEmailSubject, setMagicLinkEmailSubject] = useState("Sign in to Your Application");
|
|
22
22
|
const [magicLinkExpiryHours, setMagicLinkExpiryHours] = useState(1);
|
|
23
|
+
const [emailVerificationUrl, setEmailVerificationUrl] = useState(
|
|
24
|
+
"http://localhost:3000/verify-email"
|
|
25
|
+
);
|
|
26
|
+
const [emailVerificationEmailSubject, setEmailVerificationEmailSubject] = useState("Verify Your Email");
|
|
23
27
|
const [loading, setLoading] = useState(true);
|
|
24
28
|
const [showEditModal, setShowEditModal] = useState(false);
|
|
25
29
|
const [editWebApiKey, setEditWebApiKey] = useState("");
|
|
@@ -46,6 +50,8 @@ function SettingsPage() {
|
|
|
46
50
|
setMagicLinkUrl(data?.magicLinkUrl || "http://localhost:1338/verify-magic-link.html");
|
|
47
51
|
setMagicLinkEmailSubject(data?.magicLinkEmailSubject || "Sign in to Your Application");
|
|
48
52
|
setMagicLinkExpiryHours(data?.magicLinkExpiryHours || 1);
|
|
53
|
+
setEmailVerificationUrl(data?.emailVerificationUrl || "http://localhost:3000/verify-email");
|
|
54
|
+
setEmailVerificationEmailSubject(data?.emailVerificationEmailSubject || "Verify Your Email");
|
|
49
55
|
}).catch((error) => {
|
|
50
56
|
setLoading(false);
|
|
51
57
|
console.error("Error retrieving Firebase config:", error);
|
|
@@ -71,6 +77,8 @@ function SettingsPage() {
|
|
|
71
77
|
setMagicLinkUrl("http://localhost:1338/verify-magic-link.html");
|
|
72
78
|
setMagicLinkEmailSubject("Sign in to Your Application");
|
|
73
79
|
setMagicLinkExpiryHours(1);
|
|
80
|
+
setEmailVerificationUrl("http://localhost:3000/verify-email");
|
|
81
|
+
setEmailVerificationEmailSubject("Verify Your Email");
|
|
74
82
|
setLoading(false);
|
|
75
83
|
toggleNotification({
|
|
76
84
|
type: "success",
|
|
@@ -96,7 +104,9 @@ function SettingsPage() {
|
|
|
96
104
|
enableMagicLink,
|
|
97
105
|
magicLinkUrl,
|
|
98
106
|
magicLinkEmailSubject,
|
|
99
|
-
magicLinkExpiryHours
|
|
107
|
+
magicLinkExpiryHours,
|
|
108
|
+
emailVerificationUrl,
|
|
109
|
+
emailVerificationEmailSubject
|
|
100
110
|
});
|
|
101
111
|
if (!data || !data.firebase_config_json) {
|
|
102
112
|
throw new Error("Invalid response from server");
|
|
@@ -127,7 +137,9 @@ function SettingsPage() {
|
|
|
127
137
|
enableMagicLink,
|
|
128
138
|
magicLinkUrl,
|
|
129
139
|
magicLinkEmailSubject,
|
|
130
|
-
magicLinkExpiryHours
|
|
140
|
+
magicLinkExpiryHours,
|
|
141
|
+
emailVerificationUrl,
|
|
142
|
+
emailVerificationEmailSubject
|
|
131
143
|
});
|
|
132
144
|
if (data) {
|
|
133
145
|
setPasswordRequirementsRegex(data.passwordRequirementsRegex || passwordRequirementsRegex);
|
|
@@ -138,6 +150,8 @@ function SettingsPage() {
|
|
|
138
150
|
setMagicLinkUrl(data.magicLinkUrl || magicLinkUrl);
|
|
139
151
|
setMagicLinkEmailSubject(data.magicLinkEmailSubject || magicLinkEmailSubject);
|
|
140
152
|
setMagicLinkExpiryHours(data.magicLinkExpiryHours || magicLinkExpiryHours);
|
|
153
|
+
setEmailVerificationUrl(data.emailVerificationUrl || emailVerificationUrl);
|
|
154
|
+
setEmailVerificationEmailSubject(data.emailVerificationEmailSubject || emailVerificationEmailSubject);
|
|
141
155
|
}
|
|
142
156
|
setLoading(false);
|
|
143
157
|
toggleNotification({
|
|
@@ -164,13 +178,17 @@ function SettingsPage() {
|
|
|
164
178
|
enableMagicLink,
|
|
165
179
|
magicLinkUrl,
|
|
166
180
|
magicLinkEmailSubject,
|
|
167
|
-
magicLinkExpiryHours
|
|
181
|
+
magicLinkExpiryHours,
|
|
182
|
+
emailVerificationUrl,
|
|
183
|
+
emailVerificationEmailSubject
|
|
168
184
|
});
|
|
169
185
|
if (data) {
|
|
170
186
|
setEnableMagicLink(data.enableMagicLink || enableMagicLink);
|
|
171
187
|
setMagicLinkUrl(data.magicLinkUrl || magicLinkUrl);
|
|
172
188
|
setMagicLinkEmailSubject(data.magicLinkEmailSubject || magicLinkEmailSubject);
|
|
173
189
|
setMagicLinkExpiryHours(data.magicLinkExpiryHours || magicLinkExpiryHours);
|
|
190
|
+
setEmailVerificationUrl(data.emailVerificationUrl || emailVerificationUrl);
|
|
191
|
+
setEmailVerificationEmailSubject(data.emailVerificationEmailSubject || emailVerificationEmailSubject);
|
|
174
192
|
}
|
|
175
193
|
setLoading(false);
|
|
176
194
|
toggleNotification({
|
|
@@ -186,6 +204,39 @@ function SettingsPage() {
|
|
|
186
204
|
setLoading(false);
|
|
187
205
|
}
|
|
188
206
|
};
|
|
207
|
+
const handleSaveEmailVerificationSettings = async () => {
|
|
208
|
+
try {
|
|
209
|
+
setLoading(true);
|
|
210
|
+
const data = await savePasswordSettings({
|
|
211
|
+
passwordRequirementsRegex,
|
|
212
|
+
passwordRequirementsMessage,
|
|
213
|
+
passwordResetUrl,
|
|
214
|
+
passwordResetEmailSubject,
|
|
215
|
+
enableMagicLink,
|
|
216
|
+
magicLinkUrl,
|
|
217
|
+
magicLinkEmailSubject,
|
|
218
|
+
magicLinkExpiryHours,
|
|
219
|
+
emailVerificationUrl,
|
|
220
|
+
emailVerificationEmailSubject
|
|
221
|
+
});
|
|
222
|
+
if (data) {
|
|
223
|
+
setEmailVerificationUrl(data.emailVerificationUrl || emailVerificationUrl);
|
|
224
|
+
setEmailVerificationEmailSubject(data.emailVerificationEmailSubject || emailVerificationEmailSubject);
|
|
225
|
+
}
|
|
226
|
+
setLoading(false);
|
|
227
|
+
toggleNotification({
|
|
228
|
+
type: "success",
|
|
229
|
+
message: "Email verification settings saved successfully"
|
|
230
|
+
});
|
|
231
|
+
} catch (error) {
|
|
232
|
+
console.error("Error saving email verification settings:", error);
|
|
233
|
+
toggleNotification({
|
|
234
|
+
type: "warning",
|
|
235
|
+
message: "Failed to save email verification settings"
|
|
236
|
+
});
|
|
237
|
+
setLoading(false);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
189
240
|
const handleAddWebApiKey = () => {
|
|
190
241
|
setEditWebApiKey("");
|
|
191
242
|
setShowEditModal(true);
|
|
@@ -206,7 +257,9 @@ function SettingsPage() {
|
|
|
206
257
|
enableMagicLink,
|
|
207
258
|
magicLinkUrl,
|
|
208
259
|
magicLinkEmailSubject,
|
|
209
|
-
magicLinkExpiryHours
|
|
260
|
+
magicLinkExpiryHours,
|
|
261
|
+
emailVerificationUrl,
|
|
262
|
+
emailVerificationEmailSubject
|
|
210
263
|
});
|
|
211
264
|
if (!data || !data.firebase_config_json) {
|
|
212
265
|
throw new Error("Invalid response from server");
|
|
@@ -239,7 +292,9 @@ function SettingsPage() {
|
|
|
239
292
|
enableMagicLink,
|
|
240
293
|
magicLinkUrl,
|
|
241
294
|
magicLinkEmailSubject,
|
|
242
|
-
magicLinkExpiryHours
|
|
295
|
+
magicLinkExpiryHours,
|
|
296
|
+
emailVerificationUrl,
|
|
297
|
+
emailVerificationEmailSubject
|
|
243
298
|
});
|
|
244
299
|
if (!data || !data.firebase_config_json) {
|
|
245
300
|
throw new Error("Invalid response from server");
|
|
@@ -561,34 +616,7 @@ function SettingsPage() {
|
|
|
561
616
|
}
|
|
562
617
|
)
|
|
563
618
|
] }),
|
|
564
|
-
/* @__PURE__ */ jsxs(Box, { marginBottom: 3, children: [
|
|
565
|
-
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Password Reset URL *" }),
|
|
566
|
-
/* @__PURE__ */ jsx(
|
|
567
|
-
TextInput,
|
|
568
|
-
{
|
|
569
|
-
name: "passwordResetUrl",
|
|
570
|
-
value: passwordResetUrl,
|
|
571
|
-
onChange: (e) => setPasswordResetUrl(e.target.value),
|
|
572
|
-
placeholder: "https://yourapp.com/reset-password",
|
|
573
|
-
hint: "URL where users will reset their password (your frontend application)",
|
|
574
|
-
required: true
|
|
575
|
-
}
|
|
576
|
-
)
|
|
577
|
-
] }),
|
|
578
|
-
/* @__PURE__ */ jsxs(Box, { marginBottom: 3, children: [
|
|
579
|
-
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Reset Email Subject" }),
|
|
580
|
-
/* @__PURE__ */ jsx(
|
|
581
|
-
TextInput,
|
|
582
|
-
{
|
|
583
|
-
name: "passwordResetEmailSubject",
|
|
584
|
-
value: passwordResetEmailSubject,
|
|
585
|
-
onChange: (e) => setPasswordResetEmailSubject(e.target.value),
|
|
586
|
-
placeholder: "Reset Your Password",
|
|
587
|
-
hint: "Subject line for password reset emails"
|
|
588
|
-
}
|
|
589
|
-
)
|
|
590
|
-
] }),
|
|
591
|
-
/* @__PURE__ */ jsxs(Box, { marginTop: 4, padding: 3, background: "neutral100", borderRadius: "4px", children: [
|
|
619
|
+
/* @__PURE__ */ jsxs(Box, { marginBottom: 4, padding: 3, background: "neutral100", borderRadius: "4px", children: [
|
|
592
620
|
/* @__PURE__ */ jsx(
|
|
593
621
|
Typography,
|
|
594
622
|
{
|
|
@@ -621,6 +649,33 @@ function SettingsPage() {
|
|
|
621
649
|
] })
|
|
622
650
|
] })
|
|
623
651
|
] }),
|
|
652
|
+
/* @__PURE__ */ jsxs(Box, { marginBottom: 3, children: [
|
|
653
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Password Reset URL *" }),
|
|
654
|
+
/* @__PURE__ */ jsx(
|
|
655
|
+
TextInput,
|
|
656
|
+
{
|
|
657
|
+
name: "passwordResetUrl",
|
|
658
|
+
value: passwordResetUrl,
|
|
659
|
+
onChange: (e) => setPasswordResetUrl(e.target.value),
|
|
660
|
+
placeholder: "https://yourapp.com/reset-password",
|
|
661
|
+
hint: "URL where users will reset their password (your frontend application)",
|
|
662
|
+
required: true
|
|
663
|
+
}
|
|
664
|
+
)
|
|
665
|
+
] }),
|
|
666
|
+
/* @__PURE__ */ jsxs(Box, { marginBottom: 3, children: [
|
|
667
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Reset Email Subject" }),
|
|
668
|
+
/* @__PURE__ */ jsx(
|
|
669
|
+
TextInput,
|
|
670
|
+
{
|
|
671
|
+
name: "passwordResetEmailSubject",
|
|
672
|
+
value: passwordResetEmailSubject,
|
|
673
|
+
onChange: (e) => setPasswordResetEmailSubject(e.target.value),
|
|
674
|
+
placeholder: "Reset Your Password",
|
|
675
|
+
hint: "Subject line for password reset emails"
|
|
676
|
+
}
|
|
677
|
+
)
|
|
678
|
+
] }),
|
|
624
679
|
/* @__PURE__ */ jsx(
|
|
625
680
|
Flex,
|
|
626
681
|
{
|
|
@@ -633,6 +688,65 @@ function SettingsPage() {
|
|
|
633
688
|
}
|
|
634
689
|
)
|
|
635
690
|
] }),
|
|
691
|
+
/* @__PURE__ */ jsxs(Box, { padding: 4, background: "neutral0", borderRadius: "4px", shadow: "filterShadow", marginBottom: 6, children: [
|
|
692
|
+
/* @__PURE__ */ jsx(Typography, { variant: "alpha", as: "h2", style: { display: "block", marginBottom: "8px" }, children: "Email Verification" }),
|
|
693
|
+
/* @__PURE__ */ jsx(
|
|
694
|
+
Typography,
|
|
695
|
+
{
|
|
696
|
+
variant: "omega",
|
|
697
|
+
textColor: "neutral600",
|
|
698
|
+
style: { display: "block", marginBottom: "24px" },
|
|
699
|
+
children: "Configure email verification settings for new user registration"
|
|
700
|
+
}
|
|
701
|
+
),
|
|
702
|
+
/* @__PURE__ */ jsxs(Box, { marginBottom: 3, children: [
|
|
703
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Email Verification URL *" }),
|
|
704
|
+
/* @__PURE__ */ jsx(
|
|
705
|
+
TextInput,
|
|
706
|
+
{
|
|
707
|
+
name: "emailVerificationUrl",
|
|
708
|
+
value: emailVerificationUrl,
|
|
709
|
+
onChange: (e) => setEmailVerificationUrl(e.target.value),
|
|
710
|
+
placeholder: "https://yourapp.com/verify-email",
|
|
711
|
+
hint: "URL where users will verify their email address (your frontend application)",
|
|
712
|
+
required: true
|
|
713
|
+
}
|
|
714
|
+
)
|
|
715
|
+
] }),
|
|
716
|
+
/* @__PURE__ */ jsxs(Box, { marginBottom: 3, children: [
|
|
717
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Verification Email Subject" }),
|
|
718
|
+
/* @__PURE__ */ jsx(
|
|
719
|
+
TextInput,
|
|
720
|
+
{
|
|
721
|
+
name: "emailVerificationEmailSubject",
|
|
722
|
+
value: emailVerificationEmailSubject,
|
|
723
|
+
onChange: (e) => setEmailVerificationEmailSubject(e.target.value),
|
|
724
|
+
placeholder: "Verify Your Email",
|
|
725
|
+
hint: "Subject line for email verification emails"
|
|
726
|
+
}
|
|
727
|
+
)
|
|
728
|
+
] }),
|
|
729
|
+
/* @__PURE__ */ jsx(
|
|
730
|
+
Flex,
|
|
731
|
+
{
|
|
732
|
+
style: {
|
|
733
|
+
marginTop: 24,
|
|
734
|
+
width: "100%"
|
|
735
|
+
},
|
|
736
|
+
justifyContent: "flex-end",
|
|
737
|
+
children: /* @__PURE__ */ jsx(
|
|
738
|
+
Button,
|
|
739
|
+
{
|
|
740
|
+
size: "L",
|
|
741
|
+
variant: "secondary",
|
|
742
|
+
onClick: handleSaveEmailVerificationSettings,
|
|
743
|
+
disabled: loading,
|
|
744
|
+
children: "Save Email Verification Settings"
|
|
745
|
+
}
|
|
746
|
+
)
|
|
747
|
+
}
|
|
748
|
+
)
|
|
749
|
+
] }),
|
|
636
750
|
/* @__PURE__ */ jsxs(Box, { padding: 4, background: "neutral0", borderRadius: "4px", shadow: "filterShadow", marginBottom: 6, children: [
|
|
637
751
|
/* @__PURE__ */ jsx(Typography, { variant: "alpha", as: "h2", style: { display: "block", marginBottom: "8px" }, children: "Magic Link Authentication" }),
|
|
638
752
|
/* @__PURE__ */ jsx(
|
|
@@ -739,7 +739,7 @@ const index = {
|
|
|
739
739
|
id: `${PLUGIN_ID}.page.title`,
|
|
740
740
|
defaultMessage: PLUGIN_ID
|
|
741
741
|
},
|
|
742
|
-
Component: () => Promise.resolve().then(() => require("./App-
|
|
742
|
+
Component: () => Promise.resolve().then(() => require("./App-B7d4qS3T.js")).then((mod) => ({
|
|
743
743
|
default: mod.App
|
|
744
744
|
})),
|
|
745
745
|
permissions: PERMISSIONS["menu-link"]
|
|
@@ -761,7 +761,7 @@ const index = {
|
|
|
761
761
|
id: "settings",
|
|
762
762
|
to: `/settings/${PLUGIN_ID}`,
|
|
763
763
|
async Component() {
|
|
764
|
-
const component = await Promise.resolve().then(() => require("./index-
|
|
764
|
+
const component = await Promise.resolve().then(() => require("./index-Cwp9xkG4.js"));
|
|
765
765
|
return component.default;
|
|
766
766
|
},
|
|
767
767
|
permissions: PERMISSIONS["menu-link"]
|
|
@@ -738,7 +738,7 @@ const index = {
|
|
|
738
738
|
id: `${PLUGIN_ID}.page.title`,
|
|
739
739
|
defaultMessage: PLUGIN_ID
|
|
740
740
|
},
|
|
741
|
-
Component: () => import("./App-
|
|
741
|
+
Component: () => import("./App-CQ9ehArz.mjs").then((mod) => ({
|
|
742
742
|
default: mod.App
|
|
743
743
|
})),
|
|
744
744
|
permissions: PERMISSIONS["menu-link"]
|
|
@@ -760,7 +760,7 @@ const index = {
|
|
|
760
760
|
id: "settings",
|
|
761
761
|
to: `/settings/${PLUGIN_ID}`,
|
|
762
762
|
async Component() {
|
|
763
|
-
const component = await import("./index-
|
|
763
|
+
const component = await import("./index-0tTyhxbb.mjs");
|
|
764
764
|
return component.default;
|
|
765
765
|
},
|
|
766
766
|
permissions: PERMISSIONS["menu-link"]
|
|
@@ -4,7 +4,7 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const designSystem = require("@strapi/design-system");
|
|
6
6
|
const admin = require("@strapi/strapi/admin");
|
|
7
|
-
const api = require("./api-
|
|
7
|
+
const api = require("./api-DYP-1kdx.js");
|
|
8
8
|
const reactRouterDom = require("react-router-dom");
|
|
9
9
|
function SettingsPage() {
|
|
10
10
|
const { toggleNotification } = admin.useNotification();
|
|
@@ -22,6 +22,10 @@ function SettingsPage() {
|
|
|
22
22
|
const [magicLinkUrl, setMagicLinkUrl] = React.useState("http://localhost:1338/verify-magic-link.html");
|
|
23
23
|
const [magicLinkEmailSubject, setMagicLinkEmailSubject] = React.useState("Sign in to Your Application");
|
|
24
24
|
const [magicLinkExpiryHours, setMagicLinkExpiryHours] = React.useState(1);
|
|
25
|
+
const [emailVerificationUrl, setEmailVerificationUrl] = React.useState(
|
|
26
|
+
"http://localhost:3000/verify-email"
|
|
27
|
+
);
|
|
28
|
+
const [emailVerificationEmailSubject, setEmailVerificationEmailSubject] = React.useState("Verify Your Email");
|
|
25
29
|
const [loading, setLoading] = React.useState(true);
|
|
26
30
|
const [showEditModal, setShowEditModal] = React.useState(false);
|
|
27
31
|
const [editWebApiKey, setEditWebApiKey] = React.useState("");
|
|
@@ -48,6 +52,8 @@ function SettingsPage() {
|
|
|
48
52
|
setMagicLinkUrl(data?.magicLinkUrl || "http://localhost:1338/verify-magic-link.html");
|
|
49
53
|
setMagicLinkEmailSubject(data?.magicLinkEmailSubject || "Sign in to Your Application");
|
|
50
54
|
setMagicLinkExpiryHours(data?.magicLinkExpiryHours || 1);
|
|
55
|
+
setEmailVerificationUrl(data?.emailVerificationUrl || "http://localhost:3000/verify-email");
|
|
56
|
+
setEmailVerificationEmailSubject(data?.emailVerificationEmailSubject || "Verify Your Email");
|
|
51
57
|
}).catch((error) => {
|
|
52
58
|
setLoading(false);
|
|
53
59
|
console.error("Error retrieving Firebase config:", error);
|
|
@@ -73,6 +79,8 @@ function SettingsPage() {
|
|
|
73
79
|
setMagicLinkUrl("http://localhost:1338/verify-magic-link.html");
|
|
74
80
|
setMagicLinkEmailSubject("Sign in to Your Application");
|
|
75
81
|
setMagicLinkExpiryHours(1);
|
|
82
|
+
setEmailVerificationUrl("http://localhost:3000/verify-email");
|
|
83
|
+
setEmailVerificationEmailSubject("Verify Your Email");
|
|
76
84
|
setLoading(false);
|
|
77
85
|
toggleNotification({
|
|
78
86
|
type: "success",
|
|
@@ -98,7 +106,9 @@ function SettingsPage() {
|
|
|
98
106
|
enableMagicLink,
|
|
99
107
|
magicLinkUrl,
|
|
100
108
|
magicLinkEmailSubject,
|
|
101
|
-
magicLinkExpiryHours
|
|
109
|
+
magicLinkExpiryHours,
|
|
110
|
+
emailVerificationUrl,
|
|
111
|
+
emailVerificationEmailSubject
|
|
102
112
|
});
|
|
103
113
|
if (!data || !data.firebase_config_json) {
|
|
104
114
|
throw new Error("Invalid response from server");
|
|
@@ -129,7 +139,9 @@ function SettingsPage() {
|
|
|
129
139
|
enableMagicLink,
|
|
130
140
|
magicLinkUrl,
|
|
131
141
|
magicLinkEmailSubject,
|
|
132
|
-
magicLinkExpiryHours
|
|
142
|
+
magicLinkExpiryHours,
|
|
143
|
+
emailVerificationUrl,
|
|
144
|
+
emailVerificationEmailSubject
|
|
133
145
|
});
|
|
134
146
|
if (data) {
|
|
135
147
|
setPasswordRequirementsRegex(data.passwordRequirementsRegex || passwordRequirementsRegex);
|
|
@@ -140,6 +152,8 @@ function SettingsPage() {
|
|
|
140
152
|
setMagicLinkUrl(data.magicLinkUrl || magicLinkUrl);
|
|
141
153
|
setMagicLinkEmailSubject(data.magicLinkEmailSubject || magicLinkEmailSubject);
|
|
142
154
|
setMagicLinkExpiryHours(data.magicLinkExpiryHours || magicLinkExpiryHours);
|
|
155
|
+
setEmailVerificationUrl(data.emailVerificationUrl || emailVerificationUrl);
|
|
156
|
+
setEmailVerificationEmailSubject(data.emailVerificationEmailSubject || emailVerificationEmailSubject);
|
|
143
157
|
}
|
|
144
158
|
setLoading(false);
|
|
145
159
|
toggleNotification({
|
|
@@ -166,13 +180,17 @@ function SettingsPage() {
|
|
|
166
180
|
enableMagicLink,
|
|
167
181
|
magicLinkUrl,
|
|
168
182
|
magicLinkEmailSubject,
|
|
169
|
-
magicLinkExpiryHours
|
|
183
|
+
magicLinkExpiryHours,
|
|
184
|
+
emailVerificationUrl,
|
|
185
|
+
emailVerificationEmailSubject
|
|
170
186
|
});
|
|
171
187
|
if (data) {
|
|
172
188
|
setEnableMagicLink(data.enableMagicLink || enableMagicLink);
|
|
173
189
|
setMagicLinkUrl(data.magicLinkUrl || magicLinkUrl);
|
|
174
190
|
setMagicLinkEmailSubject(data.magicLinkEmailSubject || magicLinkEmailSubject);
|
|
175
191
|
setMagicLinkExpiryHours(data.magicLinkExpiryHours || magicLinkExpiryHours);
|
|
192
|
+
setEmailVerificationUrl(data.emailVerificationUrl || emailVerificationUrl);
|
|
193
|
+
setEmailVerificationEmailSubject(data.emailVerificationEmailSubject || emailVerificationEmailSubject);
|
|
176
194
|
}
|
|
177
195
|
setLoading(false);
|
|
178
196
|
toggleNotification({
|
|
@@ -188,6 +206,39 @@ function SettingsPage() {
|
|
|
188
206
|
setLoading(false);
|
|
189
207
|
}
|
|
190
208
|
};
|
|
209
|
+
const handleSaveEmailVerificationSettings = async () => {
|
|
210
|
+
try {
|
|
211
|
+
setLoading(true);
|
|
212
|
+
const data = await api.savePasswordSettings({
|
|
213
|
+
passwordRequirementsRegex,
|
|
214
|
+
passwordRequirementsMessage,
|
|
215
|
+
passwordResetUrl,
|
|
216
|
+
passwordResetEmailSubject,
|
|
217
|
+
enableMagicLink,
|
|
218
|
+
magicLinkUrl,
|
|
219
|
+
magicLinkEmailSubject,
|
|
220
|
+
magicLinkExpiryHours,
|
|
221
|
+
emailVerificationUrl,
|
|
222
|
+
emailVerificationEmailSubject
|
|
223
|
+
});
|
|
224
|
+
if (data) {
|
|
225
|
+
setEmailVerificationUrl(data.emailVerificationUrl || emailVerificationUrl);
|
|
226
|
+
setEmailVerificationEmailSubject(data.emailVerificationEmailSubject || emailVerificationEmailSubject);
|
|
227
|
+
}
|
|
228
|
+
setLoading(false);
|
|
229
|
+
toggleNotification({
|
|
230
|
+
type: "success",
|
|
231
|
+
message: "Email verification settings saved successfully"
|
|
232
|
+
});
|
|
233
|
+
} catch (error) {
|
|
234
|
+
console.error("Error saving email verification settings:", error);
|
|
235
|
+
toggleNotification({
|
|
236
|
+
type: "warning",
|
|
237
|
+
message: "Failed to save email verification settings"
|
|
238
|
+
});
|
|
239
|
+
setLoading(false);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
191
242
|
const handleAddWebApiKey = () => {
|
|
192
243
|
setEditWebApiKey("");
|
|
193
244
|
setShowEditModal(true);
|
|
@@ -208,7 +259,9 @@ function SettingsPage() {
|
|
|
208
259
|
enableMagicLink,
|
|
209
260
|
magicLinkUrl,
|
|
210
261
|
magicLinkEmailSubject,
|
|
211
|
-
magicLinkExpiryHours
|
|
262
|
+
magicLinkExpiryHours,
|
|
263
|
+
emailVerificationUrl,
|
|
264
|
+
emailVerificationEmailSubject
|
|
212
265
|
});
|
|
213
266
|
if (!data || !data.firebase_config_json) {
|
|
214
267
|
throw new Error("Invalid response from server");
|
|
@@ -241,7 +294,9 @@ function SettingsPage() {
|
|
|
241
294
|
enableMagicLink,
|
|
242
295
|
magicLinkUrl,
|
|
243
296
|
magicLinkEmailSubject,
|
|
244
|
-
magicLinkExpiryHours
|
|
297
|
+
magicLinkExpiryHours,
|
|
298
|
+
emailVerificationUrl,
|
|
299
|
+
emailVerificationEmailSubject
|
|
245
300
|
});
|
|
246
301
|
if (!data || !data.firebase_config_json) {
|
|
247
302
|
throw new Error("Invalid response from server");
|
|
@@ -563,34 +618,7 @@ function SettingsPage() {
|
|
|
563
618
|
}
|
|
564
619
|
)
|
|
565
620
|
] }),
|
|
566
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginBottom: 3, children: [
|
|
567
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Password Reset URL *" }),
|
|
568
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
569
|
-
designSystem.TextInput,
|
|
570
|
-
{
|
|
571
|
-
name: "passwordResetUrl",
|
|
572
|
-
value: passwordResetUrl,
|
|
573
|
-
onChange: (e) => setPasswordResetUrl(e.target.value),
|
|
574
|
-
placeholder: "https://yourapp.com/reset-password",
|
|
575
|
-
hint: "URL where users will reset their password (your frontend application)",
|
|
576
|
-
required: true
|
|
577
|
-
}
|
|
578
|
-
)
|
|
579
|
-
] }),
|
|
580
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginBottom: 3, children: [
|
|
581
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Reset Email Subject" }),
|
|
582
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
583
|
-
designSystem.TextInput,
|
|
584
|
-
{
|
|
585
|
-
name: "passwordResetEmailSubject",
|
|
586
|
-
value: passwordResetEmailSubject,
|
|
587
|
-
onChange: (e) => setPasswordResetEmailSubject(e.target.value),
|
|
588
|
-
placeholder: "Reset Your Password",
|
|
589
|
-
hint: "Subject line for password reset emails"
|
|
590
|
-
}
|
|
591
|
-
)
|
|
592
|
-
] }),
|
|
593
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginTop: 4, padding: 3, background: "neutral100", borderRadius: "4px", children: [
|
|
621
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginBottom: 4, padding: 3, background: "neutral100", borderRadius: "4px", children: [
|
|
594
622
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
595
623
|
designSystem.Typography,
|
|
596
624
|
{
|
|
@@ -623,6 +651,33 @@ function SettingsPage() {
|
|
|
623
651
|
] })
|
|
624
652
|
] })
|
|
625
653
|
] }),
|
|
654
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginBottom: 3, children: [
|
|
655
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Password Reset URL *" }),
|
|
656
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
657
|
+
designSystem.TextInput,
|
|
658
|
+
{
|
|
659
|
+
name: "passwordResetUrl",
|
|
660
|
+
value: passwordResetUrl,
|
|
661
|
+
onChange: (e) => setPasswordResetUrl(e.target.value),
|
|
662
|
+
placeholder: "https://yourapp.com/reset-password",
|
|
663
|
+
hint: "URL where users will reset their password (your frontend application)",
|
|
664
|
+
required: true
|
|
665
|
+
}
|
|
666
|
+
)
|
|
667
|
+
] }),
|
|
668
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginBottom: 3, children: [
|
|
669
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Reset Email Subject" }),
|
|
670
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
671
|
+
designSystem.TextInput,
|
|
672
|
+
{
|
|
673
|
+
name: "passwordResetEmailSubject",
|
|
674
|
+
value: passwordResetEmailSubject,
|
|
675
|
+
onChange: (e) => setPasswordResetEmailSubject(e.target.value),
|
|
676
|
+
placeholder: "Reset Your Password",
|
|
677
|
+
hint: "Subject line for password reset emails"
|
|
678
|
+
}
|
|
679
|
+
)
|
|
680
|
+
] }),
|
|
626
681
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
627
682
|
designSystem.Flex,
|
|
628
683
|
{
|
|
@@ -635,6 +690,65 @@ function SettingsPage() {
|
|
|
635
690
|
}
|
|
636
691
|
)
|
|
637
692
|
] }),
|
|
693
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, background: "neutral0", borderRadius: "4px", shadow: "filterShadow", marginBottom: 6, children: [
|
|
694
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", as: "h2", style: { display: "block", marginBottom: "8px" }, children: "Email Verification" }),
|
|
695
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
696
|
+
designSystem.Typography,
|
|
697
|
+
{
|
|
698
|
+
variant: "omega",
|
|
699
|
+
textColor: "neutral600",
|
|
700
|
+
style: { display: "block", marginBottom: "24px" },
|
|
701
|
+
children: "Configure email verification settings for new user registration"
|
|
702
|
+
}
|
|
703
|
+
),
|
|
704
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginBottom: 3, children: [
|
|
705
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Email Verification URL *" }),
|
|
706
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
707
|
+
designSystem.TextInput,
|
|
708
|
+
{
|
|
709
|
+
name: "emailVerificationUrl",
|
|
710
|
+
value: emailVerificationUrl,
|
|
711
|
+
onChange: (e) => setEmailVerificationUrl(e.target.value),
|
|
712
|
+
placeholder: "https://yourapp.com/verify-email",
|
|
713
|
+
hint: "URL where users will verify their email address (your frontend application)",
|
|
714
|
+
required: true
|
|
715
|
+
}
|
|
716
|
+
)
|
|
717
|
+
] }),
|
|
718
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { marginBottom: 3, children: [
|
|
719
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", style: { display: "block", marginBottom: "8px" }, children: "Verification Email Subject" }),
|
|
720
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
721
|
+
designSystem.TextInput,
|
|
722
|
+
{
|
|
723
|
+
name: "emailVerificationEmailSubject",
|
|
724
|
+
value: emailVerificationEmailSubject,
|
|
725
|
+
onChange: (e) => setEmailVerificationEmailSubject(e.target.value),
|
|
726
|
+
placeholder: "Verify Your Email",
|
|
727
|
+
hint: "Subject line for email verification emails"
|
|
728
|
+
}
|
|
729
|
+
)
|
|
730
|
+
] }),
|
|
731
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
732
|
+
designSystem.Flex,
|
|
733
|
+
{
|
|
734
|
+
style: {
|
|
735
|
+
marginTop: 24,
|
|
736
|
+
width: "100%"
|
|
737
|
+
},
|
|
738
|
+
justifyContent: "flex-end",
|
|
739
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
740
|
+
designSystem.Button,
|
|
741
|
+
{
|
|
742
|
+
size: "L",
|
|
743
|
+
variant: "secondary",
|
|
744
|
+
onClick: handleSaveEmailVerificationSettings,
|
|
745
|
+
disabled: loading,
|
|
746
|
+
children: "Save Email Verification Settings"
|
|
747
|
+
}
|
|
748
|
+
)
|
|
749
|
+
}
|
|
750
|
+
)
|
|
751
|
+
] }),
|
|
638
752
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, background: "neutral0", borderRadius: "4px", shadow: "filterShadow", marginBottom: 6, children: [
|
|
639
753
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", as: "h2", style: { display: "block", marginBottom: "8px" }, children: "Magic Link Authentication" }),
|
|
640
754
|
/* @__PURE__ */ jsxRuntime.jsx(
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface ResendVerificationProps {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
email: string;
|
|
4
|
+
userId: string;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onSendVerificationEmail: () => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const ResendVerification: ({ isOpen, email, userId, onClose, onSendVerificationEmail, }: ResendVerificationProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -8,6 +8,8 @@ export declare const saveFirebaseConfig: (json: string, firebaseWebApiKey?: stri
|
|
|
8
8
|
magicLinkUrl?: string;
|
|
9
9
|
magicLinkEmailSubject?: string;
|
|
10
10
|
magicLinkExpiryHours?: number;
|
|
11
|
+
emailVerificationUrl?: string;
|
|
12
|
+
emailVerificationEmailSubject?: string;
|
|
11
13
|
}) => Promise<any>;
|
|
12
14
|
export declare const getFirebaseConfig: () => Promise<any>;
|
|
13
15
|
export declare const delFirebaseConfig: () => Promise<any>;
|
|
@@ -20,4 +22,6 @@ export declare const savePasswordSettings: (passwordConfig: {
|
|
|
20
22
|
magicLinkUrl?: string;
|
|
21
23
|
magicLinkEmailSubject?: string;
|
|
22
24
|
magicLinkExpiryHours?: number;
|
|
25
|
+
emailVerificationUrl?: string;
|
|
26
|
+
emailVerificationEmailSubject?: string;
|
|
23
27
|
}) => Promise<any>;
|
|
@@ -34,4 +34,5 @@ declare const resetUserPassword: (idToUpdate: string, payload: {
|
|
|
34
34
|
declare const sendResetEmail: (userId: string) => Promise<any>;
|
|
35
35
|
declare const getFirebaseConfig: () => Promise<any>;
|
|
36
36
|
declare const sendPasswordResetEmail: (userId: string) => Promise<any>;
|
|
37
|
-
|
|
37
|
+
declare const sendVerificationEmail: (userId: string) => Promise<any>;
|
|
38
|
+
export { fetchUsers, fetchUserByID, deleteUser, updateUser, createUser, fetchStrapiUsers, fetchStrapiUserById, resetUserPassword, sendResetEmail, getFirebaseConfig, sendPasswordResetEmail, sendVerificationEmail, };
|