blixify-server 0.2.8 → 0.2.9
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.
|
@@ -8,6 +8,7 @@ export declare class AuthWrapper {
|
|
|
8
8
|
isProd: boolean;
|
|
9
9
|
lib: WrapperLib;
|
|
10
10
|
constructor(fbAdmin: any, isProd: boolean, lib: WrapperLib);
|
|
11
|
+
initCheckAuthMethod: (req: any, res: any) => Promise<void>;
|
|
11
12
|
initDisableAccount: (req: any, res: any) => Promise<void>;
|
|
12
13
|
initUpdatePassword: (req: any, res: any) => Promise<void>;
|
|
13
14
|
initUpdateEmail: (req: any, res: any, workflow?: () => Promise<any>) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/authWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,EAAE,GAAG,CAAM;IAClB,MAAM,UAAS;IACf,GAAG,EAAE,UAAU,CAAC;gBAEJ,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU;IAM1D,kBAAkB,QAAe,GAAG,OAAO,GAAG,mBAU5C;IAEF,kBAAkB,QAAe,GAAG,OAAO,GAAG,mBAW5C;IAEF,eAAe,QACR,GAAG,OACH,GAAG,aACG,MAAM,QAAQ,GAAG,CAAC,mBAa7B;IAEF,kBAAkB,QACX,GAAG,OACH,GAAG,aACG,MAAM,QAAQ,GAAG,CAAC,mBAa7B;IAEF,IAAI,
|
|
1
|
+
{"version":3,"file":"authWrapper.d.ts","sourceRoot":"","sources":["../../src/apis/authWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,EAAE,GAAG,CAAM;IAClB,MAAM,UAAS;IACf,GAAG,EAAE,UAAU,CAAC;gBAEJ,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU;IAM1D,mBAAmB,QAAe,GAAG,OAAO,GAAG,mBAyB7C;IAEF,kBAAkB,QAAe,GAAG,OAAO,GAAG,mBAU5C;IAEF,kBAAkB,QAAe,GAAG,OAAO,GAAG,mBAW5C;IAEF,eAAe,QACR,GAAG,OACH,GAAG,aACG,MAAM,QAAQ,GAAG,CAAC,mBAa7B;IAEF,kBAAkB,QACX,GAAG,OACH,GAAG,aACG,MAAM,QAAQ,GAAG,CAAC,mBAa7B;IAEF,IAAI,YA+CF;CACH"}
|
package/dist/apis/authWrapper.js
CHANGED
|
@@ -18,6 +18,35 @@ class AuthWrapper {
|
|
|
18
18
|
constructor(fbAdmin, isProd, lib) {
|
|
19
19
|
this.fbAdmin = "";
|
|
20
20
|
this.isProd = false;
|
|
21
|
+
this.initCheckAuthMethod = (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
var _a;
|
|
23
|
+
const adminAuth = this.fbAdmin.auth();
|
|
24
|
+
try {
|
|
25
|
+
const userId = req.body.userId;
|
|
26
|
+
if (!userId)
|
|
27
|
+
throw "Invalid Configuration";
|
|
28
|
+
const userRecord = yield adminAuth.getUser(userId);
|
|
29
|
+
const provider = {};
|
|
30
|
+
(_a = userRecord.providerData) === null || _a === void 0 ? void 0 : _a.map((eachRecord) => {
|
|
31
|
+
switch (eachRecord.providerId) {
|
|
32
|
+
case "phone":
|
|
33
|
+
provider["phone"] = eachRecord.phoneNumber;
|
|
34
|
+
break;
|
|
35
|
+
case "password":
|
|
36
|
+
provider["email"] = eachRecord.email;
|
|
37
|
+
break;
|
|
38
|
+
case "google.com":
|
|
39
|
+
provider["google"] = eachRecord.email;
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
provider["disabled"] = userRecord.disabled;
|
|
44
|
+
res.send({ provider: provider });
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
res.status(400).json({ err: err });
|
|
48
|
+
}
|
|
49
|
+
});
|
|
21
50
|
this.initDisableAccount = (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
22
51
|
const adminAuth = this.fbAdmin.auth();
|
|
23
52
|
try {
|
|
@@ -86,6 +115,13 @@ class AuthWrapper {
|
|
|
86
115
|
router.post("/disable", (req, res) => {
|
|
87
116
|
this.initDisableAccount(req, res);
|
|
88
117
|
});
|
|
118
|
+
/**
|
|
119
|
+
* @Input
|
|
120
|
+
* userId - string
|
|
121
|
+
*/
|
|
122
|
+
router.post("/method", (req, res) => {
|
|
123
|
+
this.initCheckAuthMethod(req, res);
|
|
124
|
+
});
|
|
89
125
|
/**
|
|
90
126
|
* @Input
|
|
91
127
|
* userId - string
|
|
@@ -105,7 +141,7 @@ class AuthWrapper {
|
|
|
105
141
|
/**
|
|
106
142
|
* @Input
|
|
107
143
|
* userId - string
|
|
108
|
-
*
|
|
144
|
+
* phoneNumber - string
|
|
109
145
|
*/
|
|
110
146
|
router.post("/mobile", (req, res) => {
|
|
111
147
|
this.initUpdateMobileNo(req, res);
|