Merge commit from fork

This commit is contained in:
Timothy Carambat
2026-01-02 15:50:50 -08:00
committed by GitHub
parent 092b1b45f8
commit e287fab560

View File

@@ -38,7 +38,7 @@ async function recoverAccount(username = "", recoveryCodes = []) {
// because this is a user who has not logged out and back in since upgrade.
const allUserHashes = await RecoveryCode.hashesForUser(user.id);
if (allUserHashes.length < 4)
return { success: false, error: "Invalid recovery codes" };
return { success: false, error: "Invalid recovery codes." };
// If they tried to send more than two unique codes, we only take the first two
const uniqueRecoveryCodes = [...new Set(recoveryCodes)]
@@ -55,7 +55,7 @@ async function recoverAccount(username = "", recoveryCodes = []) {
});
return valid;
});
if (!validCodes) return { success: false, error: "Invalid recovery codes" };
if (!validCodes) return { success: false, error: "Invalid recovery codes." };
const { passwordResetToken, error } = await PasswordResetToken.create(
user.id