mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2026-08-31 19:03:45 +02:00
Delete mail login token rows after usage
This commit is contained in:
@@ -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 })
|
||||
|
||||
return { mailAuthToken }
|
||||
|
||||
Reference in New Issue
Block a user