strapi-plugin-firebase-authentication 1.1.9 → 1.1.10
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-C0XJYDQh.mjs → App-Beg-rhfs.mjs} +33 -10
- package/dist/_chunks/{App-COMAshYj.js → App-Cd5yIsKz.js} +33 -10
- package/dist/_chunks/{api-CM79I13t.mjs → api-BznQNKgc.mjs} +1 -1
- package/dist/_chunks/{api-DzbiYzK4.js → api-C7A4Ky3o.js} +1 -1
- package/dist/_chunks/{index-B8sQntQh.mjs → index-C3713gpv.mjs} +1 -1
- package/dist/_chunks/{index-4s0RQKAx.mjs → index-Dxg4gNu5.mjs} +2 -2
- package/dist/_chunks/{index-DHMYqfl3.js → index-Dz1nqS7B.js} +2 -2
- package/dist/_chunks/{index-DyXjIUy8.js → index-d4XkRCYN.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +75 -14
- package/dist/server/index.mjs +75 -14
- package/dist/server/src/index.d.ts +1 -1
- package/dist/server/src/services/index.d.ts +1 -1
- package/dist/server/src/services/userService.d.ts +1 -1
- package/package.json +1 -1
|
@@ -5,13 +5,13 @@ import { Provider } from "@radix-ui/react-tooltip";
|
|
|
5
5
|
import React, { useState, useCallback, useMemo, useEffect, useRef, useLayoutEffect } from "react";
|
|
6
6
|
import { Link, Flex, Box, Button, Tooltip, Tbody, Tr, Td, Checkbox, Typography, Modal, Table, Thead, Th, SingleSelect, SingleSelectOption, SearchForm, Searchbar, IconButton, Dialog, Tabs, TextInput, Alert, Field, Toggle, Divider } from "@strapi/design-system";
|
|
7
7
|
import { useIntl } from "react-intl";
|
|
8
|
-
import { i as isArguments_1, a as isBufferExports, b as isTypedArray_1, c as isLength_1, d as isFunction_1, _ as _getTag, e as _Stack, f as _equalArrays, g as _equalByTag, h as isObjectLike_1, j as getDefaultExportFromCjs, k as _baseGetTag, l as _MapCache, m as _Symbol, P as PLUGIN_ID, n as getAugmentedNamespace, o as commonjsGlobal } from "./index-
|
|
8
|
+
import { i as isArguments_1, a as isBufferExports, b as isTypedArray_1, c as isLength_1, d as isFunction_1, _ as _getTag, e as _Stack, f as _equalArrays, g as _equalByTag, h as isObjectLike_1, j as getDefaultExportFromCjs, k as _baseGetTag, l as _MapCache, m as _Symbol, P as PLUGIN_ID, n as getAugmentedNamespace, o as commonjsGlobal } from "./index-Dxg4gNu5.mjs";
|
|
9
9
|
import { ArrowLeft, Key, Trash, WarningCircle, CaretUp, CaretDown, Search, Plus, Pencil } from "@strapi/icons";
|
|
10
10
|
import styled from "styled-components";
|
|
11
11
|
import { RxCheck, RxCross2 } from "react-icons/rx";
|
|
12
12
|
import { AiOutlineUserAdd, AiFillPhone, AiFillMail, AiFillYahoo, AiFillGithub, AiFillTwitterCircle, AiFillFacebook, AiFillApple, AiFillGoogleCircle } from "react-icons/ai";
|
|
13
13
|
import { MdPassword } from "react-icons/md";
|
|
14
|
-
import { g as getFirebaseConfig$1 } from "./api-
|
|
14
|
+
import { g as getFirebaseConfig$1 } from "./api-BznQNKgc.mjs";
|
|
15
15
|
import * as PhoneInputModule from "react-phone-input-2";
|
|
16
16
|
import "react-phone-input-2/lib/style.css";
|
|
17
17
|
import validator from "validator";
|
|
@@ -5421,16 +5421,17 @@ const StyledPhoneInputWrapper = styled.div`
|
|
|
5421
5421
|
|
|
5422
5422
|
/* Flag dropdown button styles */
|
|
5423
5423
|
.flag-dropdown {
|
|
5424
|
-
background: transparent;
|
|
5424
|
+
background: transparent !important;
|
|
5425
5425
|
border: none;
|
|
5426
5426
|
border-right: none;
|
|
5427
5427
|
|
|
5428
5428
|
&.open {
|
|
5429
|
+
background: transparent !important;
|
|
5429
5430
|
z-index: 1001;
|
|
5430
5431
|
}
|
|
5431
5432
|
|
|
5432
5433
|
.selected-flag {
|
|
5433
|
-
padding: 0 0 0
|
|
5434
|
+
padding: 0 0.5rem 0 1rem;
|
|
5434
5435
|
height: 40px;
|
|
5435
5436
|
display: flex;
|
|
5436
5437
|
align-items: center;
|
|
@@ -5444,8 +5445,26 @@ const StyledPhoneInputWrapper = styled.div`
|
|
|
5444
5445
|
margin-left: 8px;
|
|
5445
5446
|
}
|
|
5446
5447
|
|
|
5447
|
-
|
|
5448
|
-
|
|
5448
|
+
/* Fix flag background in all interactive states */
|
|
5449
|
+
&:hover,
|
|
5450
|
+
&:focus,
|
|
5451
|
+
&:active,
|
|
5452
|
+
&.open {
|
|
5453
|
+
background: transparent;
|
|
5454
|
+
background-color: transparent;
|
|
5455
|
+
|
|
5456
|
+
.arrow {
|
|
5457
|
+
border-top-color: ${({ theme }) => theme.colors.neutral800};
|
|
5458
|
+
}
|
|
5459
|
+
|
|
5460
|
+
.flag {
|
|
5461
|
+
background-color: transparent;
|
|
5462
|
+
}
|
|
5463
|
+
}
|
|
5464
|
+
|
|
5465
|
+
/* Fix flag background flash on initial load */
|
|
5466
|
+
.flag {
|
|
5467
|
+
background-color: transparent;
|
|
5449
5468
|
}
|
|
5450
5469
|
}
|
|
5451
5470
|
}
|
|
@@ -5899,10 +5918,13 @@ const EditUserForm = ({ data }) => {
|
|
|
5899
5918
|
setIsLoading(true);
|
|
5900
5919
|
try {
|
|
5901
5920
|
const updatedUser = await updateUser(userData.uid, userData);
|
|
5902
|
-
|
|
5903
|
-
|
|
5921
|
+
const result = updatedUser[0];
|
|
5922
|
+
if (result?.status === "rejected") {
|
|
5923
|
+
const errorReason = result.reason;
|
|
5924
|
+
const errorMessage = errorReason?.message || (errorReason?.code ? `Firebase error: ${errorReason.code}` : null) || "Error updating user";
|
|
5925
|
+
throw new Error(errorMessage);
|
|
5904
5926
|
}
|
|
5905
|
-
setUserData(
|
|
5927
|
+
setUserData(result.value);
|
|
5906
5928
|
setIsLoading(false);
|
|
5907
5929
|
toggleNotification({
|
|
5908
5930
|
type: "success",
|
|
@@ -5910,9 +5932,10 @@ const EditUserForm = ({ data }) => {
|
|
|
5910
5932
|
});
|
|
5911
5933
|
} catch (error) {
|
|
5912
5934
|
console.error("Error updating user:", error);
|
|
5935
|
+
const errorMessage = error instanceof Error ? error.message : "An error occurred while updating the user";
|
|
5913
5936
|
toggleNotification({
|
|
5914
5937
|
type: "danger",
|
|
5915
|
-
message:
|
|
5938
|
+
message: errorMessage
|
|
5916
5939
|
});
|
|
5917
5940
|
setIsLoading(false);
|
|
5918
5941
|
setUserData(data);
|
|
@@ -7,13 +7,13 @@ const reactTooltip = require("@radix-ui/react-tooltip");
|
|
|
7
7
|
const React = require("react");
|
|
8
8
|
const designSystem = require("@strapi/design-system");
|
|
9
9
|
const reactIntl = require("react-intl");
|
|
10
|
-
const index = require("./index-
|
|
10
|
+
const index = require("./index-Dz1nqS7B.js");
|
|
11
11
|
const icons = require("@strapi/icons");
|
|
12
12
|
const styled = require("styled-components");
|
|
13
13
|
const rx = require("react-icons/rx");
|
|
14
14
|
const ai = require("react-icons/ai");
|
|
15
15
|
const md = require("react-icons/md");
|
|
16
|
-
const api = require("./api-
|
|
16
|
+
const api = require("./api-C7A4Ky3o.js");
|
|
17
17
|
const PhoneInputModule = require("react-phone-input-2");
|
|
18
18
|
require("react-phone-input-2/lib/style.css");
|
|
19
19
|
const validator = require("validator");
|
|
@@ -5445,16 +5445,17 @@ const StyledPhoneInputWrapper = styled__default.default.div`
|
|
|
5445
5445
|
|
|
5446
5446
|
/* Flag dropdown button styles */
|
|
5447
5447
|
.flag-dropdown {
|
|
5448
|
-
background: transparent;
|
|
5448
|
+
background: transparent !important;
|
|
5449
5449
|
border: none;
|
|
5450
5450
|
border-right: none;
|
|
5451
5451
|
|
|
5452
5452
|
&.open {
|
|
5453
|
+
background: transparent !important;
|
|
5453
5454
|
z-index: 1001;
|
|
5454
5455
|
}
|
|
5455
5456
|
|
|
5456
5457
|
.selected-flag {
|
|
5457
|
-
padding: 0 0 0
|
|
5458
|
+
padding: 0 0.5rem 0 1rem;
|
|
5458
5459
|
height: 40px;
|
|
5459
5460
|
display: flex;
|
|
5460
5461
|
align-items: center;
|
|
@@ -5468,8 +5469,26 @@ const StyledPhoneInputWrapper = styled__default.default.div`
|
|
|
5468
5469
|
margin-left: 8px;
|
|
5469
5470
|
}
|
|
5470
5471
|
|
|
5471
|
-
|
|
5472
|
-
|
|
5472
|
+
/* Fix flag background in all interactive states */
|
|
5473
|
+
&:hover,
|
|
5474
|
+
&:focus,
|
|
5475
|
+
&:active,
|
|
5476
|
+
&.open {
|
|
5477
|
+
background: transparent;
|
|
5478
|
+
background-color: transparent;
|
|
5479
|
+
|
|
5480
|
+
.arrow {
|
|
5481
|
+
border-top-color: ${({ theme }) => theme.colors.neutral800};
|
|
5482
|
+
}
|
|
5483
|
+
|
|
5484
|
+
.flag {
|
|
5485
|
+
background-color: transparent;
|
|
5486
|
+
}
|
|
5487
|
+
}
|
|
5488
|
+
|
|
5489
|
+
/* Fix flag background flash on initial load */
|
|
5490
|
+
.flag {
|
|
5491
|
+
background-color: transparent;
|
|
5473
5492
|
}
|
|
5474
5493
|
}
|
|
5475
5494
|
}
|
|
@@ -5923,10 +5942,13 @@ const EditUserForm = ({ data }) => {
|
|
|
5923
5942
|
setIsLoading(true);
|
|
5924
5943
|
try {
|
|
5925
5944
|
const updatedUser = await updateUser(userData.uid, userData);
|
|
5926
|
-
|
|
5927
|
-
|
|
5945
|
+
const result = updatedUser[0];
|
|
5946
|
+
if (result?.status === "rejected") {
|
|
5947
|
+
const errorReason = result.reason;
|
|
5948
|
+
const errorMessage = errorReason?.message || (errorReason?.code ? `Firebase error: ${errorReason.code}` : null) || "Error updating user";
|
|
5949
|
+
throw new Error(errorMessage);
|
|
5928
5950
|
}
|
|
5929
|
-
setUserData(
|
|
5951
|
+
setUserData(result.value);
|
|
5930
5952
|
setIsLoading(false);
|
|
5931
5953
|
toggleNotification({
|
|
5932
5954
|
type: "success",
|
|
@@ -5934,9 +5956,10 @@ const EditUserForm = ({ data }) => {
|
|
|
5934
5956
|
});
|
|
5935
5957
|
} catch (error) {
|
|
5936
5958
|
console.error("Error updating user:", error);
|
|
5959
|
+
const errorMessage = error instanceof Error ? error.message : "An error occurred while updating the user";
|
|
5937
5960
|
toggleNotification({
|
|
5938
5961
|
type: "danger",
|
|
5939
|
-
message:
|
|
5962
|
+
message: errorMessage
|
|
5940
5963
|
});
|
|
5941
5964
|
setIsLoading(false);
|
|
5942
5965
|
setUserData(data);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getFetchClient } from "@strapi/strapi/admin";
|
|
2
|
-
import { P as PLUGIN_ID } from "./index-
|
|
2
|
+
import { P as PLUGIN_ID } from "./index-Dxg4gNu5.mjs";
|
|
3
3
|
const saveFirebaseConfig = async (json, firebaseWebApiKey, passwordConfig) => {
|
|
4
4
|
const url = `/${PLUGIN_ID}/settings/firebase-config`;
|
|
5
5
|
const { post } = getFetchClient();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const admin = require("@strapi/strapi/admin");
|
|
3
|
-
const index = require("./index-
|
|
3
|
+
const index = require("./index-Dz1nqS7B.js");
|
|
4
4
|
const saveFirebaseConfig = async (json, firebaseWebApiKey, passwordConfig) => {
|
|
5
5
|
const url = `/${index.PLUGIN_ID}/settings/firebase-config`;
|
|
6
6
|
const { post } = admin.getFetchClient();
|
|
@@ -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-BznQNKgc.mjs";
|
|
6
6
|
import { useNavigate } from "react-router-dom";
|
|
7
7
|
function SettingsPage() {
|
|
8
8
|
const { toggleNotification } = useNotification();
|
|
@@ -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-Beg-rhfs.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-C3713gpv.mjs");
|
|
764
764
|
return component.default;
|
|
765
765
|
},
|
|
766
766
|
permissions: PERMISSIONS["menu-link"]
|
|
@@ -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-Cd5yIsKz.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-d4XkRCYN.js"));
|
|
765
765
|
return component.default;
|
|
766
766
|
},
|
|
767
767
|
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-C7A4Ky3o.js");
|
|
8
8
|
const reactRouterDom = require("react-router-dom");
|
|
9
9
|
function SettingsPage() {
|
|
10
10
|
const { toggleNotification } = admin.useNotification();
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -29490,9 +29490,8 @@ const settingsService = ({ strapi: strapi2 }) => {
|
|
|
29490
29490
|
throw new ApplicationError2("Firebase configuration hash is missing");
|
|
29491
29491
|
}
|
|
29492
29492
|
const firebaseConfigJsonValue = await this.decryptJson(encryptionKey, firebaseConfigHash);
|
|
29493
|
-
|
|
29494
|
-
res.
|
|
29495
|
-
res.firebase_config_json = configData;
|
|
29493
|
+
res.firebaseConfigJson = firebaseConfigJsonValue;
|
|
29494
|
+
res.firebase_config_json = firebaseConfigJsonValue;
|
|
29496
29495
|
res.firebaseWebApiKey = res.firebase_web_api_key || null;
|
|
29497
29496
|
res.passwordRequirementsRegex = res.passwordRequirementsRegex || passwordRequirementsRegex;
|
|
29498
29497
|
res.passwordRequirementsMessage = res.passwordRequirementsMessage || passwordRequirementsMessage;
|
|
@@ -29851,9 +29850,71 @@ const userService = ({ strapi: strapi2 }) => {
|
|
|
29851
29850
|
update: async (entityId, payload) => {
|
|
29852
29851
|
try {
|
|
29853
29852
|
ensureFirebaseInitialized();
|
|
29854
|
-
const
|
|
29855
|
-
|
|
29853
|
+
const firebaseData = await strapi2.plugin("firebase-authentication").service("firebaseUserDataService").getByFirebaseUID(entityId);
|
|
29854
|
+
if (!firebaseData?.user) {
|
|
29855
|
+
throw new NotFoundError(`User not found for Firebase UID: ${entityId}`);
|
|
29856
|
+
}
|
|
29857
|
+
const firebasePayload = {};
|
|
29858
|
+
if (payload.email !== void 0) firebasePayload.email = payload.email;
|
|
29859
|
+
if (payload.phoneNumber !== void 0) firebasePayload.phoneNumber = payload.phoneNumber;
|
|
29860
|
+
if (payload.displayName !== void 0) firebasePayload.displayName = payload.displayName;
|
|
29861
|
+
if (payload.photoURL !== void 0) firebasePayload.photoURL = payload.photoURL;
|
|
29862
|
+
if (payload.disabled !== void 0) firebasePayload.disabled = payload.disabled;
|
|
29863
|
+
if (payload.emailVerified !== void 0) firebasePayload.emailVerified = payload.emailVerified;
|
|
29864
|
+
if (payload.password !== void 0) firebasePayload.password = payload.password;
|
|
29865
|
+
const firebasePromise = strapi2.firebase.auth().updateUser(entityId, firebasePayload);
|
|
29866
|
+
const strapiPayload = {};
|
|
29867
|
+
if (payload.email !== void 0) {
|
|
29868
|
+
strapiPayload.email = payload.email;
|
|
29869
|
+
}
|
|
29870
|
+
if (payload.phoneNumber !== void 0) {
|
|
29871
|
+
strapiPayload.phoneNumber = payload.phoneNumber;
|
|
29872
|
+
}
|
|
29873
|
+
if (payload.displayName !== void 0) {
|
|
29874
|
+
if (payload.displayName) {
|
|
29875
|
+
const nameParts = payload.displayName.trim().split(" ");
|
|
29876
|
+
strapiPayload.firstName = nameParts[0] || "";
|
|
29877
|
+
strapiPayload.lastName = nameParts.slice(1).join(" ") || "";
|
|
29878
|
+
} else {
|
|
29879
|
+
strapiPayload.firstName = "";
|
|
29880
|
+
strapiPayload.lastName = "";
|
|
29881
|
+
}
|
|
29882
|
+
}
|
|
29883
|
+
if (typeof payload.disabled === "boolean") {
|
|
29884
|
+
strapiPayload.blocked = payload.disabled;
|
|
29885
|
+
}
|
|
29886
|
+
const strapiPromise = Object.keys(strapiPayload).length > 0 ? strapi2.db.query("plugin::users-permissions.user").update({
|
|
29887
|
+
where: { documentId: firebaseData.user.documentId },
|
|
29888
|
+
data: strapiPayload
|
|
29889
|
+
}) : Promise.resolve(firebaseData.user);
|
|
29890
|
+
const results = await Promise.allSettled([firebasePromise, strapiPromise]);
|
|
29891
|
+
strapi2.log.info("User update operation", {
|
|
29892
|
+
userId: entityId,
|
|
29893
|
+
firebaseStatus: results[0].status,
|
|
29894
|
+
strapiStatus: results[1].status,
|
|
29895
|
+
updatedFields: Object.keys(firebasePayload)
|
|
29896
|
+
});
|
|
29897
|
+
if (results[0].status === "rejected" || results[1].status === "rejected") {
|
|
29898
|
+
strapi2.log.error("Partial update failure detected", {
|
|
29899
|
+
userId: entityId,
|
|
29900
|
+
firebaseError: results[0].status === "rejected" ? results[0].reason : null,
|
|
29901
|
+
strapiError: results[1].status === "rejected" ? results[1].reason : null
|
|
29902
|
+
});
|
|
29903
|
+
}
|
|
29904
|
+
return results;
|
|
29856
29905
|
} catch (e) {
|
|
29906
|
+
if (e.code === "auth/email-already-exists") {
|
|
29907
|
+
throw new ValidationError$1("Email address is already in use by another account");
|
|
29908
|
+
}
|
|
29909
|
+
if (e.code === "auth/phone-number-already-exists") {
|
|
29910
|
+
throw new ValidationError$1("Phone number is already in use by another account");
|
|
29911
|
+
}
|
|
29912
|
+
if (e.code === "auth/invalid-email") {
|
|
29913
|
+
throw new ValidationError$1("Invalid email address format");
|
|
29914
|
+
}
|
|
29915
|
+
if (e.code === "auth/invalid-phone-number") {
|
|
29916
|
+
throw new ValidationError$1("Invalid phone number format");
|
|
29917
|
+
}
|
|
29857
29918
|
throw new ApplicationError$1(e.message.toString());
|
|
29858
29919
|
}
|
|
29859
29920
|
},
|
|
@@ -29871,8 +29932,8 @@ const userService = ({ strapi: strapi2 }) => {
|
|
|
29871
29932
|
if (!firebaseData?.user) {
|
|
29872
29933
|
throw new NotFoundError(`User not found for Firebase UID: ${entityId}`);
|
|
29873
29934
|
}
|
|
29874
|
-
return await strapi2.
|
|
29875
|
-
documentId: firebaseData.user.documentId,
|
|
29935
|
+
return await strapi2.db.query("plugin::users-permissions.user").update({
|
|
29936
|
+
where: { documentId: firebaseData.user.documentId },
|
|
29876
29937
|
data: payload
|
|
29877
29938
|
});
|
|
29878
29939
|
} catch (e) {
|
|
@@ -29887,8 +29948,8 @@ const userService = ({ strapi: strapi2 }) => {
|
|
|
29887
29948
|
throw new NotFoundError(`User not found for Firebase UID: ${entityId}`);
|
|
29888
29949
|
}
|
|
29889
29950
|
const firebasePromise = strapi2.firebase.auth().updateUser(entityId, payload);
|
|
29890
|
-
const strapiPromise = strapi2.
|
|
29891
|
-
documentId: firebaseData.user.documentId,
|
|
29951
|
+
const strapiPromise = strapi2.db.query("plugin::users-permissions.user").update({
|
|
29952
|
+
where: { documentId: firebaseData.user.documentId },
|
|
29892
29953
|
data: payload
|
|
29893
29954
|
});
|
|
29894
29955
|
return Promise.allSettled([firebasePromise, strapiPromise]);
|
|
@@ -29904,8 +29965,8 @@ const userService = ({ strapi: strapi2 }) => {
|
|
|
29904
29965
|
throw new NotFoundError(`User not found for Firebase UID: ${entityId}`);
|
|
29905
29966
|
}
|
|
29906
29967
|
const firebasePromise = strapi2.firebase.auth().deleteUser(entityId);
|
|
29907
|
-
const strapiPromise = strapi2.
|
|
29908
|
-
documentId: firebaseData.user.documentId
|
|
29968
|
+
const strapiPromise = strapi2.db.query("plugin::users-permissions.user").delete({
|
|
29969
|
+
where: { documentId: firebaseData.user.documentId }
|
|
29909
29970
|
});
|
|
29910
29971
|
return Promise.allSettled([firebasePromise, strapiPromise]);
|
|
29911
29972
|
} catch (e) {
|
|
@@ -29927,8 +29988,8 @@ const userService = ({ strapi: strapi2 }) => {
|
|
|
29927
29988
|
if (!firebaseData?.user) {
|
|
29928
29989
|
throw new NotFoundError(`User not found for Firebase UID: ${entityId}`);
|
|
29929
29990
|
}
|
|
29930
|
-
const response = await strapi2.
|
|
29931
|
-
documentId: firebaseData.user.documentId
|
|
29991
|
+
const response = await strapi2.db.query("plugin::users-permissions.user").delete({
|
|
29992
|
+
where: { documentId: firebaseData.user.documentId }
|
|
29932
29993
|
});
|
|
29933
29994
|
return response;
|
|
29934
29995
|
} catch (e) {
|
|
@@ -31349,7 +31410,7 @@ const firebaseUserDataService = ({ strapi: strapi2 }) => ({
|
|
|
31349
31410
|
}
|
|
31350
31411
|
});
|
|
31351
31412
|
} catch (error2) {
|
|
31352
|
-
if (error2.code === "23505") {
|
|
31413
|
+
if (error2.code === "23505" || error2.name === "ValidationError") {
|
|
31353
31414
|
strapi2.log.warn(`Race condition detected for user ${userId}, retrying findFirst`);
|
|
31354
31415
|
firebaseData = await strapi2.documents("plugin::firebase-authentication.firebase-user-data").findFirst({
|
|
31355
31416
|
filters: { user: { documentId: { $eq: userId } } }
|
package/dist/server/index.mjs
CHANGED
|
@@ -29458,9 +29458,8 @@ const settingsService = ({ strapi: strapi2 }) => {
|
|
|
29458
29458
|
throw new ApplicationError2("Firebase configuration hash is missing");
|
|
29459
29459
|
}
|
|
29460
29460
|
const firebaseConfigJsonValue = await this.decryptJson(encryptionKey, firebaseConfigHash);
|
|
29461
|
-
|
|
29462
|
-
res.
|
|
29463
|
-
res.firebase_config_json = configData;
|
|
29461
|
+
res.firebaseConfigJson = firebaseConfigJsonValue;
|
|
29462
|
+
res.firebase_config_json = firebaseConfigJsonValue;
|
|
29464
29463
|
res.firebaseWebApiKey = res.firebase_web_api_key || null;
|
|
29465
29464
|
res.passwordRequirementsRegex = res.passwordRequirementsRegex || passwordRequirementsRegex;
|
|
29466
29465
|
res.passwordRequirementsMessage = res.passwordRequirementsMessage || passwordRequirementsMessage;
|
|
@@ -29819,9 +29818,71 @@ const userService = ({ strapi: strapi2 }) => {
|
|
|
29819
29818
|
update: async (entityId, payload) => {
|
|
29820
29819
|
try {
|
|
29821
29820
|
ensureFirebaseInitialized();
|
|
29822
|
-
const
|
|
29823
|
-
|
|
29821
|
+
const firebaseData = await strapi2.plugin("firebase-authentication").service("firebaseUserDataService").getByFirebaseUID(entityId);
|
|
29822
|
+
if (!firebaseData?.user) {
|
|
29823
|
+
throw new NotFoundError(`User not found for Firebase UID: ${entityId}`);
|
|
29824
|
+
}
|
|
29825
|
+
const firebasePayload = {};
|
|
29826
|
+
if (payload.email !== void 0) firebasePayload.email = payload.email;
|
|
29827
|
+
if (payload.phoneNumber !== void 0) firebasePayload.phoneNumber = payload.phoneNumber;
|
|
29828
|
+
if (payload.displayName !== void 0) firebasePayload.displayName = payload.displayName;
|
|
29829
|
+
if (payload.photoURL !== void 0) firebasePayload.photoURL = payload.photoURL;
|
|
29830
|
+
if (payload.disabled !== void 0) firebasePayload.disabled = payload.disabled;
|
|
29831
|
+
if (payload.emailVerified !== void 0) firebasePayload.emailVerified = payload.emailVerified;
|
|
29832
|
+
if (payload.password !== void 0) firebasePayload.password = payload.password;
|
|
29833
|
+
const firebasePromise = strapi2.firebase.auth().updateUser(entityId, firebasePayload);
|
|
29834
|
+
const strapiPayload = {};
|
|
29835
|
+
if (payload.email !== void 0) {
|
|
29836
|
+
strapiPayload.email = payload.email;
|
|
29837
|
+
}
|
|
29838
|
+
if (payload.phoneNumber !== void 0) {
|
|
29839
|
+
strapiPayload.phoneNumber = payload.phoneNumber;
|
|
29840
|
+
}
|
|
29841
|
+
if (payload.displayName !== void 0) {
|
|
29842
|
+
if (payload.displayName) {
|
|
29843
|
+
const nameParts = payload.displayName.trim().split(" ");
|
|
29844
|
+
strapiPayload.firstName = nameParts[0] || "";
|
|
29845
|
+
strapiPayload.lastName = nameParts.slice(1).join(" ") || "";
|
|
29846
|
+
} else {
|
|
29847
|
+
strapiPayload.firstName = "";
|
|
29848
|
+
strapiPayload.lastName = "";
|
|
29849
|
+
}
|
|
29850
|
+
}
|
|
29851
|
+
if (typeof payload.disabled === "boolean") {
|
|
29852
|
+
strapiPayload.blocked = payload.disabled;
|
|
29853
|
+
}
|
|
29854
|
+
const strapiPromise = Object.keys(strapiPayload).length > 0 ? strapi2.db.query("plugin::users-permissions.user").update({
|
|
29855
|
+
where: { documentId: firebaseData.user.documentId },
|
|
29856
|
+
data: strapiPayload
|
|
29857
|
+
}) : Promise.resolve(firebaseData.user);
|
|
29858
|
+
const results = await Promise.allSettled([firebasePromise, strapiPromise]);
|
|
29859
|
+
strapi2.log.info("User update operation", {
|
|
29860
|
+
userId: entityId,
|
|
29861
|
+
firebaseStatus: results[0].status,
|
|
29862
|
+
strapiStatus: results[1].status,
|
|
29863
|
+
updatedFields: Object.keys(firebasePayload)
|
|
29864
|
+
});
|
|
29865
|
+
if (results[0].status === "rejected" || results[1].status === "rejected") {
|
|
29866
|
+
strapi2.log.error("Partial update failure detected", {
|
|
29867
|
+
userId: entityId,
|
|
29868
|
+
firebaseError: results[0].status === "rejected" ? results[0].reason : null,
|
|
29869
|
+
strapiError: results[1].status === "rejected" ? results[1].reason : null
|
|
29870
|
+
});
|
|
29871
|
+
}
|
|
29872
|
+
return results;
|
|
29824
29873
|
} catch (e) {
|
|
29874
|
+
if (e.code === "auth/email-already-exists") {
|
|
29875
|
+
throw new ValidationError$1("Email address is already in use by another account");
|
|
29876
|
+
}
|
|
29877
|
+
if (e.code === "auth/phone-number-already-exists") {
|
|
29878
|
+
throw new ValidationError$1("Phone number is already in use by another account");
|
|
29879
|
+
}
|
|
29880
|
+
if (e.code === "auth/invalid-email") {
|
|
29881
|
+
throw new ValidationError$1("Invalid email address format");
|
|
29882
|
+
}
|
|
29883
|
+
if (e.code === "auth/invalid-phone-number") {
|
|
29884
|
+
throw new ValidationError$1("Invalid phone number format");
|
|
29885
|
+
}
|
|
29825
29886
|
throw new ApplicationError$1(e.message.toString());
|
|
29826
29887
|
}
|
|
29827
29888
|
},
|
|
@@ -29839,8 +29900,8 @@ const userService = ({ strapi: strapi2 }) => {
|
|
|
29839
29900
|
if (!firebaseData?.user) {
|
|
29840
29901
|
throw new NotFoundError(`User not found for Firebase UID: ${entityId}`);
|
|
29841
29902
|
}
|
|
29842
|
-
return await strapi2.
|
|
29843
|
-
documentId: firebaseData.user.documentId,
|
|
29903
|
+
return await strapi2.db.query("plugin::users-permissions.user").update({
|
|
29904
|
+
where: { documentId: firebaseData.user.documentId },
|
|
29844
29905
|
data: payload
|
|
29845
29906
|
});
|
|
29846
29907
|
} catch (e) {
|
|
@@ -29855,8 +29916,8 @@ const userService = ({ strapi: strapi2 }) => {
|
|
|
29855
29916
|
throw new NotFoundError(`User not found for Firebase UID: ${entityId}`);
|
|
29856
29917
|
}
|
|
29857
29918
|
const firebasePromise = strapi2.firebase.auth().updateUser(entityId, payload);
|
|
29858
|
-
const strapiPromise = strapi2.
|
|
29859
|
-
documentId: firebaseData.user.documentId,
|
|
29919
|
+
const strapiPromise = strapi2.db.query("plugin::users-permissions.user").update({
|
|
29920
|
+
where: { documentId: firebaseData.user.documentId },
|
|
29860
29921
|
data: payload
|
|
29861
29922
|
});
|
|
29862
29923
|
return Promise.allSettled([firebasePromise, strapiPromise]);
|
|
@@ -29872,8 +29933,8 @@ const userService = ({ strapi: strapi2 }) => {
|
|
|
29872
29933
|
throw new NotFoundError(`User not found for Firebase UID: ${entityId}`);
|
|
29873
29934
|
}
|
|
29874
29935
|
const firebasePromise = strapi2.firebase.auth().deleteUser(entityId);
|
|
29875
|
-
const strapiPromise = strapi2.
|
|
29876
|
-
documentId: firebaseData.user.documentId
|
|
29936
|
+
const strapiPromise = strapi2.db.query("plugin::users-permissions.user").delete({
|
|
29937
|
+
where: { documentId: firebaseData.user.documentId }
|
|
29877
29938
|
});
|
|
29878
29939
|
return Promise.allSettled([firebasePromise, strapiPromise]);
|
|
29879
29940
|
} catch (e) {
|
|
@@ -29895,8 +29956,8 @@ const userService = ({ strapi: strapi2 }) => {
|
|
|
29895
29956
|
if (!firebaseData?.user) {
|
|
29896
29957
|
throw new NotFoundError(`User not found for Firebase UID: ${entityId}`);
|
|
29897
29958
|
}
|
|
29898
|
-
const response = await strapi2.
|
|
29899
|
-
documentId: firebaseData.user.documentId
|
|
29959
|
+
const response = await strapi2.db.query("plugin::users-permissions.user").delete({
|
|
29960
|
+
where: { documentId: firebaseData.user.documentId }
|
|
29900
29961
|
});
|
|
29901
29962
|
return response;
|
|
29902
29963
|
} catch (e) {
|
|
@@ -31317,7 +31378,7 @@ const firebaseUserDataService = ({ strapi: strapi2 }) => ({
|
|
|
31317
31378
|
}
|
|
31318
31379
|
});
|
|
31319
31380
|
} catch (error2) {
|
|
31320
|
-
if (error2.code === "23505") {
|
|
31381
|
+
if (error2.code === "23505" || error2.name === "ValidationError") {
|
|
31321
31382
|
strapi2.log.warn(`Race condition detected for user ${userId}, retrying findFirst`);
|
|
31322
31383
|
firebaseData = await strapi2.documents("plugin::firebase-authentication.firebase-user-data").findFirst({
|
|
31323
31384
|
filters: { user: { documentId: { $eq: userId } } }
|
|
@@ -119,7 +119,7 @@ declare const _default: {
|
|
|
119
119
|
};
|
|
120
120
|
}>;
|
|
121
121
|
updateFirebaseUser: (entityId: any, payload: any) => Promise<any>;
|
|
122
|
-
update: (entityId: any, payload: any) => Promise<[PromiseSettledResult<any>]>;
|
|
122
|
+
update: (entityId: any, payload: any) => Promise<[PromiseSettledResult<any>, PromiseSettledResult<any>]>;
|
|
123
123
|
resetPasswordFirebaseUser: (entityId: any, payload: any) => Promise<any>;
|
|
124
124
|
resetPasswordStrapiUser: (entityId: any, payload: any) => Promise<any>;
|
|
125
125
|
resetPassword: (entityId: any, payload: any) => Promise<[PromiseSettledResult<any>, PromiseSettledResult<any>]>;
|
|
@@ -42,7 +42,7 @@ declare const _default: {
|
|
|
42
42
|
};
|
|
43
43
|
}>;
|
|
44
44
|
updateFirebaseUser: (entityId: any, payload: any) => Promise<any>;
|
|
45
|
-
update: (entityId: any, payload: any) => Promise<[PromiseSettledResult<any>]>;
|
|
45
|
+
update: (entityId: any, payload: any) => Promise<[PromiseSettledResult<any>, PromiseSettledResult<any>]>;
|
|
46
46
|
resetPasswordFirebaseUser: (entityId: any, payload: any) => Promise<any>;
|
|
47
47
|
resetPasswordStrapiUser: (entityId: any, payload: any) => Promise<any>;
|
|
48
48
|
resetPassword: (entityId: any, payload: any) => Promise<[PromiseSettledResult<any>, PromiseSettledResult<any>]>;
|
|
@@ -12,7 +12,7 @@ declare const _default: ({ strapi }: {
|
|
|
12
12
|
};
|
|
13
13
|
}>;
|
|
14
14
|
updateFirebaseUser: (entityId: any, payload: any) => Promise<any>;
|
|
15
|
-
update: (entityId: any, payload: any) => Promise<[PromiseSettledResult<any>]>;
|
|
15
|
+
update: (entityId: any, payload: any) => Promise<[PromiseSettledResult<any>, PromiseSettledResult<any>]>;
|
|
16
16
|
resetPasswordFirebaseUser: (entityId: any, payload: any) => Promise<any>;
|
|
17
17
|
resetPasswordStrapiUser: (entityId: any, payload: any) => Promise<any>;
|
|
18
18
|
resetPassword: (entityId: any, payload: any) => Promise<[PromiseSettledResult<any>, PromiseSettledResult<any>]>;
|
package/package.json
CHANGED