@social-mail/social-mail-web-server 1.8.469 → 1.8.470
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/server/services/user/otp-to-user/OtpToUserService.d.ts.map +1 -1
- package/dist/server/services/user/otp-to-user/OtpToUserService.js +28 -0
- package/dist/server/services/user/otp-to-user/OtpToUserService.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/server/services/user/otp-to-user/OtpToUserService.ts +31 -0
package/package.json
CHANGED
|
@@ -3,6 +3,33 @@ import SocialMailContext from "../../../model/SocialMailContext.js";
|
|
|
3
3
|
import BaseOtpToUserService from "./BaseOtpToUserService.js";
|
|
4
4
|
import { globalEnv } from "../../../../common/globalEnv.js";
|
|
5
5
|
import VerificationToken from "../../../model/entities/VerificationToken.js";
|
|
6
|
+
import EntityAccessError from "@entity-access/entity-access/dist/common/EntityAccessError.js";
|
|
7
|
+
|
|
8
|
+
const allowed = [
|
|
9
|
+
|
|
10
|
+
// us canada
|
|
11
|
+
"+1",
|
|
12
|
+
// europe + UK
|
|
13
|
+
"+43", "+32", "+385", "+420", "+45", "+33", "+49", "+30",
|
|
14
|
+
"+36", "+353", "+39", "+31", "+47", "+48", "+351", "+34",
|
|
15
|
+
"+46", "+41", "+44",
|
|
16
|
+
// india
|
|
17
|
+
"+91",
|
|
18
|
+
// australia
|
|
19
|
+
"+61",
|
|
20
|
+
// new zealand
|
|
21
|
+
"+64",
|
|
22
|
+
// hongkong
|
|
23
|
+
"+852",
|
|
24
|
+
// thailand
|
|
25
|
+
"+66",
|
|
26
|
+
// singapore
|
|
27
|
+
"+65",
|
|
28
|
+
// south korea
|
|
29
|
+
"+82",
|
|
30
|
+
// Japan
|
|
31
|
+
"+81"
|
|
32
|
+
];
|
|
6
33
|
|
|
7
34
|
@RegisterScoped
|
|
8
35
|
export default class OtpToUserService extends BaseOtpToUserService {
|
|
@@ -12,6 +39,10 @@ export default class OtpToUserService extends BaseOtpToUserService {
|
|
|
12
39
|
|
|
13
40
|
async create({ id = void 0, phone }) {
|
|
14
41
|
|
|
42
|
+
if(!allowed.some((x) => phone.startsWith(x))) {
|
|
43
|
+
throw new EntityAccessError("Cannot send text to your country");
|
|
44
|
+
}
|
|
45
|
+
|
|
15
46
|
const { db } = this;
|
|
16
47
|
|
|
17
48
|
let v: VerificationToken;
|