@vitnode/core 1.2.0-canary.51 → 1.2.0-canary.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/next.config.ts +3 -3
- package/dist/scripts/get-config.d.ts +2 -2
- package/dist/scripts/get-config.d.ts.map +1 -1
- package/dist/scripts/plugin.d.ts.map +1 -1
- package/dist/scripts/prepare-database.d.ts.map +1 -1
- package/dist/scripts/prepare-plugins-files.d.ts.map +1 -1
- package/dist/scripts/scripts.js +4 -4
- package/dist/scripts/shared/file-utils.d.ts.map +1 -1
- package/dist/src/api/adapters/email/nodemailer.d.ts +1 -1
- package/dist/src/api/adapters/email/nodemailer.js +3 -3
- package/dist/src/api/adapters/email/resend.d.ts +1 -1
- package/dist/src/api/adapters/email/resend.js +2 -2
- package/dist/src/api/adapters/sso/discord.d.ts +1 -1
- package/dist/src/api/adapters/sso/discord.d.ts.map +1 -1
- package/dist/src/api/adapters/sso/discord.js +21 -21
- package/dist/src/api/adapters/sso/facebook.d.ts +1 -1
- package/dist/src/api/adapters/sso/facebook.d.ts.map +1 -1
- package/dist/src/api/adapters/sso/facebook.js +23 -23
- package/dist/src/api/adapters/sso/google.d.ts +1 -1
- package/dist/src/api/adapters/sso/google.d.ts.map +1 -1
- package/dist/src/api/adapters/sso/google.js +21 -21
- package/dist/src/api/config.d.ts +3 -3
- package/dist/src/api/config.d.ts.map +1 -1
- package/dist/src/api/config.js +11 -11
- package/dist/src/api/lib/check-plugin-id.js +8 -8
- package/dist/src/api/lib/logger-middleware.d.ts +1 -1
- package/dist/src/api/lib/logger-middleware.js +9 -9
- package/dist/src/api/lib/module.d.ts +2 -2
- package/dist/src/api/lib/plugin.d.ts +2 -2
- package/dist/src/api/lib/plugin.d.ts.map +1 -1
- package/dist/src/api/lib/route.d.ts +2 -2
- package/dist/src/api/lib/route.d.ts.map +1 -1
- package/dist/src/api/lib/route.js +1 -1
- package/dist/src/api/lib/with-pagination.d.ts +7 -7
- package/dist/src/api/lib/with-pagination.d.ts.map +1 -1
- package/dist/src/api/lib/with-pagination.js +37 -24
- package/dist/src/api/middlewares/captcha.middleware.d.ts +1 -1
- package/dist/src/api/middlewares/captcha.middleware.d.ts.map +1 -1
- package/dist/src/api/middlewares/captcha.middleware.js +14 -13
- package/dist/src/api/middlewares/global.middleware.d.ts +12 -20
- package/dist/src/api/middlewares/global.middleware.d.ts.map +1 -1
- package/dist/src/api/middlewares/global.middleware.js +29 -28
- package/dist/src/api/middlewares/rate-limiter.middleware.d.ts +3 -3
- package/dist/src/api/middlewares/rate-limiter.middleware.d.ts.map +1 -1
- package/dist/src/api/middlewares/rate-limiter.middleware.js +4 -4
- package/dist/src/api/models/device.d.ts +1 -1
- package/dist/src/api/models/device.d.ts.map +1 -1
- package/dist/src/api/models/device.js +13 -13
- package/dist/src/api/models/email.d.ts +27 -11
- package/dist/src/api/models/email.d.ts.map +1 -1
- package/dist/src/api/models/email.js +35 -22
- package/dist/src/api/models/password.d.ts +4 -0
- package/dist/src/api/models/password.d.ts.map +1 -1
- package/dist/src/api/models/password.js +15 -7
- package/dist/src/api/models/session-admin.d.ts +2 -1
- package/dist/src/api/models/session-admin.d.ts.map +1 -1
- package/dist/src/api/models/session-admin.js +19 -19
- package/dist/src/api/models/session.d.ts +2 -1
- package/dist/src/api/models/session.d.ts.map +1 -1
- package/dist/src/api/models/session.js +17 -17
- package/dist/src/api/models/sso.d.ts +1 -1
- package/dist/src/api/models/sso.d.ts.map +1 -1
- package/dist/src/api/models/sso.js +24 -24
- package/dist/src/api/models/user/get-user-by-id.d.ts +2 -1
- package/dist/src/api/models/user/get-user-by-id.d.ts.map +1 -1
- package/dist/src/api/models/user/get-user-by-id.js +3 -2
- package/dist/src/api/models/user/sign-in-with-passwords.d.ts +1 -1
- package/dist/src/api/models/user/sign-in-with-passwords.d.ts.map +1 -1
- package/dist/src/api/models/user/sign-in-with-passwords.js +1 -1
- package/dist/src/api/models/user/sign-up.d.ts +1 -1
- package/dist/src/api/models/user/sign-up.d.ts.map +1 -1
- package/dist/src/api/models/user/sign-up.js +13 -14
- package/dist/src/api/models/user.d.ts +1 -0
- package/dist/src/api/models/user.d.ts.map +1 -1
- package/dist/src/api/modules/admin/admin.module.d.ts +3 -3
- package/dist/src/api/modules/admin/admin.module.js +1 -1
- package/dist/src/api/modules/admin/debug/debug.admin.module.d.ts +1 -1
- package/dist/src/api/modules/admin/debug/debug.admin.module.js +1 -1
- package/dist/src/api/modules/admin/debug/routes/logs.route.d.ts +2 -2
- package/dist/src/api/modules/admin/debug/routes/logs.route.js +16 -16
- package/dist/src/api/modules/admin/routes/session.route.d.ts +2 -2
- package/dist/src/api/modules/admin/routes/session.route.js +7 -7
- package/dist/src/api/modules/admin/users/routes/list.route.d.ts +2 -2
- package/dist/src/api/modules/admin/users/routes/list.route.js +12 -12
- package/dist/src/api/modules/admin/users/routes/users.route.d.ts +2 -2
- package/dist/src/api/modules/admin/users/routes/users.route.js +15 -15
- package/dist/src/api/modules/admin/users/users.admin.module.d.ts +1 -1
- package/dist/src/api/modules/admin/users/users.admin.module.js +1 -1
- package/dist/src/api/modules/middleware/middleware.module.d.ts +1 -1
- package/dist/src/api/modules/middleware/middleware.module.js +1 -1
- package/dist/src/api/modules/middleware/route.d.ts +2 -2
- package/dist/src/api/modules/middleware/route.js +12 -12
- package/dist/src/api/modules/users/routes/change-password.route.d.ts +52 -0
- package/dist/src/api/modules/users/routes/change-password.route.d.ts.map +1 -0
- package/dist/src/api/modules/users/routes/change-password.route.js +58 -0
- package/dist/src/api/modules/users/routes/reset-passowrd.route.d.ts +42 -0
- package/dist/src/api/modules/users/routes/reset-passowrd.route.d.ts.map +1 -0
- package/dist/src/api/modules/users/routes/reset-passowrd.route.js +91 -0
- package/dist/src/api/modules/users/routes/session.route.d.ts +2 -2
- package/dist/src/api/modules/users/routes/session.route.js +6 -6
- package/dist/src/api/modules/users/routes/sign-in.route.d.ts +3 -3
- package/dist/src/api/modules/users/routes/sign-in.route.js +10 -10
- package/dist/src/api/modules/users/routes/sign-out.route.d.ts +2 -2
- package/dist/src/api/modules/users/routes/sign-out.route.js +7 -7
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts +9 -3
- package/dist/src/api/modules/users/routes/sign-up.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/sign-up.route.js +18 -12
- package/dist/src/api/modules/users/routes/test.route.d.ts +3 -3
- package/dist/src/api/modules/users/routes/test.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/test.route.js +9 -15
- package/dist/src/api/modules/users/sso/routes/callback.route.d.ts +6 -3
- package/dist/src/api/modules/users/sso/routes/callback.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/sso/routes/callback.route.js +10 -7
- package/dist/src/api/modules/users/sso/routes/create-url.route.d.ts +2 -2
- package/dist/src/api/modules/users/sso/routes/create-url.route.js +6 -6
- package/dist/src/api/modules/users/sso/sso.module.d.ts +6 -3
- package/dist/src/api/modules/users/sso/sso.module.d.ts.map +1 -1
- package/dist/src/api/modules/users/sso/sso.module.js +1 -1
- package/dist/src/api/modules/users/users.module.d.ts +103 -11
- package/dist/src/api/modules/users/users.module.d.ts.map +1 -1
- package/dist/src/api/modules/users/users.module.js +6 -2
- package/dist/src/app/login/page.d.ts +1 -1
- package/dist/src/app/login/page.js +2 -2
- package/dist/src/app/login/reset-password/page.d.ts +9 -0
- package/dist/src/app/login/reset-password/page.d.ts.map +1 -0
- package/dist/src/app/login/reset-password/page.js +18 -0
- package/dist/src/app/register/page.d.ts +1 -1
- package/dist/src/app/register/page.js +2 -2
- package/dist/src/app_admin/core/debug/page.d.ts +1 -1
- package/dist/src/app_admin/core/debug/page.js +8 -8
- package/dist/src/app_admin/core/users/page.d.ts +2 -2
- package/dist/src/app_admin/core/users/page.d.ts.map +1 -1
- package/dist/src/app_admin/core/users/page.js +7 -7
- package/dist/src/components/avatar.d.ts +1 -1
- package/dist/src/components/avatar.js +1 -1
- package/dist/src/components/confirm-action/confirm-action-alert-dialog.d.ts +2 -2
- package/dist/src/components/confirm-action/confirm-action-alert-dialog.js +5 -5
- package/dist/src/components/confirm-action/content.d.ts.map +1 -1
- package/dist/src/components/confirm-action/content.js +3 -4
- package/dist/src/components/date-format.js +8 -8
- package/dist/src/components/form/auto-form.d.ts +17 -16
- package/dist/src/components/form/auto-form.d.ts.map +1 -1
- package/dist/src/components/form/auto-form.js +15 -13
- package/dist/src/components/form/common/desc.js +1 -1
- package/dist/src/components/form/common/label.d.ts +4 -2
- package/dist/src/components/form/common/label.d.ts.map +1 -1
- package/dist/src/components/form/common/label.js +14 -4
- package/dist/src/components/form/fields/checkbox.d.ts +3 -3
- package/dist/src/components/form/fields/checkbox.d.ts.map +1 -1
- package/dist/src/components/form/fields/checkbox.js +2 -1
- package/dist/src/components/form/fields/combobox-async.d.ts +4 -4
- package/dist/src/components/form/fields/combobox-async.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox-async.js +31 -24
- package/dist/src/components/form/fields/combobox.d.ts +4 -4
- package/dist/src/components/form/fields/combobox.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox.js +8 -8
- package/dist/src/components/form/fields/input.d.ts +3 -3
- package/dist/src/components/form/fields/input.d.ts.map +1 -1
- package/dist/src/components/form/fields/input.js +4 -3
- package/dist/src/components/form/fields/radio-group.d.ts +4 -4
- package/dist/src/components/form/fields/radio-group.d.ts.map +1 -1
- package/dist/src/components/form/fields/radio-group.js +2 -2
- package/dist/src/components/form/fields/select.d.ts +4 -4
- package/dist/src/components/form/fields/select.d.ts.map +1 -1
- package/dist/src/components/form/fields/select.js +4 -4
- package/dist/src/components/form/fields/switch.d.ts +3 -3
- package/dist/src/components/form/fields/switch.d.ts.map +1 -1
- package/dist/src/components/form/fields/switch.js +2 -1
- package/dist/src/components/form/fields/textarea.d.ts +4 -4
- package/dist/src/components/form/fields/textarea.d.ts.map +1 -1
- package/dist/src/components/form/fields/textarea.js +3 -3
- package/dist/src/components/i18n-provider.d.ts +2 -2
- package/dist/src/components/i18n-provider.js +3 -3
- package/dist/src/components/logo-vitnode.d.ts.map +1 -1
- package/dist/src/components/logo-vitnode.js +8 -2
- package/dist/src/components/switchers/langs/language-swietcher.d.ts +1 -1
- package/dist/src/components/switchers/langs/language-swietcher.d.ts.map +1 -1
- package/dist/src/components/switchers/langs/language-swietcher.js +3 -3
- package/dist/src/components/switchers/themes/theme-switcher.js +4 -4
- package/dist/src/components/table/content.d.ts +1 -1
- package/dist/src/components/table/content.d.ts.map +1 -1
- package/dist/src/components/table/content.js +5 -5
- package/dist/src/components/table/data-table.d.ts +7 -7
- package/dist/src/components/table/data-table.d.ts.map +1 -1
- package/dist/src/components/table/data-table.js +22 -15
- package/dist/src/components/table/order-table-head.d.ts +4 -4
- package/dist/src/components/table/order-table-head.d.ts.map +1 -1
- package/dist/src/components/table/order-table-head.js +20 -9
- package/dist/src/components/table/pagination.js +19 -19
- package/dist/src/components/ui/accordion.d.ts +2 -2
- package/dist/src/components/ui/accordion.d.ts.map +1 -1
- package/dist/src/components/ui/accordion.js +4 -5
- package/dist/src/components/ui/alert-dialog.d.ts +7 -7
- package/dist/src/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/src/components/ui/alert-dialog.js +13 -14
- package/dist/src/components/ui/alert.d.ts +6 -6
- package/dist/src/components/ui/alert.d.ts.map +1 -1
- package/dist/src/components/ui/alert.js +6 -7
- package/dist/src/components/ui/badge.d.ts +4 -4
- package/dist/src/components/ui/badge.d.ts.map +1 -1
- package/dist/src/components/ui/badge.js +7 -8
- package/dist/src/components/ui/button-client.d.ts +1 -1
- package/dist/src/components/ui/button-client.js +9 -9
- package/dist/src/components/ui/button.d.ts +9 -9
- package/dist/src/components/ui/button.d.ts.map +1 -1
- package/dist/src/components/ui/button.js +14 -15
- package/dist/src/components/ui/card.d.ts +8 -8
- package/dist/src/components/ui/card.d.ts.map +1 -1
- package/dist/src/components/ui/card.js +7 -8
- package/dist/src/components/ui/checkbox.d.ts +2 -2
- package/dist/src/components/ui/checkbox.d.ts.map +1 -1
- package/dist/src/components/ui/checkbox.js +2 -3
- package/dist/src/components/ui/collapsible.d.ts +1 -1
- package/dist/src/components/ui/collapsible.js +1 -1
- package/dist/src/components/ui/command.d.ts +4 -4
- package/dist/src/components/ui/command.d.ts.map +1 -1
- package/dist/src/components/ui/command.js +9 -10
- package/dist/src/components/ui/context-menu.d.ts +4 -4
- package/dist/src/components/ui/context-menu.d.ts.map +1 -1
- package/dist/src/components/ui/context-menu.js +7 -8
- package/dist/src/components/ui/dialog.d.ts +6 -6
- package/dist/src/components/ui/dialog.d.ts.map +1 -1
- package/dist/src/components/ui/dialog.js +16 -16
- package/dist/src/components/ui/drawer.d.ts +4 -4
- package/dist/src/components/ui/drawer.d.ts.map +1 -1
- package/dist/src/components/ui/drawer.js +7 -8
- package/dist/src/components/ui/dropdown-menu.d.ts +4 -4
- package/dist/src/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/src/components/ui/dropdown-menu.js +8 -9
- package/dist/src/components/ui/form.d.ts +10 -10
- package/dist/src/components/ui/form.d.ts.map +1 -1
- package/dist/src/components/ui/form.js +15 -15
- package/dist/src/components/ui/header-content.js +1 -1
- package/dist/src/components/ui/hover-card.d.ts +2 -2
- package/dist/src/components/ui/hover-card.d.ts.map +1 -1
- package/dist/src/components/ui/hover-card.js +3 -4
- package/dist/src/components/ui/input-otp.d.ts +5 -5
- package/dist/src/components/ui/input-otp.d.ts.map +1 -1
- package/dist/src/components/ui/input-otp.js +6 -7
- package/dist/src/components/ui/input.d.ts +2 -2
- package/dist/src/components/ui/input.d.ts.map +1 -1
- package/dist/src/components/ui/input.js +1 -2
- package/dist/src/components/ui/label.d.ts +2 -2
- package/dist/src/components/ui/label.d.ts.map +1 -1
- package/dist/src/components/ui/label.js +2 -3
- package/dist/src/components/ui/loader.js +3 -3
- package/dist/src/components/ui/menubar.d.ts +4 -4
- package/dist/src/components/ui/menubar.d.ts.map +1 -1
- package/dist/src/components/ui/menubar.js +11 -12
- package/dist/src/components/ui/navigation-menu.d.ts +2 -2
- package/dist/src/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/src/components/ui/navigation-menu.js +10 -11
- package/dist/src/components/ui/popover.d.ts +3 -3
- package/dist/src/components/ui/popover.d.ts.map +1 -1
- package/dist/src/components/ui/popover.js +4 -4
- package/dist/src/components/ui/progress.d.ts +2 -2
- package/dist/src/components/ui/progress.d.ts.map +1 -1
- package/dist/src/components/ui/progress.js +2 -3
- package/dist/src/components/ui/radio-group.d.ts +2 -2
- package/dist/src/components/ui/radio-group.d.ts.map +1 -1
- package/dist/src/components/ui/radio-group.js +3 -4
- package/dist/src/components/ui/select.d.ts +3 -3
- package/dist/src/components/ui/select.d.ts.map +1 -1
- package/dist/src/components/ui/select.js +9 -10
- package/dist/src/components/ui/separator.d.ts +2 -2
- package/dist/src/components/ui/separator.d.ts.map +1 -1
- package/dist/src/components/ui/separator.js +3 -4
- package/dist/src/components/ui/sheet.d.ts +5 -5
- package/dist/src/components/ui/sheet.d.ts.map +1 -1
- package/dist/src/components/ui/sheet.js +8 -9
- package/dist/src/components/ui/sidebar.d.ts +31 -31
- package/dist/src/components/ui/sidebar.d.ts.map +1 -1
- package/dist/src/components/ui/sidebar.js +67 -69
- package/dist/src/components/ui/skeleton.d.ts +1 -1
- package/dist/src/components/ui/skeleton.js +1 -1
- package/dist/src/components/ui/slider.d.ts +2 -2
- package/dist/src/components/ui/slider.d.ts.map +1 -1
- package/dist/src/components/ui/slider.js +16 -8
- package/dist/src/components/ui/sonner.d.ts +1 -1
- package/dist/src/components/ui/sonner.d.ts.map +1 -1
- package/dist/src/components/ui/sonner.js +6 -6
- package/dist/src/components/ui/switch.d.ts +2 -2
- package/dist/src/components/ui/switch.d.ts.map +1 -1
- package/dist/src/components/ui/switch.js +3 -4
- package/dist/src/components/ui/table.d.ts +9 -9
- package/dist/src/components/ui/table.d.ts.map +1 -1
- package/dist/src/components/ui/table.js +8 -9
- package/dist/src/components/ui/tabs.d.ts +2 -2
- package/dist/src/components/ui/tabs.d.ts.map +1 -1
- package/dist/src/components/ui/tabs.js +4 -5
- package/dist/src/components/ui/textarea.d.ts +2 -2
- package/dist/src/components/ui/textarea.d.ts.map +1 -1
- package/dist/src/components/ui/textarea.js +1 -2
- package/dist/src/components/ui/toggle-group.d.ts +4 -4
- package/dist/src/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/src/components/ui/toggle-group.js +6 -6
- package/dist/src/components/ui/toggle.d.ts +3 -3
- package/dist/src/components/ui/toggle.d.ts.map +1 -1
- package/dist/src/components/ui/toggle.js +8 -9
- package/dist/src/components/ui/tooltip.d.ts +3 -3
- package/dist/src/components/ui/tooltip.d.ts.map +1 -1
- package/dist/src/components/ui/tooltip.js +8 -10
- package/dist/src/config.js +2 -2
- package/dist/src/database/admins.js +10 -10
- package/dist/src/database/languages.js +7 -7
- package/dist/src/database/logs.js +9 -9
- package/dist/src/database/moderators.js +5 -5
- package/dist/src/database/roles.js +1 -1
- package/dist/src/database/sessions.js +6 -6
- package/dist/src/database/users.d.ts +21 -2
- package/dist/src/database/users.d.ts.map +1 -1
- package/dist/src/database/users.js +18 -15
- package/dist/src/drizzle.config.d.ts +2 -2
- package/dist/src/drizzle.config.d.ts.map +1 -1
- package/dist/src/drizzle.config.js +19 -12
- package/dist/src/emails/default-template.d.ts +34 -22
- package/dist/src/emails/default-template.d.ts.map +1 -1
- package/dist/src/emails/default-template.js +61 -66
- package/dist/src/emails/reset-password.d.ts +56 -0
- package/dist/src/emails/reset-password.d.ts.map +1 -0
- package/dist/src/emails/reset-password.js +132 -0
- package/dist/src/emails/ui/button.d.ts +9 -0
- package/dist/src/emails/ui/button.d.ts.map +1 -0
- package/dist/src/emails/ui/button.js +36 -0
- package/dist/src/emails/ui/card.d.ts +8 -0
- package/dist/src/emails/ui/card.d.ts.map +1 -0
- package/dist/src/emails/ui/card.js +39 -0
- package/dist/src/hooks/use-before-unload.js +3 -3
- package/dist/src/hooks/use-captcha.d.ts +2 -2
- package/dist/src/hooks/use-captcha.d.ts.map +1 -1
- package/dist/src/hooks/use-captcha.js +64 -40
- package/dist/src/hooks/use-mobile.d.ts.map +1 -1
- package/dist/src/hooks/use-mobile.js +3 -4
- package/dist/src/lib/api/get-middleware-api.js +4 -4
- package/dist/src/lib/api/get-session-admin-api.js +5 -5
- package/dist/src/lib/api/get-session-api.js +4 -4
- package/dist/src/lib/colors.js +28 -19
- package/dist/src/lib/colors.test.js +60 -60
- package/dist/src/lib/config.js +3 -3
- package/dist/src/lib/fetcher/cookie-from-string-to-object.d.ts.map +1 -1
- package/dist/src/lib/fetcher/cookie-from-string-to-object.js +1 -1
- package/dist/src/lib/fetcher/cookie-from-string-to-object.test.js +27 -27
- package/dist/src/lib/fetcher/core.d.ts +5 -5
- package/dist/src/lib/fetcher/core.d.ts.map +1 -1
- package/dist/src/lib/fetcher/core.js +16 -10
- package/dist/src/lib/fetcher/helpers-server.d.ts +1 -1
- package/dist/src/lib/fetcher/helpers-server.js +1 -1
- package/dist/src/lib/fetcher/helpers.test.js +17 -17
- package/dist/src/lib/fetcher/types.d.ts +26 -26
- package/dist/src/lib/fetcher/types.d.ts.map +1 -1
- package/dist/src/lib/fetcher-client.d.ts +4 -4
- package/dist/src/lib/fetcher-client.d.ts.map +1 -1
- package/dist/src/lib/fetcher-client.js +3 -3
- package/dist/src/lib/fetcher.d.ts +5 -5
- package/dist/src/lib/fetcher.d.ts.map +1 -1
- package/dist/src/lib/fetcher.js +4 -4
- package/dist/src/lib/helpers/auto-form.d.ts +3 -3
- package/dist/src/lib/helpers/auto-form.d.ts.map +1 -1
- package/dist/src/lib/helpers/auto-form.js +16 -15
- package/dist/src/lib/helpers/auto-form.test.js +129 -129
- package/dist/src/lib/navigation.d.ts +2 -2
- package/dist/src/lib/navigation.d.ts.map +1 -1
- package/dist/src/lib/plugin.d.ts +3 -3
- package/dist/src/lib/special-characters.js +1 -1
- package/dist/src/lib/special-characters.test.js +36 -36
- package/dist/src/lib/utils.d.ts +1 -1
- package/dist/src/tests/setup.d.ts +1 -1
- package/dist/src/views/admin/layouts/admin-layout.d.ts +1 -1
- package/dist/src/views/admin/layouts/admin-layout.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/admin-layout.js +4 -8
- package/dist/src/views/admin/layouts/sidebar/nav/item.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/sidebar/nav/item.js +11 -12
- package/dist/src/views/admin/layouts/sidebar/nav/nav.d.ts +1 -1
- package/dist/src/views/admin/layouts/sidebar/nav/nav.js +11 -11
- package/dist/src/views/admin/layouts/sidebar/sidebar.d.ts +1 -1
- package/dist/src/views/admin/layouts/sidebar/sidebar.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/sidebar/sidebar.js +1 -2
- package/dist/src/views/admin/layouts/sidebar/sign-out.js +1 -1
- package/dist/src/views/admin/layouts/user-bar/client.js +5 -5
- package/dist/src/views/admin/layouts/user-bar/user-bar.d.ts +1 -1
- package/dist/src/views/admin/layouts/user-bar/user-bar.d.ts.map +1 -1
- package/dist/src/views/admin/layouts/user-bar/user-bar.js +1 -1
- package/dist/src/views/admin/sign-in/sign-in-admin-view.js +3 -2
- package/dist/src/views/admin/views/core/dashboard/dashboard-admin-view.js +3 -3
- package/dist/src/views/admin/views/core/debug/actions/clear-cache/clear-cache.js +10 -10
- package/dist/src/views/admin/views/core/debug/actions/clear-cache/mutation-api.js +2 -2
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.d.ts +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/content.js +15 -15
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.d.ts +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.js +7 -7
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-status.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-status.js +7 -1
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-type-log.d.ts +1 -1
- package/dist/src/views/admin/views/core/debug/system-logs/badges/badge-type-log.js +3 -3
- package/dist/src/views/admin/views/core/debug/system-logs/system-logs-view.js +25 -25
- package/dist/src/views/admin/views/core/test.js +43 -43
- package/dist/src/views/admin/views/core/users/users-admin-view.d.ts.map +1 -1
- package/dist/src/views/admin/views/core/users/users-admin-view.js +13 -14
- package/dist/src/views/auth/password-reset/change-password-form/form.d.ts +5 -0
- package/dist/src/views/auth/password-reset/change-password-form/form.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/change-password-form/form.js +48 -0
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.d.ts +6 -0
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/change-password-form/mutation-api.js +22 -0
- package/dist/src/views/auth/password-reset/change-password-form/use-form.d.ts +11 -0
- package/dist/src/views/auth/password-reset/change-password-form/use-form.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/change-password-form/use-form.js +36 -0
- package/dist/src/views/auth/password-reset/form/form.d.ts +6 -0
- package/dist/src/views/auth/password-reset/form/form.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/form/form.js +104 -0
- package/dist/src/views/auth/password-reset/form/mutation-api.d.ts +7 -0
- package/dist/src/views/auth/password-reset/form/mutation-api.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/form/mutation-api.js +21 -0
- package/dist/src/views/auth/password-reset/form/use-form.d.ts +12 -0
- package/dist/src/views/auth/password-reset/form/use-form.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/form/use-form.js +33 -0
- package/dist/src/views/auth/password-reset/password-reset-view.d.ts +7 -0
- package/dist/src/views/auth/password-reset/password-reset-view.d.ts.map +1 -0
- package/dist/src/views/auth/password-reset/password-reset-view.js +37 -0
- package/dist/src/views/auth/sign-in/form/form.d.ts +2 -1
- package/dist/src/views/auth/sign-in/form/form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-in/form/form.js +15 -10
- package/dist/src/views/auth/sign-in/form/mutation-api.d.ts +2 -2
- package/dist/src/views/auth/sign-in/form/mutation-api.d.ts.map +1 -1
- package/dist/src/views/auth/sign-in/form/mutation-api.js +10 -10
- package/dist/src/views/auth/sign-in/form/use-form.d.ts +2 -2
- package/dist/src/views/auth/sign-in/form/use-form.js +11 -11
- package/dist/src/views/auth/sign-in/sign-in-view.d.ts.map +1 -1
- package/dist/src/views/auth/sign-in/sign-in-view.js +13 -7
- package/dist/src/views/auth/{components → sign-up/components}/password-input.d.ts +3 -3
- package/dist/src/views/auth/sign-up/components/password-input.d.ts.map +1 -0
- package/dist/src/views/auth/{components → sign-up/components}/password-input.js +13 -14
- package/dist/src/views/auth/sign-up/email-confirmation-view.js +4 -4
- package/dist/src/views/auth/sign-up/form/form.d.ts +2 -2
- package/dist/src/views/auth/sign-up/form/form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/form.js +20 -33
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts +3 -3
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/mutation-api.js +6 -6
- package/dist/src/views/auth/sign-up/form/use-form.d.ts +3 -8
- package/dist/src/views/auth/sign-up/form/use-form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/use-form.js +27 -24
- package/dist/src/views/auth/sign-up/sign-up-view.js +6 -6
- package/dist/src/views/auth/sign-up/wrapper.d.ts +1 -1
- package/dist/src/views/auth/sign-up/wrapper.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/wrapper.js +5 -8
- package/dist/src/views/auth/sso/buttons/client.js +4 -4
- package/dist/src/views/auth/sso/buttons/mutation-api.js +5 -5
- package/dist/src/views/auth/sso/buttons/sso-buttons.js +2 -2
- package/dist/src/views/auth/sso/callback/callback-sso-view.d.ts.map +1 -1
- package/dist/src/views/auth/sso/callback/callback-sso-view.js +21 -7
- package/dist/src/views/auth/sso/callback/client/client.d.ts +3 -1
- package/dist/src/views/auth/sso/callback/client/client.d.ts.map +1 -1
- package/dist/src/views/auth/sso/callback/client/client.js +36 -7
- package/dist/src/views/auth/sso/callback/client/mutation-api.d.ts.map +1 -1
- package/dist/src/views/auth/sso/callback/client/mutation-api.js +11 -6
- package/dist/src/views/error/back-button.js +1 -1
- package/dist/src/views/error/error-view.d.ts +5 -3
- package/dist/src/views/error/error-view.d.ts.map +1 -1
- package/dist/src/views/error/error-view.js +25 -23
- package/dist/src/views/error/global-error-view.d.ts +3 -3
- package/dist/src/views/error/global-error-view.d.ts.map +1 -1
- package/dist/src/views/error/global-error-view.js +36 -44
- package/dist/src/views/layouts/provider.d.ts +4 -4
- package/dist/src/views/layouts/provider.d.ts.map +1 -1
- package/dist/src/views/layouts/provider.js +3 -3
- package/dist/src/views/layouts/root-layout.d.ts +3 -3
- package/dist/src/views/layouts/root-layout.d.ts.map +1 -1
- package/dist/src/views/layouts/root-layout.js +1 -2
- package/dist/src/views/layouts/theme/header/header.d.ts +2 -2
- package/dist/src/views/layouts/theme/header/header.d.ts.map +1 -1
- package/dist/src/views/layouts/theme/header/header.js +1 -1
- package/dist/src/views/layouts/theme/header/user/auth/client.d.ts +1 -1
- package/dist/src/views/layouts/theme/header/user/auth/client.d.ts.map +1 -1
- package/dist/src/views/layouts/theme/header/user/auth/client.js +4 -4
- package/dist/src/views/layouts/theme/header/user/auth/log-out-mutation-api.js +8 -8
- package/dist/src/views/layouts/theme/header/user/user.js +4 -4
- package/dist/src/views/layouts/theme/layout.d.ts +2 -2
- package/dist/src/views/layouts/theme/layout.js +1 -1
- package/dist/src/vitnode.config.d.ts +16 -13
- package/dist/src/vitnode.config.d.ts.map +1 -1
- package/dist/src/vitnode.config.js +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -46
- package/src/app/login/page.tsx +5 -5
- package/src/app/login/reset-password/page.tsx +27 -0
- package/src/app/login/sso/[providerId]/page.tsx +1 -1
- package/src/app/register/page.tsx +5 -5
- package/src/app_admin/core/debug/page.tsx +14 -14
- package/src/app_admin/core/page.tsx +1 -1
- package/src/app_admin/core/test/page.tsx +1 -1
- package/src/app_admin/core/users/page.tsx +12 -13
- package/src/locales/en.json +42 -2
- package/dist/src/views/auth/components/password-input.d.ts.map +0 -1
|
@@ -12,28 +12,28 @@ export class SessionModel {
|
|
|
12
12
|
async hashToken(token) {
|
|
13
13
|
const encoder = new TextEncoder();
|
|
14
14
|
const data = encoder.encode(token);
|
|
15
|
-
const hashBuffer = await crypto.subtle.digest(
|
|
15
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
|
16
16
|
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
17
|
-
return hashArray.map((b)=>b.toString(16).padStart(2,
|
|
17
|
+
return hashArray.map((b)=>b.toString(16).padStart(2, "0")).join("");
|
|
18
18
|
}
|
|
19
19
|
async createSessionByUserId(userId) {
|
|
20
20
|
// Generate secure random bytes using Web Crypto API
|
|
21
21
|
const randomBytes = new Uint8Array(64);
|
|
22
22
|
crypto.getRandomValues(randomBytes);
|
|
23
|
-
const token = Array.from(randomBytes).map((b)=>b.toString(16).padStart(2,
|
|
23
|
+
const token = Array.from(randomBytes).map((b)=>b.toString(16).padStart(2, "0")).join("");
|
|
24
24
|
const device = await new DeviceModel(this.c).getDeviceId();
|
|
25
25
|
const hashedToken = await this.hashToken(token);
|
|
26
|
-
await this.c.get(
|
|
26
|
+
await this.c.get("db").insert(core_sessions).values({
|
|
27
27
|
token: hashedToken,
|
|
28
28
|
userId,
|
|
29
|
-
expiresAt: new Date(Date.now() + this.c.get(
|
|
29
|
+
expiresAt: new Date(Date.now() + this.c.get("core").authorization.cookie_expires),
|
|
30
30
|
deviceId: device.id
|
|
31
31
|
});
|
|
32
|
-
setCookie(this.c, this.c.get(
|
|
32
|
+
setCookie(this.c, this.c.get("core").authorization.cookieName, token, {
|
|
33
33
|
httpOnly: true,
|
|
34
|
-
secure: this.c.get(
|
|
35
|
-
path:
|
|
36
|
-
expires: this.c.get(
|
|
34
|
+
secure: this.c.get("core").authorization.cookieSecure,
|
|
35
|
+
path: "/",
|
|
36
|
+
expires: this.c.get("core").authorization.cookie_expires > 0 ? new Date(Date.now() + this.c.get("core").authorization.cookie_expires) : undefined,
|
|
37
37
|
domain: CONFIG.web.hostname
|
|
38
38
|
});
|
|
39
39
|
return {
|
|
@@ -41,29 +41,29 @@ export class SessionModel {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
async deleteSession() {
|
|
44
|
-
const token = getCookie(this.c, this.c.get(
|
|
44
|
+
const token = getCookie(this.c, this.c.get("core").authorization.cookieName);
|
|
45
45
|
const device = await new DeviceModel(this.c).getDeviceId();
|
|
46
46
|
// Ensure both token and deviceId exist before proceeding
|
|
47
|
-
if (!token
|
|
48
|
-
deleteCookie(this.c, this.c.get(
|
|
47
|
+
if (!(token && device.id)) {
|
|
48
|
+
deleteCookie(this.c, this.c.get("core").authorization.cookieName);
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
const hashedToken = await this.hashToken(token);
|
|
52
|
-
await this.c.get(
|
|
52
|
+
await this.c.get("db").delete(core_sessions)// Harden the query to ensure a user can only delete their own device's session
|
|
53
53
|
.where(and(eq(core_sessions.token, hashedToken), eq(core_sessions.deviceId, device.id)));
|
|
54
|
-
deleteCookie(this.c, this.c.get(
|
|
54
|
+
deleteCookie(this.c, this.c.get("core").authorization.cookieName);
|
|
55
55
|
}
|
|
56
56
|
async getUser() {
|
|
57
|
-
const token = getCookie(this.c, this.c.get(
|
|
57
|
+
const token = getCookie(this.c, this.c.get("core").authorization.cookieName);
|
|
58
58
|
if (!token) return null;
|
|
59
59
|
const device = await new DeviceModel(this.c).getDeviceId();
|
|
60
60
|
if (!device) return null;
|
|
61
61
|
const hashedToken = await this.hashToken(token);
|
|
62
|
-
const [session] = await this.c.get(
|
|
62
|
+
const [session] = await this.c.get("db").select({
|
|
63
63
|
userId: core_sessions.userId
|
|
64
64
|
}).from(core_sessions).where(and(eq(core_sessions.token, hashedToken), eq(core_sessions.deviceId, device.id), gt(core_sessions.expiresAt, new Date()))).limit(1);
|
|
65
65
|
if (!session) {
|
|
66
|
-
deleteCookie(this.c, this.c.get(
|
|
66
|
+
deleteCookie(this.c, this.c.get("core").authorization.cookieName);
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
69
|
const user = await new UserModel().getUserById({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sso.d.ts","sourceRoot":"","sources":["../../../../src/api/models/sso.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sso.d.ts","sourceRoot":"","sources":["../../../../src/api/models/sso.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAUpC,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,CACV,IAAI,EAAE,MAAM,KACT,OAAO,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3D,SAAS,EAAE,CAAC,IAAI,EAAE;QAChB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;KACpB,KAAK,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/D,MAAM,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,WACgB,CAAC;AAE5D,qBAAa,QAAQ;gBACP,CAAC,EAAE,OAAO;IAKtB,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAU;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IAEzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CA6BzB;IAEI,QAAQ,CAAC,EACb,IAAI,EACJ,UAAU,EACV,KAAK,GACN,EAAE;QACD,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC;QACV,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IA8DI,YAAY;IA2BZ,MAAM,CAAC,UAAU,EAAE,MAAM;IASzB,WAAW,CAAC,KAAK,EAAE,MAAM;CA+BhC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import crypto from "crypto";
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
2
|
import { and, eq } from "drizzle-orm";
|
|
3
3
|
import { deleteCookie, getCookie, setCookie } from "hono/cookie";
|
|
4
4
|
import { HTTPException } from "hono/http-exception";
|
|
@@ -10,7 +10,7 @@ export const getRedirectUri = (code)=>new URL(`${CONFIG.web.href}login/sso/${cod
|
|
|
10
10
|
export class SSOModel {
|
|
11
11
|
constructor(c){
|
|
12
12
|
this.c = c;
|
|
13
|
-
this.plugins = c.get(
|
|
13
|
+
this.plugins = c.get("core").authorization.ssoAdapters;
|
|
14
14
|
}
|
|
15
15
|
c;
|
|
16
16
|
plugins;
|
|
@@ -21,7 +21,7 @@ export class SSOModel {
|
|
|
21
21
|
newsletter: false,
|
|
22
22
|
hashedPassword: undefined
|
|
23
23
|
}, c);
|
|
24
|
-
await c.get(
|
|
24
|
+
await c.get("db").insert(core_users_sso).values({
|
|
25
25
|
userId: data.id,
|
|
26
26
|
providerId: providerId,
|
|
27
27
|
providerAccountId: user.id
|
|
@@ -38,7 +38,7 @@ export class SSOModel {
|
|
|
38
38
|
}
|
|
39
39
|
const ssoToken = await provider.fetchToken(code);
|
|
40
40
|
const userFromSSO = await provider.fetchUser(ssoToken);
|
|
41
|
-
return await this.c.get(
|
|
41
|
+
return await this.c.get("db").transaction(async (tx)=>{
|
|
42
42
|
const [dataSSOFromDb] = await tx.select({
|
|
43
43
|
userId: core_users_sso.userId
|
|
44
44
|
}).from(core_users_sso).leftJoin(core_users, eq(core_users.id, core_users_sso.userId)).where(and(eq(core_users_sso.providerId, providerId), eq(core_users_sso.providerAccountId, userFromSSO.id))).limit(1);
|
|
@@ -55,15 +55,15 @@ export class SSOModel {
|
|
|
55
55
|
});
|
|
56
56
|
return signUpUser;
|
|
57
57
|
}
|
|
58
|
-
// If email exists,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
providerAccountId: userFromSSO.id,
|
|
62
|
-
userId: userWithEmail.id
|
|
58
|
+
// If email exists, throw an error
|
|
59
|
+
throw new HTTPException(409, {
|
|
60
|
+
message: "Email already exists"
|
|
63
61
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
// await tx.insert(core_users_sso).values({
|
|
63
|
+
// providerId: providerId,
|
|
64
|
+
// providerAccountId: userFromSSO.id,
|
|
65
|
+
// userId: userWithEmail.id,
|
|
66
|
+
// });
|
|
67
67
|
}
|
|
68
68
|
return {
|
|
69
69
|
userId: dataSSOFromDb.userId
|
|
@@ -71,18 +71,18 @@ export class SSOModel {
|
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
async encryptState() {
|
|
74
|
-
const state = crypto.randomBytes(8).toString(
|
|
74
|
+
const state = crypto.randomBytes(8).toString("hex");
|
|
75
75
|
const encryptedState = await new Promise((resolve, reject)=>{
|
|
76
|
-
const salt = crypto.randomBytes(4).toString(
|
|
76
|
+
const salt = crypto.randomBytes(4).toString("hex");
|
|
77
77
|
crypto.scrypt(state, salt, 16, (err, derivedKey)=>{
|
|
78
78
|
if (err) reject(err);
|
|
79
|
-
resolve(salt
|
|
79
|
+
resolve(`${salt}:${derivedKey.toString("hex")}`);
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
|
-
setCookie(this.c, `${this.c.get(
|
|
82
|
+
setCookie(this.c, `${this.c.get("core").authorization.cookieName}--state-sso`, encryptedState, {
|
|
83
83
|
httpOnly: true,
|
|
84
|
-
secure: this.c.get(
|
|
85
|
-
path:
|
|
84
|
+
secure: this.c.get("core").authorization.cookieSecure,
|
|
85
|
+
path: "/",
|
|
86
86
|
domain: CONFIG.web.hostname
|
|
87
87
|
});
|
|
88
88
|
return state;
|
|
@@ -97,24 +97,24 @@ export class SSOModel {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
async verifyState(state) {
|
|
100
|
-
const storedState = getCookie(this.c, `${this.c.get(
|
|
100
|
+
const storedState = getCookie(this.c, `${this.c.get("core").authorization.cookieName}--state-sso`);
|
|
101
101
|
if (!storedState) {
|
|
102
102
|
throw new HTTPException(400, {
|
|
103
|
-
message:
|
|
103
|
+
message: "Invalid state"
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
const isValid = await new Promise((resolve, reject)=>{
|
|
107
|
-
const [salt, storedHash] = storedState.split(
|
|
107
|
+
const [salt, storedHash] = storedState.split(":");
|
|
108
108
|
crypto.scrypt(state, salt, 16, (err, derivedKey)=>{
|
|
109
109
|
if (err) reject(err);
|
|
110
|
-
resolve(storedHash === derivedKey.toString(
|
|
110
|
+
resolve(storedHash === derivedKey.toString("hex"));
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
113
|
if (!isValid) {
|
|
114
114
|
throw new HTTPException(400, {
|
|
115
|
-
message:
|
|
115
|
+
message: "Invalid state"
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
deleteCookie(this.c, `${this.c.get(
|
|
118
|
+
deleteCookie(this.c, `${this.c.get("core").authorization.cookieName}--state-sso`);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Context } from
|
|
1
|
+
import type { Context } from "hono";
|
|
2
2
|
export declare const getUserById: ({ id, c }: {
|
|
3
3
|
c: Context;
|
|
4
4
|
id: number;
|
|
@@ -13,5 +13,6 @@ export declare const getUserById: ({ id, c }: {
|
|
|
13
13
|
emailVerified: boolean;
|
|
14
14
|
roleId: number;
|
|
15
15
|
birthday: Date | null;
|
|
16
|
+
language: string;
|
|
16
17
|
} | null>;
|
|
17
18
|
//# sourceMappingURL=get-user-by-id.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-user-by-id.d.ts","sourceRoot":"","sources":["../../../../../src/api/models/user/get-user-by-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-user-by-id.d.ts","sourceRoot":"","sources":["../../../../../src/api/models/user/get-user-by-id.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,eAAO,MAAM,WAAW,GAAU,WAAW;IAAE,CAAC,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;SAsBtE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { eq } from "drizzle-orm";
|
|
2
2
|
import { core_users } from "../../../database/users.js";
|
|
3
3
|
export const getUserById = async ({ id, c })=>{
|
|
4
|
-
const [user] = await c.get(
|
|
4
|
+
const [user] = await c.get("db").select({
|
|
5
5
|
id: core_users.id,
|
|
6
6
|
email: core_users.email,
|
|
7
7
|
name: core_users.name,
|
|
@@ -11,7 +11,8 @@ export const getUserById = async ({ id, c })=>{
|
|
|
11
11
|
avatarColor: core_users.avatarColor,
|
|
12
12
|
emailVerified: core_users.emailVerified,
|
|
13
13
|
roleId: core_users.roleId,
|
|
14
|
-
birthday: core_users.birthday
|
|
14
|
+
birthday: core_users.birthday,
|
|
15
|
+
language: core_users.language
|
|
15
16
|
}).from(core_users).where(eq(core_users.id, id)).limit(1);
|
|
16
17
|
if (!user) return null;
|
|
17
18
|
return user;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-in-with-passwords.d.ts","sourceRoot":"","sources":["../../../../../src/api/models/user/sign-in-with-passwords.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sign-in-with-passwords.d.ts","sourceRoot":"","sources":["../../../../../src/api/models/user/sign-in-with-passwords.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAOpC,eAAO,MAAM,kBAAkB,GAAU,yBAItC;IACD,CAAC,EAAE,OAAO,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;;;EA0BA,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { HTTPException } from "hono/http-exception";
|
|
|
3
3
|
import { core_users } from "../../../database/users.js";
|
|
4
4
|
import { PasswordModel } from "../password.js";
|
|
5
5
|
export const signInWithPassword = async ({ email, password, c })=>{
|
|
6
|
-
const [user] = await c.get(
|
|
6
|
+
const [user] = await c.get("db").select({
|
|
7
7
|
id: core_users.id,
|
|
8
8
|
email: core_users.email,
|
|
9
9
|
password: core_users.password
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-up.d.ts","sourceRoot":"","sources":["../../../../../src/api/models/user/sign-up.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sign-up.d.ts","sourceRoot":"","sources":["../../../../../src/api/models/user/sign-up.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AA+DpC,eAAO,MAAM,MAAM,GACjB,8CAKG;IACD,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,EACD,GAAG,OAAO;;;;;;;;;;;;;EAuDX,CAAC"}
|
|
@@ -5,17 +5,17 @@ import { core_roles } from "../../../database/roles.js";
|
|
|
5
5
|
import { core_users } from "../../../database/users.js";
|
|
6
6
|
import { removeSpecialCharacters } from "../../../lib/special-characters.js";
|
|
7
7
|
const getDefaultData = async (c)=>{
|
|
8
|
-
const [countUsers] = await c.get(
|
|
8
|
+
const [countUsers] = await c.get("db").select({
|
|
9
9
|
count: count()
|
|
10
10
|
}).from(core_users);
|
|
11
11
|
// If no users, return root group
|
|
12
12
|
if (countUsers.count === 0) {
|
|
13
|
-
const [defaultRole] = await c.get(
|
|
13
|
+
const [defaultRole] = await c.get("db").select({
|
|
14
14
|
id: core_roles.id
|
|
15
15
|
}).from(core_roles).where(and(eq(core_roles.default, false), eq(core_roles.root, true))).limit(1);
|
|
16
16
|
if (!defaultRole) {
|
|
17
17
|
throw new HTTPException(400, {
|
|
18
|
-
message:
|
|
18
|
+
message: "Default group not found."
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
return {
|
|
@@ -23,39 +23,39 @@ const getDefaultData = async (c)=>{
|
|
|
23
23
|
emailVerified: true
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
const [defaultRole] = await c.get(
|
|
26
|
+
const [defaultRole] = await c.get("db").select({
|
|
27
27
|
id: core_roles.id
|
|
28
28
|
}).from(core_roles).where(and(eq(core_roles.default, true), eq(core_roles.root, false))).limit(1);
|
|
29
29
|
if (!defaultRole) {
|
|
30
30
|
throw new HTTPException(400, {
|
|
31
|
-
message:
|
|
31
|
+
message: "Default role not found."
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
35
|
roleId: defaultRole.id,
|
|
36
|
-
emailVerified: !c.get(
|
|
36
|
+
emailVerified: !c.get("core").email?.adapter
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
export const signUp = async ({ email, name, newsletter, hashedPassword }, c)=>{
|
|
40
40
|
const convertToNameSEO = removeSpecialCharacters(name);
|
|
41
|
-
const checkIfUserExist = await c.get(
|
|
41
|
+
const checkIfUserExist = await c.get("db").select({
|
|
42
42
|
email: core_users.email,
|
|
43
43
|
name_code: core_users.nameCode
|
|
44
44
|
}).from(core_users).where(or(eq(core_users.email, email), eq(core_users.nameCode, convertToNameSEO)));
|
|
45
45
|
const findEmail = checkIfUserExist.find((user)=>user.email === email);
|
|
46
46
|
if (findEmail) {
|
|
47
|
-
throw new HTTPException(
|
|
48
|
-
message:
|
|
47
|
+
throw new HTTPException(409, {
|
|
48
|
+
message: "Email already exists"
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
const findName = checkIfUserExist.find((user)=>user.name_code === convertToNameSEO);
|
|
52
52
|
if (findName) {
|
|
53
|
-
throw new HTTPException(
|
|
54
|
-
message:
|
|
53
|
+
throw new HTTPException(409, {
|
|
54
|
+
message: "Name already exists"
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
const { roleId, emailVerified } = await getDefaultData(c);
|
|
58
|
-
const [data] = await c.get(
|
|
58
|
+
const [data] = await c.get("db").insert(core_users).values({
|
|
59
59
|
email,
|
|
60
60
|
name,
|
|
61
61
|
nameCode: convertToNameSEO,
|
|
@@ -65,9 +65,8 @@ export const signUp = async ({ email, name, newsletter, hashedPassword }, c)=>{
|
|
|
65
65
|
avatarColor: generateAvatarColor(name),
|
|
66
66
|
roleId,
|
|
67
67
|
emailVerified,
|
|
68
|
-
ipAddress: c.get(
|
|
68
|
+
ipAddress: c.get("ipAddress")
|
|
69
69
|
}).returning();
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
71
70
|
const { password: _, ...user } = data;
|
|
72
71
|
return user;
|
|
73
72
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../src/api/models/user.ts"],"names":[],"mappings":"AAIA,qBAAa,SAAS;IACpB,WAAW
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../src/api/models/user.ts"],"names":[],"mappings":"AAIA,qBAAa,SAAS;IACpB,WAAW;;;;;;;;;;;;;;;cAAe;IAC1B,kBAAkB;;;;;;;OAAsB;IACxC,MAAM;;;;kBAEq3C,CAAC;;;;;;;;;;;;;;OAF52C;CACjB"}
|
|
@@ -22,7 +22,7 @@ export declare const adminModule: import("../../../api/lib/module").BuildModuleR
|
|
|
22
22
|
responses: {
|
|
23
23
|
200: {
|
|
24
24
|
content: {
|
|
25
|
-
|
|
25
|
+
"application/json": {
|
|
26
26
|
schema: import("zod").ZodObject<{
|
|
27
27
|
user: import("zod").ZodObject<{
|
|
28
28
|
id: import("zod").ZodNumber;
|
|
@@ -120,7 +120,7 @@ export declare const adminModule: import("../../../api/lib/module").BuildModuleR
|
|
|
120
120
|
responses: {
|
|
121
121
|
200: {
|
|
122
122
|
content: {
|
|
123
|
-
|
|
123
|
+
"application/json": {
|
|
124
124
|
schema: import("zod").ZodObject<{
|
|
125
125
|
edges: import("zod").ZodArray<import("zod").ZodObject<{
|
|
126
126
|
id: import("zod").ZodNumber;
|
|
@@ -226,7 +226,7 @@ export declare const adminModule: import("../../../api/lib/module").BuildModuleR
|
|
|
226
226
|
responses: {
|
|
227
227
|
200: {
|
|
228
228
|
content: {
|
|
229
|
-
|
|
229
|
+
"application/json": {
|
|
230
230
|
schema: import("zod").ZodObject<{
|
|
231
231
|
edges: import("zod").ZodArray<import("zod").ZodObject<{
|
|
232
232
|
id: import("zod").ZodNumber;
|
|
@@ -5,7 +5,7 @@ import { sessionAdminRoute } from "./routes/session.route.js";
|
|
|
5
5
|
import { usersAdminModule } from "./users/users.admin.module.js";
|
|
6
6
|
export const adminModule = buildModule({
|
|
7
7
|
...CONFIG_PLUGIN,
|
|
8
|
-
name:
|
|
8
|
+
name: "admin",
|
|
9
9
|
routes: [
|
|
10
10
|
sessionAdminRoute
|
|
11
11
|
],
|
|
@@ -69,7 +69,7 @@ export declare const debugAdminModule: import("../../../lib/module").BuildModule
|
|
|
69
69
|
responses: {
|
|
70
70
|
200: {
|
|
71
71
|
content: {
|
|
72
|
-
|
|
72
|
+
"application/json": {
|
|
73
73
|
schema: import("zod").ZodObject<{
|
|
74
74
|
edges: import("zod").ZodArray<import("zod").ZodObject<{
|
|
75
75
|
id: import("zod").ZodNumber;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const logsDebugAdminRoute: {
|
|
3
3
|
handler: (c: import("hono").Context<import("../../../../middlewares/global.middleware").EnvVitNode, "/logs", {
|
|
4
4
|
in: {
|
|
@@ -70,7 +70,7 @@ export declare const logsDebugAdminRoute: {
|
|
|
70
70
|
responses: {
|
|
71
71
|
200: {
|
|
72
72
|
content: {
|
|
73
|
-
|
|
73
|
+
"application/json": {
|
|
74
74
|
schema: z.ZodObject<{
|
|
75
75
|
edges: z.ZodArray<z.ZodObject<{
|
|
76
76
|
id: z.ZodNumber;
|
|
@@ -8,34 +8,34 @@ import { withPagination, zodPaginationPageInfo, zodPaginationQuery } from "../..
|
|
|
8
8
|
export const logsDebugAdminRoute = buildRoute({
|
|
9
9
|
...CONFIG_PLUGIN,
|
|
10
10
|
route: {
|
|
11
|
-
method:
|
|
12
|
-
description:
|
|
13
|
-
path:
|
|
11
|
+
method: "get",
|
|
12
|
+
description: "Get Admin Debug Logs",
|
|
13
|
+
path: "/logs",
|
|
14
14
|
request: {
|
|
15
15
|
query: zodPaginationQuery.extend({
|
|
16
16
|
order: z.enum([
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
"asc",
|
|
18
|
+
"desc"
|
|
19
19
|
]).optional(),
|
|
20
20
|
orderBy: z.enum([
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
"type",
|
|
22
|
+
"createdAt",
|
|
23
|
+
"pluginId"
|
|
24
24
|
]).optional()
|
|
25
25
|
})
|
|
26
26
|
},
|
|
27
27
|
responses: {
|
|
28
28
|
200: {
|
|
29
29
|
content: {
|
|
30
|
-
|
|
30
|
+
"application/json": {
|
|
31
31
|
schema: z.object({
|
|
32
32
|
edges: z.array(z.object({
|
|
33
33
|
id: z.number(),
|
|
34
34
|
pluginId: z.string(),
|
|
35
35
|
type: z.enum([
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
"warn",
|
|
37
|
+
"error",
|
|
38
|
+
"debug"
|
|
39
39
|
]),
|
|
40
40
|
content: z.string(),
|
|
41
41
|
createdAt: z.date(),
|
|
@@ -54,18 +54,18 @@ export const logsDebugAdminRoute = buildRoute({
|
|
|
54
54
|
})
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
-
description:
|
|
57
|
+
description: "List of users"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
handler: async (c)=>{
|
|
62
|
-
const query = c.req.valid(
|
|
62
|
+
const query = c.req.valid("query");
|
|
63
63
|
const data = await withPagination({
|
|
64
64
|
params: {
|
|
65
65
|
query
|
|
66
66
|
},
|
|
67
67
|
primaryCursor: core_logs.id,
|
|
68
|
-
query: async ({ limit, where, orderBy })=>await c.get(
|
|
68
|
+
query: async ({ limit, where, orderBy })=>await c.get("db").select({
|
|
69
69
|
id: core_logs.id,
|
|
70
70
|
pluginId: core_logs.pluginId,
|
|
71
71
|
type: core_logs.type,
|
|
@@ -85,7 +85,7 @@ export const logsDebugAdminRoute = buildRoute({
|
|
|
85
85
|
table: core_logs,
|
|
86
86
|
orderBy: {
|
|
87
87
|
column: query.orderBy ? core_logs[query.orderBy] : core_logs.createdAt,
|
|
88
|
-
order: query.order ??
|
|
88
|
+
order: query.order ?? "desc"
|
|
89
89
|
},
|
|
90
90
|
c
|
|
91
91
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const sessionAdminRoute: {
|
|
3
3
|
handler: (c: import("hono").Context<import("../../../middlewares/global.middleware").EnvVitNode, "/session", {}>) => Response & import("hono").TypedResponse<{
|
|
4
4
|
user: {
|
|
@@ -23,7 +23,7 @@ export declare const sessionAdminRoute: {
|
|
|
23
23
|
responses: {
|
|
24
24
|
200: {
|
|
25
25
|
content: {
|
|
26
|
-
|
|
26
|
+
"application/json": {
|
|
27
27
|
schema: z.ZodObject<{
|
|
28
28
|
user: z.ZodObject<{
|
|
29
29
|
id: z.ZodNumber;
|
|
@@ -5,13 +5,13 @@ import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
|
5
5
|
export const sessionAdminRoute = buildRoute({
|
|
6
6
|
...CONFIG_PLUGIN,
|
|
7
7
|
route: {
|
|
8
|
-
method:
|
|
9
|
-
description:
|
|
10
|
-
path:
|
|
8
|
+
method: "get",
|
|
9
|
+
description: "Verify admin session",
|
|
10
|
+
path: "/session",
|
|
11
11
|
responses: {
|
|
12
12
|
200: {
|
|
13
13
|
content: {
|
|
14
|
-
|
|
14
|
+
"application/json": {
|
|
15
15
|
schema: z.object({
|
|
16
16
|
user: z.object({
|
|
17
17
|
id: z.number(),
|
|
@@ -29,15 +29,15 @@ export const sessionAdminRoute = buildRoute({
|
|
|
29
29
|
})
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
description:
|
|
32
|
+
description: "User"
|
|
33
33
|
},
|
|
34
34
|
403: {
|
|
35
|
-
description:
|
|
35
|
+
description: "Access Denied"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
handler: (c)=>{
|
|
40
|
-
const user = c.get(
|
|
40
|
+
const user = c.get("admin")?.user;
|
|
41
41
|
if (!user) throw new HTTPException(403);
|
|
42
42
|
return c.json({
|
|
43
43
|
user,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
2
|
export declare const listUsersAdminRoute: {
|
|
3
3
|
handler: (c: import("hono").Context<import("../../../../middlewares/global.middleware").EnvVitNode, "/list", {
|
|
4
4
|
in: {
|
|
@@ -65,7 +65,7 @@ export declare const listUsersAdminRoute: {
|
|
|
65
65
|
responses: {
|
|
66
66
|
200: {
|
|
67
67
|
content: {
|
|
68
|
-
|
|
68
|
+
"application/json": {
|
|
69
69
|
schema: z.ZodObject<{
|
|
70
70
|
edges: z.ZodArray<z.ZodObject<{
|
|
71
71
|
id: z.ZodNumber;
|