@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useTranslations } from "next-intl";
|
|
4
4
|
import { AutoForm } from "../../../../components/form/auto-form.js";
|
|
@@ -6,29 +6,29 @@ import { AutoFormCheckbox } from "../../../../components/form/fields/checkbox.js
|
|
|
6
6
|
import { AutoFormInput } from "../../../../components/form/fields/input.js";
|
|
7
7
|
import { Link } from "../../../../lib/navigation.js";
|
|
8
8
|
import { removeSpecialCharacters } from "../../../../lib/special-characters.js";
|
|
9
|
-
import { PasswordInput } from "
|
|
9
|
+
import { PasswordInput } from "../components/password-input.js";
|
|
10
10
|
import { useFormSignUp } from "./use-form.js";
|
|
11
11
|
export const FormSignUp = ({ isEmail, captcha })=>{
|
|
12
|
-
const t = useTranslations(
|
|
12
|
+
const t = useTranslations("core.auth.sign_up");
|
|
13
13
|
const { onSubmit, formSchema } = useFormSignUp();
|
|
14
14
|
return /*#__PURE__*/ _jsx(AutoForm, {
|
|
15
15
|
captcha: captcha,
|
|
16
16
|
fields: [
|
|
17
17
|
{
|
|
18
|
-
id:
|
|
18
|
+
id: "name",
|
|
19
19
|
component: ({ field, ...props })=>{
|
|
20
|
-
const value = field.value ??
|
|
20
|
+
const value = field.value ?? "";
|
|
21
21
|
return /*#__PURE__*/ _jsxs("div", {
|
|
22
22
|
className: "space-y-2",
|
|
23
23
|
children: [
|
|
24
24
|
/*#__PURE__*/ _jsx(AutoFormInput, {
|
|
25
25
|
field: field,
|
|
26
|
-
label: t(
|
|
26
|
+
label: t("username.label"),
|
|
27
27
|
...props
|
|
28
28
|
}),
|
|
29
29
|
value.length >= 3 && /*#__PURE__*/ _jsx("div", {
|
|
30
30
|
className: "text-muted-foreground text-sm",
|
|
31
|
-
children: t.rich(
|
|
31
|
+
children: t.rich("username.your_user_code", {
|
|
32
32
|
code: ()=>/*#__PURE__*/ _jsx("span", {
|
|
33
33
|
className: "text-foreground",
|
|
34
34
|
children: removeSpecialCharacters(value)
|
|
@@ -40,63 +40,50 @@ export const FormSignUp = ({ isEmail, captcha })=>{
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
id:
|
|
43
|
+
id: "email",
|
|
44
44
|
component: (props)=>/*#__PURE__*/ _jsx(AutoFormInput, {
|
|
45
|
-
label: t(
|
|
46
|
-
type: "email",
|
|
45
|
+
label: t("email.label"),
|
|
47
46
|
...props
|
|
48
47
|
})
|
|
49
48
|
},
|
|
50
49
|
{
|
|
51
|
-
id:
|
|
50
|
+
id: "password",
|
|
52
51
|
component: (props)=>/*#__PURE__*/ _jsx(PasswordInput, {
|
|
53
|
-
label: t(
|
|
52
|
+
label: t("password.label"),
|
|
54
53
|
...props
|
|
55
54
|
})
|
|
56
55
|
},
|
|
57
56
|
{
|
|
58
|
-
id:
|
|
57
|
+
id: "terms",
|
|
59
58
|
component: (props)=>/*#__PURE__*/ _jsx(AutoFormCheckbox, {
|
|
60
59
|
...props,
|
|
61
|
-
description: t.rich(
|
|
60
|
+
description: t.rich("terms.desc", {
|
|
62
61
|
link: (text)=>/*#__PURE__*/ _jsx(Link, {
|
|
63
62
|
className: "text-primary",
|
|
64
63
|
href: "/terms",
|
|
65
64
|
children: text
|
|
66
65
|
})
|
|
67
66
|
}),
|
|
68
|
-
label: t(
|
|
67
|
+
label: t("terms.label")
|
|
69
68
|
})
|
|
70
69
|
},
|
|
71
70
|
...isEmail ? [
|
|
72
71
|
{
|
|
73
|
-
id:
|
|
72
|
+
id: "newsletter",
|
|
74
73
|
component: (props)=>/*#__PURE__*/ _jsx(AutoFormCheckbox, {
|
|
75
74
|
...props,
|
|
76
|
-
description: t(
|
|
77
|
-
label: t(
|
|
75
|
+
description: t("newsletter.desc"),
|
|
76
|
+
label: t("newsletter.label")
|
|
78
77
|
})
|
|
79
78
|
}
|
|
80
|
-
] : []
|
|
81
|
-
{
|
|
82
|
-
id: 'test',
|
|
83
|
-
label: 'elo',
|
|
84
|
-
description: 'Test with default'
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
id: 'test.test123',
|
|
88
|
-
component: (props)=>/*#__PURE__*/ _jsx(AutoFormInput, {
|
|
89
|
-
label: "fsaf",
|
|
90
|
-
...props
|
|
91
|
-
})
|
|
92
|
-
}
|
|
79
|
+
] : []
|
|
93
80
|
],
|
|
94
81
|
formSchema: formSchema,
|
|
95
82
|
mode: "all",
|
|
96
83
|
onSubmit: onSubmit,
|
|
97
84
|
submitButtonProps: {
|
|
98
|
-
className:
|
|
99
|
-
children: t(
|
|
85
|
+
className: "w-full",
|
|
86
|
+
children: t("submit")
|
|
100
87
|
}
|
|
101
88
|
});
|
|
102
89
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { z } from
|
|
2
|
-
import type { zodSignUpSchema } from
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { zodSignUpSchema } from "../../../../api/modules/users/routes/sign-up.route";
|
|
3
3
|
export declare const mutationApi: ({ captchaToken, ...input }: z.infer<typeof zodSignUpSchema> & {
|
|
4
|
-
captchaToken:
|
|
4
|
+
captchaToken: string;
|
|
5
5
|
}) => Promise<{
|
|
6
6
|
error: string;
|
|
7
7
|
data?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-up/form/mutation-api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-up/form/mutation-api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAMhF,eAAO,MAAM,WAAW,GAAU,4BAG/B,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,GAAG;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;EAuB5D,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
"use server";
|
|
2
2
|
import { revalidatePath } from "next/cache";
|
|
3
3
|
import { usersModule } from "../../../../api/modules/users/users.module.js";
|
|
4
4
|
import { fetcher } from "../../../../lib/fetcher.js";
|
|
5
5
|
import { redirect } from "../../../../lib/navigation.js";
|
|
6
6
|
export const mutationApi = async ({ captchaToken, ...input })=>{
|
|
7
7
|
const res = await fetcher(usersModule, {
|
|
8
|
-
path:
|
|
9
|
-
method:
|
|
10
|
-
module:
|
|
8
|
+
path: "/sign_up",
|
|
9
|
+
method: "post",
|
|
10
|
+
module: "users",
|
|
11
11
|
allowSaveCookies: true,
|
|
12
12
|
captchaToken,
|
|
13
13
|
args: {
|
|
@@ -21,8 +21,8 @@ export const mutationApi = async ({ captchaToken, ...input })=>{
|
|
|
21
21
|
}
|
|
22
22
|
const data = await res.json();
|
|
23
23
|
if (data.emailVerified) {
|
|
24
|
-
revalidatePath(
|
|
25
|
-
await redirect(
|
|
24
|
+
revalidatePath("/[locale]/(main)", "layout");
|
|
25
|
+
await redirect("/");
|
|
26
26
|
}
|
|
27
27
|
return {
|
|
28
28
|
data
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import type { AutoFormOnSubmit } from
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AutoFormOnSubmit } from "../../../../components/form/auto-form";
|
|
3
|
+
export declare const usePasswordZodSchema: () => z.ZodDefault<z.ZodString>;
|
|
3
4
|
export declare const useFormSignUp: () => {
|
|
4
5
|
onSubmit: AutoFormOnSubmit<z.ZodObject<{
|
|
5
6
|
name: z.ZodDefault<z.ZodString>;
|
|
@@ -7,9 +8,6 @@ export declare const useFormSignUp: () => {
|
|
|
7
8
|
password: z.ZodDefault<z.ZodString>;
|
|
8
9
|
terms: z.ZodDefault<z.ZodBoolean>;
|
|
9
10
|
newsletter: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
10
|
-
test: z.ZodObject<{
|
|
11
|
-
test123: z.ZodDefault<z.ZodString>;
|
|
12
|
-
}, z.core.$strip>;
|
|
13
11
|
}, z.core.$strip>>;
|
|
14
12
|
formSchema: z.ZodObject<{
|
|
15
13
|
name: z.ZodDefault<z.ZodString>;
|
|
@@ -17,9 +15,6 @@ export declare const useFormSignUp: () => {
|
|
|
17
15
|
password: z.ZodDefault<z.ZodString>;
|
|
18
16
|
terms: z.ZodDefault<z.ZodBoolean>;
|
|
19
17
|
newsletter: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
20
|
-
test: z.ZodObject<{
|
|
21
|
-
test123: z.ZodDefault<z.ZodString>;
|
|
22
|
-
}, z.core.$strip>;
|
|
23
18
|
}, z.core.$strip>;
|
|
24
19
|
};
|
|
25
20
|
//# sourceMappingURL=use-form.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-up/form/use-form.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAKpE,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-up/form/use-form.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAKpE,eAAO,MAAM,oBAAoB,iCAchC,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;CA8EzB,CAAC"}
|
|
@@ -3,26 +3,29 @@ import { toast } from "sonner";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { useWrapperSignUp } from "../wrapper.js";
|
|
5
5
|
import { mutationApi } from "./mutation-api.js";
|
|
6
|
+
export const usePasswordZodSchema = ()=>{
|
|
7
|
+
const t = useTranslations("core.auth.sign_up");
|
|
8
|
+
const tError = useTranslations("core.global.errors");
|
|
9
|
+
const invalidPassword = t("password.invalid");
|
|
10
|
+
return z.string({
|
|
11
|
+
message: tError("field_required")
|
|
12
|
+
}).regex(/^.{8,}$/, invalidPassword).regex(/[A-Z]/, invalidPassword).regex(/\d/, invalidPassword).regex(/\W|_/, invalidPassword).default("");
|
|
13
|
+
};
|
|
6
14
|
export const useFormSignUp = ()=>{
|
|
7
|
-
const t = useTranslations(
|
|
8
|
-
const tError = useTranslations(
|
|
9
|
-
const
|
|
15
|
+
const t = useTranslations("core.auth.sign_up");
|
|
16
|
+
const tError = useTranslations("core.global.errors");
|
|
17
|
+
const passwordSchema = usePasswordZodSchema();
|
|
10
18
|
const formSchema = z.object({
|
|
11
19
|
name: z.string({
|
|
12
|
-
message: tError(
|
|
13
|
-
}).min(3, t(
|
|
20
|
+
message: tError("field_required")
|
|
21
|
+
}).min(3, t("username.min_length")).max(32, t("username.max_length")).default(""),
|
|
14
22
|
// .refine(value => nameRegex.test(value), t('name.invalid'))
|
|
15
23
|
email: z.email({
|
|
16
|
-
message: t(
|
|
17
|
-
}).default(
|
|
18
|
-
password:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
terms: z.boolean().refine((value)=>value, t('terms.required')).default(false),
|
|
22
|
-
newsletter: z.boolean().default(false).optional(),
|
|
23
|
-
test: z.object({
|
|
24
|
-
test123: z.string().default('test with default')
|
|
25
|
-
})
|
|
24
|
+
message: t("email.invalid")
|
|
25
|
+
}).default("test@test.com"),
|
|
26
|
+
password: passwordSchema,
|
|
27
|
+
terms: z.boolean().refine((value)=>value, t("terms.required")).default(false),
|
|
28
|
+
newsletter: z.boolean().default(false).optional()
|
|
26
29
|
});
|
|
27
30
|
const { setShowSendingEmail } = useWrapperSignUp();
|
|
28
31
|
const onSubmit = async (values, form, { captchaToken })=>{
|
|
@@ -37,27 +40,27 @@ export const useFormSignUp = ()=>{
|
|
|
37
40
|
return;
|
|
38
41
|
}
|
|
39
42
|
const errorMessages = {
|
|
40
|
-
|
|
41
|
-
field:
|
|
42
|
-
message: t(
|
|
43
|
+
"Email already exists": {
|
|
44
|
+
field: "email",
|
|
45
|
+
message: t("email.exists")
|
|
43
46
|
},
|
|
44
|
-
|
|
45
|
-
field:
|
|
46
|
-
message: t(
|
|
47
|
+
"Name already exists": {
|
|
48
|
+
field: "name",
|
|
49
|
+
message: t("username.exists")
|
|
47
50
|
}
|
|
48
51
|
};
|
|
49
52
|
const errorConfig = errorMessages[mutation.error];
|
|
50
53
|
if (errorConfig) {
|
|
51
54
|
form.setError(errorConfig.field, {
|
|
52
|
-
type:
|
|
55
|
+
type: "manual",
|
|
53
56
|
message: errorConfig.message
|
|
54
57
|
}, {
|
|
55
58
|
shouldFocus: true
|
|
56
59
|
});
|
|
57
60
|
return;
|
|
58
61
|
}
|
|
59
|
-
toast.error(tError(
|
|
60
|
-
description: tError(
|
|
62
|
+
toast.error(tError("title"), {
|
|
63
|
+
description: tError("internal_server_error")
|
|
61
64
|
});
|
|
62
65
|
};
|
|
63
66
|
return {
|
|
@@ -10,8 +10,8 @@ import { FormSignUp } from "./form/form.js";
|
|
|
10
10
|
import { WrapperSignUp } from "./wrapper.js";
|
|
11
11
|
export const SignUpView = async ()=>{
|
|
12
12
|
const [t, tGlobal, { isEmail, captcha }] = await Promise.all([
|
|
13
|
-
getTranslations(
|
|
14
|
-
getTranslations(
|
|
13
|
+
getTranslations("core.auth.sign_up"),
|
|
14
|
+
getTranslations("core.global"),
|
|
15
15
|
getMiddlewareApi()
|
|
16
16
|
]);
|
|
17
17
|
return /*#__PURE__*/ _jsx(I18nProvider, {
|
|
@@ -30,10 +30,10 @@ export const SignUpView = async ()=>{
|
|
|
30
30
|
children: [
|
|
31
31
|
/*#__PURE__*/ _jsx("h1", {
|
|
32
32
|
className: "text-2xl font-semibold leading-none tracking-tight",
|
|
33
|
-
children: tGlobal(
|
|
33
|
+
children: tGlobal("register")
|
|
34
34
|
}),
|
|
35
35
|
/*#__PURE__*/ _jsx(CardDescription, {
|
|
36
|
-
children: t(
|
|
36
|
+
children: t("desc")
|
|
37
37
|
})
|
|
38
38
|
]
|
|
39
39
|
}),
|
|
@@ -49,9 +49,9 @@ export const SignUpView = async ()=>{
|
|
|
49
49
|
}),
|
|
50
50
|
/*#__PURE__*/ _jsx("div", {
|
|
51
51
|
className: "text-accent-foreground p-6 text-center text-sm",
|
|
52
|
-
children: t.rich(
|
|
52
|
+
children: t.rich("already_have_account", {
|
|
53
53
|
link: (text)=>/*#__PURE__*/ _jsx(Link, {
|
|
54
|
-
className: "font-semibold",
|
|
54
|
+
className: "text-primary font-semibold",
|
|
55
55
|
href: "/login",
|
|
56
56
|
children: text
|
|
57
57
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../../../src/views/auth/sign-up/wrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,eAAO,MAAM,gBAAgB;yBALN,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;CAKE,CAAC;AAEtE,eAAO,MAAM,aAAa,GAAI,cAAc;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../../../src/views/auth/sign-up/wrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,eAAO,MAAM,gBAAgB;yBALN,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;CAKE,CAAC;AAEtE,eAAO,MAAM,aAAa,GAAI,cAAc;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,4CAQxE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { EmailConfirmationView } from "./email-confirmation-view.js";
|
|
@@ -7,14 +7,11 @@ const WrapperSignUpContext = /*#__PURE__*/ React.createContext({
|
|
|
7
7
|
});
|
|
8
8
|
export const useWrapperSignUp = ()=>React.use(WrapperSignUpContext);
|
|
9
9
|
export const WrapperSignUp = ({ children })=>{
|
|
10
|
-
const [sendingEmail, setShowSendingEmail] = React.useState(
|
|
11
|
-
const contextValue = React.useMemo(()=>({
|
|
12
|
-
setShowSendingEmail
|
|
13
|
-
}), [
|
|
14
|
-
setShowSendingEmail
|
|
15
|
-
]);
|
|
10
|
+
const [sendingEmail, setShowSendingEmail] = React.useState("");
|
|
16
11
|
return /*#__PURE__*/ _jsx(WrapperSignUpContext, {
|
|
17
|
-
value:
|
|
12
|
+
value: {
|
|
13
|
+
setShowSendingEmail
|
|
14
|
+
},
|
|
18
15
|
children: sendingEmail ? /*#__PURE__*/ _jsx(EmailConfirmationView, {
|
|
19
16
|
email: sendingEmail
|
|
20
17
|
}) : children
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useTranslations } from "next-intl";
|
|
4
4
|
import { toast } from "sonner";
|
|
5
5
|
import { Button } from "../../../../components/ui/button.js";
|
|
6
6
|
import { mutationApi } from "./mutation-api.js";
|
|
7
7
|
export const ButtonSSOButtons = ({ children, providerId })=>{
|
|
8
|
-
const tErrors = useTranslations(
|
|
8
|
+
const tErrors = useTranslations("core.global.errors");
|
|
9
9
|
return /*#__PURE__*/ _jsx(Button, {
|
|
10
10
|
className: "bg-card w-[calc(50%-0.5rem)]",
|
|
11
11
|
onClick: async ()=>{
|
|
12
12
|
const mutation = await mutationApi(providerId);
|
|
13
13
|
if (mutation?.message) {
|
|
14
|
-
toast.error(tErrors(
|
|
15
|
-
description: tErrors(
|
|
14
|
+
toast.error(tErrors("title"), {
|
|
15
|
+
description: tErrors("internal_server_error")
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
},
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use server";
|
|
2
2
|
import { usersModule } from "../../../../api/modules/users/users.module.js";
|
|
3
3
|
import { fetcher } from "../../../../lib/fetcher.js";
|
|
4
4
|
import { redirect } from "../../../../lib/navigation.js";
|
|
5
5
|
export const mutationApi = async (providerId)=>{
|
|
6
6
|
const res = await fetcher(usersModule, {
|
|
7
|
-
path:
|
|
8
|
-
method:
|
|
9
|
-
module:
|
|
7
|
+
path: "/{providerId}",
|
|
8
|
+
method: "post",
|
|
9
|
+
module: "users/sso",
|
|
10
10
|
args: {
|
|
11
11
|
params: {
|
|
12
12
|
providerId
|
|
@@ -16,7 +16,7 @@ export const mutationApi = async (providerId)=>{
|
|
|
16
16
|
});
|
|
17
17
|
if (res.status !== 200) {
|
|
18
18
|
return {
|
|
19
|
-
message:
|
|
19
|
+
message: "Something is wrong"
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
const data = await res.json();
|
|
@@ -18,7 +18,7 @@ export const SSOButtonsSkeleton = ()=>{
|
|
|
18
18
|
};
|
|
19
19
|
export const SSOButtons = async ()=>{
|
|
20
20
|
const [t, { sso }] = await Promise.all([
|
|
21
|
-
getTranslations(
|
|
21
|
+
getTranslations("core.auth.sso"),
|
|
22
22
|
getMiddlewareApi()
|
|
23
23
|
]);
|
|
24
24
|
if (!sso.length) {
|
|
@@ -39,7 +39,7 @@ export const SSOButtons = async ()=>{
|
|
|
39
39
|
className: "relative flex justify-center text-xs",
|
|
40
40
|
children: /*#__PURE__*/ _jsx("span", {
|
|
41
41
|
className: "bg-card text-muted-foreground px-4",
|
|
42
|
-
children: t(
|
|
42
|
+
children: t("or")
|
|
43
43
|
})
|
|
44
44
|
})
|
|
45
45
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback-sso-view.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sso/callback/callback-sso-view.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"callback-sso-view.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sso/callback/callback-sso-view.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,GAAU,uDAGnC;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,qDAwBA,CAAC"}
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getTranslations } from "next-intl/server";
|
|
3
|
+
import { I18nProvider } from "../../../../components/i18n-provider.js";
|
|
3
4
|
import { ErrorView } from "../../../error/error-view.js";
|
|
5
|
+
import { getMiddlewareApi } from "../../../../lib/api/get-middleware-api.js";
|
|
4
6
|
import { ClientCallbackSSO } from "./client/client.js";
|
|
5
7
|
export const CallbackSSOView = async ({ providerId, searchParams: { code, error, state } })=>{
|
|
6
|
-
const t = await
|
|
7
|
-
|
|
8
|
+
const [t, { sso }] = await Promise.all([
|
|
9
|
+
getTranslations("core.auth.sso"),
|
|
10
|
+
getMiddlewareApi()
|
|
11
|
+
]);
|
|
12
|
+
if (error === "access_denied") {
|
|
8
13
|
return /*#__PURE__*/ _jsx(ErrorView, {
|
|
9
14
|
code: 403,
|
|
10
|
-
customDescription: t(
|
|
15
|
+
customDescription: t("access_denied")
|
|
11
16
|
});
|
|
12
17
|
}
|
|
13
|
-
return /*#__PURE__*/ _jsx(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
return /*#__PURE__*/ _jsx(I18nProvider, {
|
|
19
|
+
namespaces: [
|
|
20
|
+
"core.auth.sso"
|
|
21
|
+
],
|
|
22
|
+
children: error === "access_denied" ? /*#__PURE__*/ _jsx(ErrorView, {
|
|
23
|
+
code: 403,
|
|
24
|
+
customDescription: t("access_denied")
|
|
25
|
+
}) : /*#__PURE__*/ _jsx(ClientCallbackSSO, {
|
|
26
|
+
code: code,
|
|
27
|
+
providerId: providerId,
|
|
28
|
+
sso: sso,
|
|
29
|
+
state: state
|
|
30
|
+
})
|
|
17
31
|
});
|
|
18
32
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import type { getMiddlewareApi } from "../../../../../lib/api/get-middleware-api";
|
|
2
|
+
export declare const ClientCallbackSSO: ({ providerId, code, state, sso, }: {
|
|
2
3
|
code: string;
|
|
3
4
|
providerId: string;
|
|
5
|
+
sso: Awaited<ReturnType<typeof getMiddlewareApi>>["sso"];
|
|
4
6
|
state: string;
|
|
5
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/auth/sso/callback/client/client.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/auth/sso/callback/client/client.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAGlF,eAAO,MAAM,iBAAiB,GAAI,mCAK/B;IACD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACzD,KAAK,EAAE,MAAM,CAAC;CACf,4CAsDA,CAAC"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
import { useTranslations } from "next-intl";
|
|
4
5
|
import { Loader } from "../../../../../components/ui/loader.js";
|
|
5
|
-
import { useRouter } from "../../../../../lib/navigation.js";
|
|
6
|
+
import { Link, useRouter } from "../../../../../lib/navigation.js";
|
|
6
7
|
import { ErrorView } from "../../../../error/error-view.js";
|
|
8
|
+
import { Button } from "../../../../../components/ui/button.js";
|
|
7
9
|
import { mutationApi } from "./mutation-api.js";
|
|
8
|
-
export const ClientCallbackSSO = ({ providerId, code, state })=>{
|
|
10
|
+
export const ClientCallbackSSO = ({ providerId, code, state, sso })=>{
|
|
11
|
+
const t = useTranslations("core.auth.sso");
|
|
9
12
|
const { replace } = useRouter();
|
|
10
|
-
const { isError } = useQuery({
|
|
13
|
+
const { isError, error } = useQuery({
|
|
11
14
|
queryKey: [
|
|
12
|
-
|
|
15
|
+
"core.auth.sso.callback.sign-up",
|
|
13
16
|
providerId,
|
|
14
17
|
code
|
|
15
18
|
],
|
|
@@ -22,11 +25,37 @@ export const ClientCallbackSSO = ({ providerId, code, state })=>{
|
|
|
22
25
|
if (mutation?.error) {
|
|
23
26
|
throw new Error(mutation.error);
|
|
24
27
|
}
|
|
25
|
-
replace(
|
|
26
|
-
return
|
|
28
|
+
replace("/");
|
|
29
|
+
return "";
|
|
27
30
|
},
|
|
28
31
|
retry: false
|
|
29
32
|
});
|
|
33
|
+
const provider = sso.find((p)=>p.id === providerId);
|
|
34
|
+
if (error?.message === "Email already exists") {
|
|
35
|
+
return /*#__PURE__*/ _jsx(ErrorView, {
|
|
36
|
+
code: 409,
|
|
37
|
+
customActions: /*#__PURE__*/ _jsx(Button, {
|
|
38
|
+
asChild: true,
|
|
39
|
+
size: "lg",
|
|
40
|
+
children: /*#__PURE__*/ _jsx(Link, {
|
|
41
|
+
href: "/login",
|
|
42
|
+
children: t("email_exists.sign_in")
|
|
43
|
+
})
|
|
44
|
+
}),
|
|
45
|
+
customDescription: t.rich("email_exists.desc", {
|
|
46
|
+
provider: ()=>/*#__PURE__*/ _jsx("span", {
|
|
47
|
+
className: "font-semibold",
|
|
48
|
+
children: provider?.name ?? providerId
|
|
49
|
+
})
|
|
50
|
+
}),
|
|
51
|
+
customTitle: t.rich("email_exists.title", {
|
|
52
|
+
provider: ()=>/*#__PURE__*/ _jsx("span", {
|
|
53
|
+
className: "font-semibold",
|
|
54
|
+
children: provider?.name ?? providerId
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
}
|
|
30
59
|
if (isError) {
|
|
31
60
|
return /*#__PURE__*/ _jsx(ErrorView, {
|
|
32
61
|
code: 500
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/auth/sso/callback/client/mutation-api.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,GAAU,8BAI/B;IACD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;;
|
|
1
|
+
{"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../../src/views/auth/sso/callback/client/mutation-api.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,GAAU,8BAI/B;IACD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;;cA0BA,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
"use server";
|
|
2
2
|
import { revalidatePath } from "next/cache";
|
|
3
3
|
import { usersModule } from "../../../../../api/modules/users/users.module.js";
|
|
4
4
|
import { fetcher } from "../../../../../lib/fetcher.js";
|
|
5
5
|
export const mutationApi = async ({ code, providerId, state })=>{
|
|
6
6
|
const res = await fetcher(usersModule, {
|
|
7
|
-
path:
|
|
8
|
-
method:
|
|
9
|
-
module:
|
|
7
|
+
path: "/{providerId}/callback",
|
|
8
|
+
method: "get",
|
|
9
|
+
module: "users/sso",
|
|
10
10
|
allowSaveCookies: true,
|
|
11
11
|
args: {
|
|
12
12
|
params: {
|
|
@@ -18,10 +18,15 @@ export const mutationApi = async ({ code, providerId, state })=>{
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
+
if (res.status === 409) {
|
|
22
|
+
return {
|
|
23
|
+
error: "Email already exists"
|
|
24
|
+
};
|
|
25
|
+
}
|
|
21
26
|
if (res.status !== 200) {
|
|
22
27
|
return {
|
|
23
|
-
error:
|
|
28
|
+
error: "Something went wrong"
|
|
24
29
|
};
|
|
25
30
|
}
|
|
26
|
-
revalidatePath(
|
|
31
|
+
revalidatePath("/[locale]/(main)", "layout");
|
|
27
32
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export declare const ErrorView: ({ code, customDescription, }: {
|
|
2
|
-
code: 400 | 403 | 404 | 500;
|
|
3
|
-
|
|
1
|
+
export declare const ErrorView: ({ code, customDescription, customTitle, customActions, }: {
|
|
2
|
+
code: 400 | 403 | 404 | 409 | 500;
|
|
3
|
+
customActions?: React.ReactNode;
|
|
4
|
+
customDescription?: React.ReactNode;
|
|
5
|
+
customTitle?: React.ReactNode;
|
|
4
6
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
5
7
|
//# sourceMappingURL=error-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-view.d.ts","sourceRoot":"","sources":["../../../../src/views/error/error-view.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS,GAAI,
|
|
1
|
+
{"version":3,"file":"error-view.d.ts","sourceRoot":"","sources":["../../../../src/views/error/error-view.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,SAAS,GAAI,0DAKvB;IACD,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAClC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACpC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC/B,4CAyCA,CAAC"}
|