fix(backend): Remove confirmation after signup
This commit is contained in:
parent
fe568b6a16
commit
157fb6cce7
2 changed files with 11 additions and 0 deletions
|
@ -91,6 +91,14 @@ ConfirmationModel.prototype.create = async function (data = {}) {
|
|||
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
|
||||
*/
|
||||
|
|
|
@ -357,6 +357,9 @@ UserModel.prototype.confirm = async function ({ body, params }) {
|
|||
})
|
||||
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
|
||||
return this.loginOk()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue