Skip to content

Commit 63b2693

Browse files
Merge pull request #1275 from OpenSignLabs/validation
fix: enableOTP is not working correctly
2 parents c6829a7 + 76a69d8 commit 63b2693

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

apps/OpenSignServer/cloud/customRoute/v1/routes/CreateDocumentWithTemplate.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,9 @@ export default async function createDocumentWithTemplate(request, response) {
196196
if (TimeToCompleteDays) {
197197
object.set('TimeToCompleteDays', TimeToCompleteDays);
198198
}
199-
const enableOTP = request.body?.enableOTP === true ? true : false;
200-
const IsEnableOTP = enableOTP || template?.IsEnableOTP || false;
199+
const enableOTP = request.body?.enableOTP;
200+
const IsEnableOTP =
201+
enableOTP !== undefined ? enableOTP : template?.IsEnableOTP || false;
201202
object.set('IsEnableOTP', IsEnableOTP);
202203
object.set('CreatedBy', template.CreatedBy);
203204
object.set('ExtUserPtr', {

apps/OpenSignServer/cloud/customRoute/v1/routes/updateDocument.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ export default async function updateDocument(request, response) {
4848
objectId: request?.body?.folderId,
4949
});
5050
}
51-
52-
if (request.body?.enableOTP) {
51+
if (request.body?.enableOTP !== undefined) {
5352
updateQuery.set('IsEnableOTP', request.body?.enableOTP);
5453
}
54+
5555
const updatedRes = await updateQuery.save(null, { useMasterKey: true });
5656
if (updatedRes) {
5757
if (request.posthog) {

apps/OpenSignServer/cloud/customRoute/v1/routes/updateTemplate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default async function updateTemplate(request, response) {
4848
objectId: request?.body?.folderId,
4949
});
5050
}
51-
if (request.body?.enableOTP) {
51+
if (request.body?.enableOTP !== undefined) {
5252
updateQuery.set('IsEnableOTP', request.body?.enableOTP);
5353
}
5454
const updatedRes = await updateQuery.save(null, { useMasterKey: true });

0 commit comments

Comments
 (0)