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
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "auth-server", "name": "auth-server",
"version": "1.7.6", "version": "1.7.7",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "auth-server", "name": "auth-server",
"version": "1.7.6", "version": "1.7.7",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "auth-server", "name": "auth-server",
"version": "1.7.6", "version": "1.7.7",
"description": "An API centric auth server. Uses Sequelize and mariaDB by default.", "description": "An API centric auth server. Uses Sequelize and mariaDB by default.",
"main": "server/server.js", "main": "server/server.js",
"scripts": { "scripts": {
+15 -1
View File
@@ -121,7 +121,21 @@ const checkThrottle = async (email) => {
} }
const registerPendingSignup = async (body, hash, token) => { 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, email: body.email,
username: body.username, username: body.username,
hash: hash, hash: hash,