mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-03 01:39:31 +02:00
Delete mail login token rows after usage
This commit is contained in:
parent
3a59743de9
commit
0663650d9b
1 changed files with 11 additions and 0 deletions
|
@ -132,6 +132,17 @@ export const signInByMailCode = async ({ mailLoginToken, receivedCode, database
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const counter = await database.mailLoginToken.destroy({
|
||||||
|
where: {
|
||||||
|
mailLoginToken
|
||||||
|
},
|
||||||
|
transaction
|
||||||
|
})
|
||||||
|
|
||||||
|
if (counter !== 1) {
|
||||||
|
throw new Gone()
|
||||||
|
}
|
||||||
|
|
||||||
const mailAuthToken = await createAuthTokenByMailAddress({ mail: entry.mail, database, transaction })
|
const mailAuthToken = await createAuthTokenByMailAddress({ mail: entry.mail, database, transaction })
|
||||||
|
|
||||||
return { mailAuthToken }
|
return { mailAuthToken }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue