Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions server/modules/codeforces/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
let longestStreak = 0;
let tempStreak = 0;

const today = new Date().toISOString().slice(0, 10);

Check warning on line 38 in server/modules/codeforces/service.js

View workflow job for this annotation

GitHub Actions / Backend Lint & Test

'today' is assigned a value but never used
const sortedDesc = [...dates].reverse();

for (let i = 0; i < sortedDesc.length; i++) {
Expand Down Expand Up @@ -147,7 +147,7 @@
let cfUsers;
try {
cfUsers = await cfGetUserInfo(handle);
} catch (err) {

Check warning on line 150 in server/modules/codeforces/service.js

View workflow job for this annotation

GitHub Actions / Backend Lint & Test

'err' is defined but never used
throw new ApiError(404, `Codeforces handle "${handle}" not found.`);
}

Expand Down Expand Up @@ -205,6 +205,12 @@
throw new ApiError(400, "No pending verification. Please re-initiate connection.");
}

// Bind to the handle vetted during initiateConnection (the one the
// duplicate-handle uniqueness guard ran against), not whatever the client
// re-sends now. Otherwise the finally-bound handle can diverge from the one
// that passed the uniqueness check, producing inconsistent state.
handle = profile.handle;

if (new Date() > profile.verificationExpiry) {
throw new ApiError(400, "Verification code expired. Please re-initiate connection.");
}
Expand Down
Loading