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:
parent
ebeedff5d0
commit
f4e4dc9f11
1 changed files with 1 additions and 1 deletions
|
@ -10,7 +10,7 @@ export default defineEventHandler(async (event) => {
|
||||||
if (session) {
|
if (session) {
|
||||||
const users = await readUsers();
|
const users = await readUsers();
|
||||||
const account = users.find(user => user.id === session.accountId);
|
const account = users.find(user => user.id === session.accountId);
|
||||||
if (account?.type === "anonymous") {
|
if (account?.type === "anonymous" && session.successor === undefined) {
|
||||||
throw createError({
|
throw createError({
|
||||||
status: 409,
|
status: 409,
|
||||||
message: "Cannot log out of an anonymous account",
|
message: "Cannot log out of an anonymous account",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue