Skip to content

Commit

Permalink
Update src/account-db.js
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
lelemm and coderabbitai[bot] authored Nov 11, 2024
1 parent d71f81f commit c478da1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/account-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,17 @@ export async function disableOpenID(
return { error };
}

getAccountDb().mutate('DELETE FROM sessions');
getAccountDb().mutate('DELETE FROM users WHERE user_name <> ?', ['']);
getAccountDb().mutate('DELETE FROM auth WHERE method = ?', ['openid']);
const accountDb = getAccountDb();
accountDb.mutate('BEGIN TRANSACTION');
try {
accountDb.mutate('DELETE FROM sessions');
accountDb.mutate('DELETE FROM users WHERE user_name <> ?', ['']);
accountDb.mutate('DELETE FROM auth WHERE method = ?', ['openid']);
accountDb.mutate('COMMIT');
} catch (error) {
accountDb.mutate('ROLLBACK');
throw error;
}
}

export function getSession(token) {
Expand Down

0 comments on commit c478da1

Please sign in to comment.