1
0
Fork 0

fix(backend): Remove confirmation after signup

This commit is contained in:
joostdecock 2023-01-15 10:51:26 +01:00
parent fe568b6a16
commit 157fb6cce7
2 changed files with 11 additions and 0 deletions

View file

@ -91,6 +91,14 @@ ConfirmationModel.prototype.create = async function (data = {}) {
return this.setResponse(201) return this.setResponse(201)
} }
ConfirmationModel.prototype.unguardedDelete = async function () {
await this.prisma.confirmation.delete({ where: { id: this.record.id } })
this.record = null
this.clear = null
return this.setExists()
}
/* /*
* Helper method to decrypt at-rest data * Helper method to decrypt at-rest data
*/ */

View file

@ -357,6 +357,9 @@ UserModel.prototype.confirm = async function ({ body, params }) {
}) })
if (this.error) return this if (this.error) return this
// Before we return, remove the confirmation so it works only once
await this.Confirmation.unguardedDelete()
// Account is now active, let's return a passwordless login // Account is now active, let's return a passwordless login
return this.loginOk() return this.loginOk()
} }