Allow abandoning anonymous taken sessions

If an anonymous session is detected as taken the logic preventing the
session from being accidentally deleted would also prevent the user from
recovering from a taken anonymous session.
This commit is contained in:
Hornwitser 2025-07-08 15:53:58 +02:00
parent ebeedff5d0
commit f4e4dc9f11

View file

@ -10,7 +10,7 @@ export default defineEventHandler(async (event) => {
if (session) {
const users = await readUsers();
const account = users.find(user => user.id === session.accountId);
if (account?.type === "anonymous") {
if (account?.type === "anonymous" && session.successor === undefined) {
throw createError({
status: 409,
message: "Cannot log out of an anonymous account",