Skip to content

Commit 3f220ab

Browse files
committed
Prevent 2 users that match on the same question again from entering the same interview room if the question was not completed
1 parent c47df15 commit 3f220ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

backend/collaboration/src/service/get/collab-get-service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export async function getCollabRoomService(
1818
};
1919
}
2020

21-
const combinedString = `uid1=${userid1}|uid2=${userid2}|qid=${questionid}`;
21+
const randomString = crypto.randomBytes(4).toString('hex');
22+
const combinedString = `uid1=${userid1}|uid2=${userid2}|qid=${questionid}|rand=${randomString}`;
2223
const hash = crypto.createHash('sha256');
2324
const uniqueRoomName = hash.update(combinedString).digest('hex');
2425
return {

0 commit comments

Comments
 (0)