From 4bba529ba88d87b43e9dee8cd2cf8d1938f80759 Mon Sep 17 00:00:00 2001 From: Zoe Date: Thu, 8 Oct 2026 12:43:22 -0500 Subject: [PATCH] feat: improve account security Support TOTP 2fa, allow for changing password, add session management and account removal. --- app/components/CodeInput.vue | 106 + app/components/Dialog/ChangePassword.vue | 245 ++ app/components/Dialog/DeleteAccount.vue | 152 + app/components/Dialog/TwoFactor.vue | 362 ++ app/components/Dialog/index.vue | 9 + app/components/Sidenav/NavSettings.vue | 1 + app/composables/useAuth.ts | 70 +- app/composables/useDialog.ts | 3 + app/pages/auth/login.vue | 167 +- app/pages/settings.vue | 1 + app/pages/settings/appearance.vue | 2 +- app/pages/settings/profile.vue | 19 +- app/pages/settings/security.vue | 283 ++ bun.lock | 529 +-- .../20261008133030_two-factor/migration.sql | 14 + .../20261008133030_two-factor/snapshot.json | 2974 +++++++++++++++++ drizzle/schema.ts | 20 + lib/auth.ts | 7 + nuxt.config.ts | 3 +- package.json | 9 +- server/api/account/index.delete.ts | 139 + server/api/account/password.get.ts | 29 + server/api/account/password.post.ts | 116 + server/api/account/sessions/[id].delete.ts | 40 + server/api/account/sessions/index.get.ts | 38 + server/api/files/[...key].get.ts | 2 +- server/utils/auth.ts | 2 +- 27 files changed, 4874 insertions(+), 468 deletions(-) create mode 100644 app/components/CodeInput.vue create mode 100644 app/components/Dialog/ChangePassword.vue create mode 100644 app/components/Dialog/DeleteAccount.vue create mode 100644 app/components/Dialog/TwoFactor.vue create mode 100644 app/pages/settings/security.vue create mode 100644 drizzle/migrations/20261008133030_two-factor/migration.sql create mode 100644 drizzle/migrations/20261008133030_two-factor/snapshot.json create mode 100644 server/api/account/index.delete.ts create mode 100644 server/api/account/password.get.ts create mode 100644 server/api/account/password.post.ts create mode 100644 server/api/account/sessions/[id].delete.ts create mode 100644 server/api/account/sessions/index.get.ts diff --git a/app/components/CodeInput.vue b/app/components/CodeInput.vue new file mode 100644 index 0000000..4824c57 --- /dev/null +++ b/app/components/CodeInput.vue @@ -0,0 +1,106 @@ + + + diff --git a/app/components/Dialog/ChangePassword.vue b/app/components/Dialog/ChangePassword.vue new file mode 100644 index 0000000..88f1018 --- /dev/null +++ b/app/components/Dialog/ChangePassword.vue @@ -0,0 +1,245 @@ + + + diff --git a/app/components/Dialog/DeleteAccount.vue b/app/components/Dialog/DeleteAccount.vue new file mode 100644 index 0000000..72a3b48 --- /dev/null +++ b/app/components/Dialog/DeleteAccount.vue @@ -0,0 +1,152 @@ + + + diff --git a/app/components/Dialog/TwoFactor.vue b/app/components/Dialog/TwoFactor.vue new file mode 100644 index 0000000..c4aadd2 --- /dev/null +++ b/app/components/Dialog/TwoFactor.vue @@ -0,0 +1,362 @@ + + + diff --git a/app/components/Dialog/index.vue b/app/components/Dialog/index.vue index 7bd94aa..47f859a 100644 --- a/app/components/Dialog/index.vue +++ b/app/components/Dialog/index.vue @@ -1,6 +1,9 @@