Save the locale during mail login processes

This commit is contained in:
Jonas Lochmann
2021-12-27 01:00:00 +01:00
parent 80291b8835
commit 7331767a85
7 changed files with 110 additions and 14 deletions
+7 -2
View File
@@ -19,13 +19,18 @@ import { Unauthorized } from 'http-errors'
import { Database, Transaction } from '../../database'
import { generateAuthToken } from '../../util/token'
export const createAuthTokenByMailAddress = async ({ mail, database, transaction }: { mail: string, database: Database, transaction: Transaction }) => {
export const createAuthTokenByMailAddress = async ({
mail, database, transaction, locale
}: {
mail: string, database: Database, transaction: Transaction, locale: string
}) => {
const token = generateAuthToken()
await database.authtoken.create({
token,
mail,
createdAt: Date.now().toString()
createdAt: Date.now().toString(),
locale
}, { transaction })
return token