BUGFIX: clashing pending signups fixed

This commit is contained in:
2023-05-15 11:02:51 +10:00
parent b3c7f7cb5e
commit fd44712e37
3 changed files with 18 additions and 4 deletions
+15 -1
View File
@@ -121,7 +121,21 @@ const checkThrottle = async (email) => {
}
const registerPendingSignup = async (body, hash, token) => {
const record = await pendingSignups.upsert({
//BUGFIX: delete existing pending signups that clash
await pendingSignups.destroy({
where: {
email: body.email
}
});
await pendingSignups.destroy({
where: {
username: body.username
}
});
//record it
const record = await pendingSignups.create({
email: body.email,
username: body.username,
hash: hash,