Delete mail auth token after usage

This commit is contained in:
Jonas Lochmann
2021-12-27 01:00:00 +01:00
parent 9f2ea6e741
commit 3715581d10
6 changed files with 34 additions and 13 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* server component for the TimeLimit App
* Copyright (C) 2019 - 2020 Jonas Lochmann
* Copyright (C) 2019 - 2021 Jonas Lochmann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -37,7 +37,7 @@ export const createFamily = async ({ database, mailAuthToken, firstParentDevice,
}) => {
return database.transaction(async (transaction) => {
const now = Date.now().toString(10)
const mail = await requireMailByAuthToken({ database, mailAuthToken, transaction })
const mail = await requireMailByAuthToken({ database, mailAuthToken, transaction, invalidate: true })
// ensure that no family was created for this mail yet
const exisitngUserEntry = await database.user.findOne({