@fonoster/identity 0.9.22 → 0.9.23
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.
|
@@ -69,7 +69,7 @@ const createIsValidVerificationCode_1 = require("../utils/createIsValidVerificat
|
|
|
69
69
|
const verification_1 = require("../verification");
|
|
70
70
|
const exchangeTokens_1 = require("./exchangeTokens");
|
|
71
71
|
const logger = (0, logger_1.getLogger)({ service: "identity", filePath: __filename });
|
|
72
|
-
const verificationRequiredButNotProvided = (identityConfig, user) => identityConfig.
|
|
72
|
+
const verificationRequiredButNotProvided = (identityConfig, user) => identityConfig.contactVerificationRequired &&
|
|
73
73
|
(!user.emailVerified || !user.phoneNumberVerified);
|
|
74
74
|
function createExchangeCredentials(prisma, identityConfig) {
|
|
75
75
|
const isValidVerificationCode = (0, createIsValidVerificationCode_1.createIsValidVerificationCode)(prisma);
|
|
@@ -90,7 +90,9 @@ function createExchangeCredentials(prisma, identityConfig) {
|
|
|
90
90
|
message: "User contact information not verified"
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
// TODO: Rename verifcation methods to be more generic
|
|
94
|
+
// At the moment name would suggest that 2FA and verification are the same thing
|
|
95
|
+
if (identityConfig.twoFactorAuthenticationRequired) {
|
|
94
96
|
const isValid = yield isValidVerificationCode({
|
|
95
97
|
type: verification_1.ContactType.EMAIL,
|
|
96
98
|
value: email,
|
|
@@ -99,7 +101,7 @@ function createExchangeCredentials(prisma, identityConfig) {
|
|
|
99
101
|
if (!isValid) {
|
|
100
102
|
return callback({
|
|
101
103
|
code: grpc.status.PERMISSION_DENIED,
|
|
102
|
-
message: "Invalid
|
|
104
|
+
message: "Invalid 2FA code"
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
107
|
}
|
|
@@ -31,7 +31,8 @@ type IdentityConfig = {
|
|
|
31
31
|
workspaceInviteExpiration: string;
|
|
32
32
|
workspaceInviteUrl: string;
|
|
33
33
|
workspaceInviteFailUrl: string;
|
|
34
|
-
|
|
34
|
+
contactVerificationRequired: boolean;
|
|
35
|
+
twoFactorAuthenticationRequired: boolean;
|
|
35
36
|
resetPasswordUrl: string;
|
|
36
37
|
smtpConfig: {
|
|
37
38
|
sender: string;
|
package/dist/service.js
CHANGED
|
@@ -71,7 +71,8 @@ function buildIdentityService(identityConfig) {
|
|
|
71
71
|
verifyCode: undefined
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
if (identityConfig.
|
|
74
|
+
if (identityConfig.contactVerificationRequired ||
|
|
75
|
+
identityConfig.twoFactorAuthenticationRequired) {
|
|
75
76
|
service.handlers.sendVerificationCode = (0, verification_1.createSendVerificationCode)(prisma, identityConfig);
|
|
76
77
|
service.handlers.verifyCode = (0, verification_1.createVerifyCode)(prisma);
|
|
77
78
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/identity",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.23",
|
|
4
4
|
"description": "Identity service for Fonoster",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/fonoster#readme",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"fonoster": "./dist/index.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@fonoster/common": "^0.9.
|
|
23
|
+
"@fonoster/common": "^0.9.23",
|
|
24
24
|
"@fonoster/logger": "^0.9.22",
|
|
25
25
|
"@fonoster/types": "^0.9.22",
|
|
26
26
|
"@grpc/grpc-js": "~1.10.6",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/jsonwebtoken": "^9.0.6"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "32d7a9e95172b4e6e10cc549aec6bc5894f09ee7"
|
|
52
52
|
}
|