@vitnode/core 1.2.0-canary.51 → 1.2.0-canary.52

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.
Files changed (164) hide show
  1. package/dist/scripts/scripts.js +2 -2
  2. package/dist/src/api/middlewares/global.middleware.d.ts +2 -10
  3. package/dist/src/api/middlewares/global.middleware.d.ts.map +1 -1
  4. package/dist/src/api/models/email.d.ts +24 -8
  5. package/dist/src/api/models/email.d.ts.map +1 -1
  6. package/dist/src/api/models/email.js +27 -15
  7. package/dist/src/api/models/password.d.ts +4 -0
  8. package/dist/src/api/models/password.d.ts.map +1 -1
  9. package/dist/src/api/models/password.js +8 -0
  10. package/dist/src/api/models/session-admin.d.ts +1 -0
  11. package/dist/src/api/models/session-admin.d.ts.map +1 -1
  12. package/dist/src/api/models/session.d.ts +1 -0
  13. package/dist/src/api/models/session.d.ts.map +1 -1
  14. package/dist/src/api/models/sso.d.ts.map +1 -1
  15. package/dist/src/api/models/sso.js +8 -5
  16. package/dist/src/api/models/user/get-user-by-id.d.ts +1 -0
  17. package/dist/src/api/models/user/get-user-by-id.d.ts.map +1 -1
  18. package/dist/src/api/models/user/get-user-by-id.js +2 -1
  19. package/dist/src/api/models/user/sign-up.js +2 -2
  20. package/dist/src/api/models/user.d.ts +1 -0
  21. package/dist/src/api/models/user.d.ts.map +1 -1
  22. package/dist/src/api/modules/users/routes/change-password.route.d.ts +52 -0
  23. package/dist/src/api/modules/users/routes/change-password.route.d.ts.map +1 -0
  24. package/dist/src/api/modules/users/routes/change-password.route.js +58 -0
  25. package/dist/src/api/modules/users/routes/reset-passowrd.route.d.ts +42 -0
  26. package/dist/src/api/modules/users/routes/reset-passowrd.route.d.ts.map +1 -0
  27. package/dist/src/api/modules/users/routes/reset-passowrd.route.js +91 -0
  28. package/dist/src/api/modules/users/routes/sign-up.route.d.ts +6 -0
  29. package/dist/src/api/modules/users/routes/sign-up.route.d.ts.map +1 -1
  30. package/dist/src/api/modules/users/routes/sign-up.route.js +6 -0
  31. package/dist/src/api/modules/users/routes/test.route.d.ts.map +1 -1
  32. package/dist/src/api/modules/users/routes/test.route.js +0 -6
  33. package/dist/src/api/modules/users/sso/routes/callback.route.d.ts +4 -1
  34. package/dist/src/api/modules/users/sso/routes/callback.route.d.ts.map +1 -1
  35. package/dist/src/api/modules/users/sso/routes/callback.route.js +3 -0
  36. package/dist/src/api/modules/users/sso/sso.module.d.ts +4 -1
  37. package/dist/src/api/modules/users/sso/sso.module.d.ts.map +1 -1
  38. package/dist/src/api/modules/users/users.module.d.ts +93 -1
  39. package/dist/src/api/modules/users/users.module.d.ts.map +1 -1
  40. package/dist/src/api/modules/users/users.module.js +5 -1
  41. package/dist/src/app/login/reset-password/page.d.ts +9 -0
  42. package/dist/src/app/login/reset-password/page.d.ts.map +1 -0
  43. package/dist/src/app/login/reset-password/page.js +18 -0
  44. package/dist/src/components/form/auto-form.d.ts +2 -1
  45. package/dist/src/components/form/auto-form.d.ts.map +1 -1
  46. package/dist/src/components/form/auto-form.js +3 -2
  47. package/dist/src/components/form/common/label.d.ts +3 -1
  48. package/dist/src/components/form/common/label.d.ts.map +1 -1
  49. package/dist/src/components/form/common/label.js +14 -4
  50. package/dist/src/components/form/fields/checkbox.d.ts +1 -1
  51. package/dist/src/components/form/fields/checkbox.d.ts.map +1 -1
  52. package/dist/src/components/form/fields/checkbox.js +2 -1
  53. package/dist/src/components/form/fields/combobox-async.d.ts +1 -1
  54. package/dist/src/components/form/fields/combobox-async.d.ts.map +1 -1
  55. package/dist/src/components/form/fields/combobox-async.js +2 -1
  56. package/dist/src/components/form/fields/combobox.d.ts +1 -1
  57. package/dist/src/components/form/fields/combobox.d.ts.map +1 -1
  58. package/dist/src/components/form/fields/combobox.js +2 -1
  59. package/dist/src/components/form/fields/input.d.ts +1 -1
  60. package/dist/src/components/form/fields/input.d.ts.map +1 -1
  61. package/dist/src/components/form/fields/input.js +2 -1
  62. package/dist/src/components/form/fields/radio-group.d.ts +1 -1
  63. package/dist/src/components/form/fields/radio-group.d.ts.map +1 -1
  64. package/dist/src/components/form/fields/radio-group.js +2 -1
  65. package/dist/src/components/form/fields/select.d.ts +1 -1
  66. package/dist/src/components/form/fields/select.d.ts.map +1 -1
  67. package/dist/src/components/form/fields/select.js +2 -1
  68. package/dist/src/components/form/fields/switch.d.ts +1 -1
  69. package/dist/src/components/form/fields/switch.d.ts.map +1 -1
  70. package/dist/src/components/form/fields/switch.js +2 -1
  71. package/dist/src/components/form/fields/textarea.d.ts +1 -1
  72. package/dist/src/components/form/fields/textarea.d.ts.map +1 -1
  73. package/dist/src/components/form/fields/textarea.js +2 -1
  74. package/dist/src/components/ui/alert-dialog.d.ts.map +1 -1
  75. package/dist/src/components/ui/alert-dialog.js +1 -2
  76. package/dist/src/components/ui/alert.d.ts +1 -1
  77. package/dist/src/components/ui/badge.d.ts +1 -1
  78. package/dist/src/components/ui/button.d.ts +1 -1
  79. package/dist/src/components/ui/button.js +1 -1
  80. package/dist/src/components/ui/card.d.ts +1 -1
  81. package/dist/src/components/ui/card.d.ts.map +1 -1
  82. package/dist/src/components/ui/card.js +1 -2
  83. package/dist/src/components/ui/form.js +1 -1
  84. package/dist/src/components/ui/popover.d.ts +1 -1
  85. package/dist/src/components/ui/popover.d.ts.map +1 -1
  86. package/dist/src/components/ui/popover.js +2 -1
  87. package/dist/src/components/ui/tooltip.d.ts +1 -1
  88. package/dist/src/components/ui/tooltip.d.ts.map +1 -1
  89. package/dist/src/components/ui/tooltip.js +6 -7
  90. package/dist/src/database/users.d.ts +21 -2
  91. package/dist/src/database/users.d.ts.map +1 -1
  92. package/dist/src/database/users.js +5 -2
  93. package/dist/src/emails/default-template.d.ts +34 -22
  94. package/dist/src/emails/default-template.d.ts.map +1 -1
  95. package/dist/src/emails/default-template.js +57 -63
  96. package/dist/src/emails/reset-password.d.ts +56 -0
  97. package/dist/src/emails/reset-password.d.ts.map +1 -0
  98. package/dist/src/emails/reset-password.js +132 -0
  99. package/dist/src/emails/ui/button.d.ts +9 -0
  100. package/dist/src/emails/ui/button.d.ts.map +1 -0
  101. package/dist/src/emails/ui/button.js +36 -0
  102. package/dist/src/emails/ui/card.d.ts +8 -0
  103. package/dist/src/emails/ui/card.d.ts.map +1 -0
  104. package/dist/src/emails/ui/card.js +39 -0
  105. package/dist/src/hooks/use-captcha.d.ts.map +1 -1
  106. package/dist/src/hooks/use-captcha.js +47 -15
  107. package/dist/src/lib/fetcher/core.d.ts.map +1 -1
  108. package/dist/src/lib/fetcher/core.js +6 -1
  109. package/dist/src/views/admin/sign-in/sign-in-admin-view.js +2 -1
  110. package/dist/src/views/auth/password-reset/change-password-form/form.d.ts +5 -0
  111. package/dist/src/views/auth/password-reset/change-password-form/form.d.ts.map +1 -0
  112. package/dist/src/views/auth/password-reset/change-password-form/form.js +48 -0
  113. package/dist/src/views/auth/password-reset/change-password-form/mutation-api.d.ts +6 -0
  114. package/dist/src/views/auth/password-reset/change-password-form/mutation-api.d.ts.map +1 -0
  115. package/dist/src/views/auth/password-reset/change-password-form/mutation-api.js +22 -0
  116. package/dist/src/views/auth/password-reset/change-password-form/use-form.d.ts +11 -0
  117. package/dist/src/views/auth/password-reset/change-password-form/use-form.d.ts.map +1 -0
  118. package/dist/src/views/auth/password-reset/change-password-form/use-form.js +36 -0
  119. package/dist/src/views/auth/password-reset/form/form.d.ts +6 -0
  120. package/dist/src/views/auth/password-reset/form/form.d.ts.map +1 -0
  121. package/dist/src/views/auth/password-reset/form/form.js +104 -0
  122. package/dist/src/views/auth/password-reset/form/mutation-api.d.ts +7 -0
  123. package/dist/src/views/auth/password-reset/form/mutation-api.d.ts.map +1 -0
  124. package/dist/src/views/auth/password-reset/form/mutation-api.js +21 -0
  125. package/dist/src/views/auth/password-reset/form/use-form.d.ts +12 -0
  126. package/dist/src/views/auth/password-reset/form/use-form.d.ts.map +1 -0
  127. package/dist/src/views/auth/password-reset/form/use-form.js +33 -0
  128. package/dist/src/views/auth/password-reset/password-reset-view.d.ts +7 -0
  129. package/dist/src/views/auth/password-reset/password-reset-view.d.ts.map +1 -0
  130. package/dist/src/views/auth/password-reset/password-reset-view.js +37 -0
  131. package/dist/src/views/auth/sign-in/form/form.d.ts +2 -1
  132. package/dist/src/views/auth/sign-in/form/form.d.ts.map +1 -1
  133. package/dist/src/views/auth/sign-in/form/form.js +7 -2
  134. package/dist/src/views/auth/sign-in/sign-in-view.d.ts.map +1 -1
  135. package/dist/src/views/auth/sign-in/sign-in-view.js +10 -4
  136. package/dist/src/views/auth/{components → sign-up/components}/password-input.d.ts +2 -2
  137. package/dist/src/views/auth/sign-up/components/password-input.d.ts.map +1 -0
  138. package/dist/src/views/auth/{components → sign-up/components}/password-input.js +4 -4
  139. package/dist/src/views/auth/sign-up/form/form.d.ts.map +1 -1
  140. package/dist/src/views/auth/sign-up/form/form.js +2 -15
  141. package/dist/src/views/auth/sign-up/form/mutation-api.d.ts +1 -1
  142. package/dist/src/views/auth/sign-up/form/mutation-api.d.ts.map +1 -1
  143. package/dist/src/views/auth/sign-up/form/use-form.d.ts +1 -6
  144. package/dist/src/views/auth/sign-up/form/use-form.d.ts.map +1 -1
  145. package/dist/src/views/auth/sign-up/form/use-form.js +12 -9
  146. package/dist/src/views/auth/sign-up/sign-up-view.js +1 -1
  147. package/dist/src/views/auth/sso/callback/callback-sso-view.d.ts.map +1 -1
  148. package/dist/src/views/auth/sso/callback/callback-sso-view.js +19 -5
  149. package/dist/src/views/auth/sso/callback/client/client.d.ts +3 -1
  150. package/dist/src/views/auth/sso/callback/client/client.d.ts.map +1 -1
  151. package/dist/src/views/auth/sso/callback/client/client.js +32 -3
  152. package/dist/src/views/auth/sso/callback/client/mutation-api.d.ts.map +1 -1
  153. package/dist/src/views/auth/sso/callback/client/mutation-api.js +5 -0
  154. package/dist/src/views/error/error-view.d.ts +5 -3
  155. package/dist/src/views/error/error-view.d.ts.map +1 -1
  156. package/dist/src/views/error/error-view.js +24 -22
  157. package/dist/src/views/layouts/theme/header/header.js +1 -1
  158. package/dist/src/vitnode.config.d.ts +3 -0
  159. package/dist/src/vitnode.config.d.ts.map +1 -1
  160. package/dist/tsconfig.tsbuildinfo +1 -1
  161. package/package.json +45 -44
  162. package/src/app/login/reset-password/page.tsx +27 -0
  163. package/src/locales/en.json +42 -2
  164. package/dist/src/views/auth/components/password-input.d.ts.map +0 -1
@@ -0,0 +1,48 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useTranslations } from "next-intl";
4
+ import { AutoForm } from "../../../../components/form/auto-form.js";
5
+ import { CardContent, CardDescription, CardHeader, CardTitle } from "../../../../components/ui/card.js";
6
+ import { PasswordInput } from "../../sign-up/components/password-input.js";
7
+ import { useForm } from "./use-form.js";
8
+ export const ChangePasswordForm = (props)=>{
9
+ const t = useTranslations('core.auth.change_password');
10
+ const tSignUp = useTranslations('core.auth.sign_up');
11
+ const { formSchema, onSubmit } = useForm(props);
12
+ return /*#__PURE__*/ _jsxs(_Fragment, {
13
+ children: [
14
+ /*#__PURE__*/ _jsxs(CardHeader, {
15
+ className: "text-center",
16
+ children: [
17
+ /*#__PURE__*/ _jsx(CardTitle, {
18
+ children: /*#__PURE__*/ _jsx("h1", {
19
+ children: t('title')
20
+ })
21
+ }),
22
+ /*#__PURE__*/ _jsx(CardDescription, {
23
+ children: t('desc')
24
+ })
25
+ ]
26
+ }),
27
+ /*#__PURE__*/ _jsx(CardContent, {
28
+ children: /*#__PURE__*/ _jsx(AutoForm, {
29
+ fields: [
30
+ {
31
+ id: 'password',
32
+ component: (props)=>/*#__PURE__*/ _jsx(PasswordInput, {
33
+ label: tSignUp('password.label'),
34
+ ...props
35
+ })
36
+ }
37
+ ],
38
+ formSchema: formSchema,
39
+ onSubmit: onSubmit,
40
+ submitButtonProps: {
41
+ className: 'w-full',
42
+ children: t('submit')
43
+ }
44
+ })
45
+ })
46
+ ]
47
+ });
48
+ };
@@ -0,0 +1,6 @@
1
+ import type z from 'zod';
2
+ import type { zodChangePasswordSchema } from '../../../../api/modules/users/routes/change-password.route';
3
+ export declare const mutationApi: ({ password, token, userId, }: z.infer<typeof zodChangePasswordSchema>) => Promise<{
4
+ error: string;
5
+ } | undefined>;
6
+ //# sourceMappingURL=mutation-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/password-reset/change-password-form/mutation-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAKhG,eAAO,MAAM,WAAW,GAAU,8BAI/B,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC;;cAazC,CAAC"}
@@ -0,0 +1,22 @@
1
+ 'use server';
2
+ import { usersModule } from "../../../../api/modules/users/users.module.js";
3
+ import { fetcher } from "../../../../lib/fetcher.js";
4
+ export const mutationApi = async ({ password, token, userId })=>{
5
+ const res = await fetcher(usersModule, {
6
+ module: 'users',
7
+ path: '/change-password',
8
+ method: 'post',
9
+ args: {
10
+ body: {
11
+ password,
12
+ token,
13
+ userId
14
+ }
15
+ }
16
+ });
17
+ if (res.status !== 201) {
18
+ return {
19
+ error: 'internal_server_error'
20
+ };
21
+ }
22
+ };
@@ -0,0 +1,11 @@
1
+ import z from 'zod';
2
+ import type { ChangePasswordForm } from './form';
3
+ export declare const useForm: ({ token, userId, }: React.ComponentProps<typeof ChangePasswordForm>) => {
4
+ formSchema: z.ZodObject<{
5
+ password: z.ZodDefault<z.ZodString>;
6
+ }, z.core.$strip>;
7
+ onSubmit: (data: z.infer<z.ZodObject<{
8
+ password: z.ZodDefault<z.ZodString>;
9
+ }, z.core.$strip>>) => Promise<void>;
10
+ };
11
+ //# sourceMappingURL=use-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/password-reset/change-password-form/use-form.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,KAAK,CAAC;AAIpB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAKjD,eAAO,MAAM,OAAO,GAAI,oBAGrB,KAAK,CAAC,cAAc,CAAC,OAAO,kBAAkB,CAAC;;;;qBAUlB,CAAC,CAAC,KAAK;;sBAAmB;CAyBzD,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { useTranslations } from "next-intl";
2
+ import { toast } from "sonner";
3
+ import z from "zod";
4
+ import { useRouter } from "../../../../lib/navigation.js";
5
+ import { usePasswordZodSchema } from "../../sign-up/form/use-form.js";
6
+ import { mutationApi } from "./mutation-api.js";
7
+ export const useForm = ({ token, userId })=>{
8
+ const t = useTranslations('core.auth.change_password');
9
+ const tError = useTranslations('core.global.errors');
10
+ const passwordSchema = usePasswordZodSchema();
11
+ const { replace } = useRouter();
12
+ const formSchema = z.object({
13
+ password: passwordSchema
14
+ });
15
+ const onSubmit = async (data)=>{
16
+ const mutation = await mutationApi({
17
+ password: data.password,
18
+ token,
19
+ userId: +userId
20
+ });
21
+ if (mutation?.error) {
22
+ toast.error(tError('title'), {
23
+ description: tError('internal_server_error')
24
+ });
25
+ return;
26
+ }
27
+ toast.success(t('success.title'), {
28
+ description: t('success.desc')
29
+ });
30
+ replace('/login');
31
+ };
32
+ return {
33
+ formSchema,
34
+ onSubmit
35
+ };
36
+ };
@@ -0,0 +1,6 @@
1
+ import type z from 'zod';
2
+ import type { routeMiddlewareSchema } from '../../../../api/modules/middleware/route';
3
+ export declare const PasswordResetForm: ({ captcha, }: {
4
+ captcha: z.infer<typeof routeMiddlewareSchema>["captcha"];
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/password-reset/form/form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAKzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AA8C5E,eAAO,MAAM,iBAAiB,GAAI,cAE/B;IACD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC;CAC3D,4CAuCA,CAAC"}
@@ -0,0 +1,104 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { MailCheckIcon } from "lucide-react";
4
+ import { useTranslations } from "next-intl";
5
+ import { AutoForm } from "../../../../components/form/auto-form.js";
6
+ import { AutoFormInput } from "../../../../components/form/fields/input.js";
7
+ import { CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "../../../../components/ui/card.js";
8
+ import { Input } from "../../../../components/ui/input.js";
9
+ import { Label } from "../../../../components/ui/label.js";
10
+ import { useForm } from "./use-form.js";
11
+ function ConfirmationView({ email }) {
12
+ const t = useTranslations('core.auth.reset_password');
13
+ const tSignUp = useTranslations('core.auth.sign_up');
14
+ return /*#__PURE__*/ _jsxs(_Fragment, {
15
+ children: [
16
+ /*#__PURE__*/ _jsxs(CardHeader, {
17
+ className: "flex flex-col items-center text-center",
18
+ children: [
19
+ /*#__PURE__*/ _jsx("div", {
20
+ className: "mb-3 rounded-2xl border p-3",
21
+ children: /*#__PURE__*/ _jsx(MailCheckIcon, {
22
+ className: "size-8"
23
+ })
24
+ }),
25
+ /*#__PURE__*/ _jsx(CardTitle, {
26
+ className: "text-balance",
27
+ children: t('confirmation.title')
28
+ }),
29
+ /*#__PURE__*/ _jsx(CardDescription, {
30
+ className: "text-pretty",
31
+ children: t('confirmation.desc')
32
+ })
33
+ ]
34
+ }),
35
+ /*#__PURE__*/ _jsxs(CardContent, {
36
+ className: "space-y-2",
37
+ children: [
38
+ /*#__PURE__*/ _jsx(Label, {
39
+ htmlFor: "email",
40
+ children: tSignUp('email.label')
41
+ }),
42
+ /*#__PURE__*/ _jsx(Input, {
43
+ className: "w-full",
44
+ id: "email",
45
+ readOnly: true,
46
+ value: email
47
+ })
48
+ ]
49
+ }),
50
+ /*#__PURE__*/ _jsx(CardFooter, {
51
+ children: /*#__PURE__*/ _jsx(CardDescription, {
52
+ children: t('confirmation.check_spam')
53
+ })
54
+ })
55
+ ]
56
+ });
57
+ }
58
+ export const PasswordResetForm = ({ captcha })=>{
59
+ const { formSchema, onSubmit, sentEmail } = useForm();
60
+ const t = useTranslations('core.auth.reset_password');
61
+ const tSignUp = useTranslations('core.auth.sign_up');
62
+ if (sentEmail) {
63
+ return /*#__PURE__*/ _jsx(ConfirmationView, {
64
+ email: sentEmail
65
+ });
66
+ }
67
+ return /*#__PURE__*/ _jsxs(_Fragment, {
68
+ children: [
69
+ /*#__PURE__*/ _jsxs(CardHeader, {
70
+ className: "text-center",
71
+ children: [
72
+ /*#__PURE__*/ _jsx(CardTitle, {
73
+ children: /*#__PURE__*/ _jsx("h1", {
74
+ children: t('title')
75
+ })
76
+ }),
77
+ /*#__PURE__*/ _jsx(CardDescription, {
78
+ children: t('desc')
79
+ })
80
+ ]
81
+ }),
82
+ /*#__PURE__*/ _jsx(CardContent, {
83
+ children: /*#__PURE__*/ _jsx(AutoForm, {
84
+ captcha: captcha,
85
+ fields: [
86
+ {
87
+ id: 'email',
88
+ component: (props)=>/*#__PURE__*/ _jsx(AutoFormInput, {
89
+ ...props,
90
+ label: tSignUp('email.label')
91
+ })
92
+ }
93
+ ],
94
+ formSchema: formSchema,
95
+ onSubmit: onSubmit,
96
+ submitButtonProps: {
97
+ className: 'w-full',
98
+ children: t('submit')
99
+ }
100
+ })
101
+ })
102
+ ]
103
+ });
104
+ };
@@ -0,0 +1,7 @@
1
+ export declare const mutationApi: ({ email, captchaToken, }: {
2
+ captchaToken: string;
3
+ email: string;
4
+ }) => Promise<{
5
+ error: string;
6
+ } | undefined>;
7
+ //# sourceMappingURL=mutation-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/password-reset/form/mutation-api.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,GAAU,0BAG/B;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;;cAcA,CAAC"}
@@ -0,0 +1,21 @@
1
+ 'use server';
2
+ import { usersModule } from "../../../../api/modules/users/users.module.js";
3
+ import { fetcher } from "../../../../lib/fetcher.js";
4
+ export const mutationApi = async ({ email, captchaToken })=>{
5
+ const res = await fetcher(usersModule, {
6
+ module: 'users',
7
+ path: '/reset-password',
8
+ method: 'post',
9
+ captchaToken,
10
+ args: {
11
+ body: {
12
+ email
13
+ }
14
+ }
15
+ });
16
+ if (res.status !== 201) {
17
+ return {
18
+ error: 'internal_server_error'
19
+ };
20
+ }
21
+ };
@@ -0,0 +1,12 @@
1
+ import z from 'zod';
2
+ import type { AutoFormOnSubmit } from '../../../../components/form/auto-form';
3
+ export declare const useForm: () => {
4
+ formSchema: z.ZodObject<{
5
+ email: z.ZodDefault<z.ZodEmail>;
6
+ }, z.core.$strip>;
7
+ onSubmit: AutoFormOnSubmit<z.ZodObject<{
8
+ email: z.ZodDefault<z.ZodEmail>;
9
+ }, z.core.$strip>>;
10
+ sentEmail: string;
11
+ };
12
+ //# sourceMappingURL=use-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/password-reset/form/use-form.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAIpE,eAAO,MAAM,OAAO;;;;;;;;CA+BnB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { useTranslations } from "next-intl";
2
+ import React from "react";
3
+ import { toast } from "sonner";
4
+ import z from "zod";
5
+ import { mutationApi } from "./mutation-api.js";
6
+ export const useForm = ()=>{
7
+ const t = useTranslations('core.auth.sign_up');
8
+ const tError = useTranslations('core.global.errors');
9
+ const [sentEmail, setSentEmail] = React.useState('');
10
+ const formSchema = z.object({
11
+ email: z.email({
12
+ message: t('email.invalid')
13
+ }).default('')
14
+ });
15
+ const onSubmit = async (data, _form, { captchaToken })=>{
16
+ const mutation = await mutationApi({
17
+ email: data.email,
18
+ captchaToken
19
+ });
20
+ if (mutation?.error) {
21
+ toast.error(tError('title'), {
22
+ description: tError('internal_server_error')
23
+ });
24
+ return;
25
+ }
26
+ setSentEmail(data.email);
27
+ };
28
+ return {
29
+ formSchema,
30
+ onSubmit,
31
+ sentEmail
32
+ };
33
+ };
@@ -0,0 +1,7 @@
1
+ export declare const PasswordResetView: ({ searchParams, }: {
2
+ searchParams: Promise<{
3
+ token: string;
4
+ userId: string;
5
+ }>;
6
+ }) => Promise<import("react/jsx-runtime").JSX.Element>;
7
+ //# sourceMappingURL=password-reset-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-reset-view.d.ts","sourceRoot":"","sources":["../../../../../src/views/auth/password-reset/password-reset-view.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,iBAAiB,GAAU,mBAErC;IACD,YAAY,EAAE,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1D,qDA0BA,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { notFound } from "next/navigation";
3
+ import { I18nProvider } from "../../../components/i18n-provider.js";
4
+ import { Card } from "../../../components/ui/card.js";
5
+ import { getMiddlewareApi } from "../../../lib/api/get-middleware-api.js";
6
+ import { ChangePasswordForm } from "./change-password-form/form.js";
7
+ import { PasswordResetForm } from "./form/form.js";
8
+ export const PasswordResetView = async ({ searchParams })=>{
9
+ const [{ isEmail, captcha }, { token, userId }] = await Promise.all([
10
+ getMiddlewareApi(),
11
+ searchParams
12
+ ]);
13
+ if (!isEmail) notFound();
14
+ return /*#__PURE__*/ _jsx("div", {
15
+ className: "mx-auto flex min-h-[calc(100vh-4rem)] max-w-md flex-col justify-center px-4 py-16",
16
+ children: /*#__PURE__*/ _jsx(Card, {
17
+ children: token && userId ? /*#__PURE__*/ _jsx(I18nProvider, {
18
+ namespaces: [
19
+ 'core.auth.sign_up',
20
+ 'core.auth.change_password'
21
+ ],
22
+ children: /*#__PURE__*/ _jsx(ChangePasswordForm, {
23
+ token: token,
24
+ userId: userId
25
+ })
26
+ }) : /*#__PURE__*/ _jsx(I18nProvider, {
27
+ namespaces: [
28
+ 'core.auth.sign_up',
29
+ 'core.auth.reset_password'
30
+ ],
31
+ children: /*#__PURE__*/ _jsx(PasswordResetForm, {
32
+ captcha: captcha
33
+ })
34
+ })
35
+ })
36
+ });
37
+ };
@@ -1,4 +1,5 @@
1
- export declare const FormSignIn: ({ isAdmin }: {
1
+ export declare const FormSignIn: ({ isAdmin, isEmail, }: {
2
2
  isAdmin?: boolean;
3
+ isEmail: boolean;
3
4
  }) => import("react/jsx-runtime").JSX.Element;
4
5
  //# sourceMappingURL=form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-in/form/form.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,UAAU,GAAI,aAAa;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,4CA0C5D,CAAC"}
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-in/form/form.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,UAAU,GAAI,uBAGxB;IACD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,4CAoDA,CAAC"}
@@ -5,8 +5,9 @@ import { useTranslations } from "next-intl";
5
5
  import { AutoForm } from "../../../../components/form/auto-form.js";
6
6
  import { AutoFormInput } from "../../../../components/form/fields/input.js";
7
7
  import { Alert, AlertDescription, AlertTitle } from "../../../../components/ui/alert.js";
8
+ import { Link } from "../../../../lib/navigation.js";
8
9
  import { useFormSignIn } from "./use-form.js";
9
- export const FormSignIn = ({ isAdmin })=>{
10
+ export const FormSignIn = ({ isAdmin, isEmail })=>{
10
11
  const t = useTranslations('core.auth.sign_in');
11
12
  const { onSubmit, error, formSchema } = useFormSignIn({
12
13
  isAdmin
@@ -34,7 +35,6 @@ export const FormSignIn = ({ isAdmin })=>{
34
35
  id: 'email',
35
36
  component: (props)=>/*#__PURE__*/ _jsx(AutoFormInput, {
36
37
  label: t('email.label'),
37
- type: "email",
38
38
  ...props
39
39
  })
40
40
  },
@@ -42,6 +42,11 @@ export const FormSignIn = ({ isAdmin })=>{
42
42
  id: 'password',
43
43
  component: (props)=>/*#__PURE__*/ _jsx(AutoFormInput, {
44
44
  label: t('password.label'),
45
+ labelRight: isEmail ? /*#__PURE__*/ _jsx(Link, {
46
+ className: "text-primary hover:underline",
47
+ href: "/login/reset-password",
48
+ children: t('password.reset')
49
+ }) : undefined,
45
50
  type: "password",
46
51
  ...props
47
52
  })
@@ -1 +1 @@
1
- {"version":3,"file":"sign-in-view.d.ts","sourceRoot":"","sources":["../../../../../src/views/auth/sign-in/sign-in-view.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,UAAU,wDAmCtB,CAAC"}
1
+ {"version":3,"file":"sign-in-view.d.ts","sourceRoot":"","sources":["../../../../../src/views/auth/sign-in/sign-in-view.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,UAAU,wDAsCtB,CAAC"}
@@ -2,13 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { getTranslations } from "next-intl/server";
3
3
  import React from "react";
4
4
  import { Card, CardDescription } from "../../../components/ui/card.js";
5
+ import { getMiddlewareApi } from "../../../lib/api/get-middleware-api.js";
5
6
  import { Link } from "../../../lib/navigation.js";
6
7
  import { I18nProvider } from "../../../components/i18n-provider.js";
7
8
  import { SSOButtons, SSOButtonsSkeleton } from "../sso/buttons/sso-buttons.js";
8
9
  import { FormSignIn } from "./form/form.js";
9
10
  export const SignInView = async ()=>{
10
- const t = await getTranslations('core.auth.sign_in');
11
- const tGlobal = await getTranslations('core.global');
11
+ const [t, tGlobal, { isEmail }] = await Promise.all([
12
+ getTranslations('core.auth.sign_in'),
13
+ getTranslations('core.global'),
14
+ getMiddlewareApi()
15
+ ]);
12
16
  return /*#__PURE__*/ _jsx(I18nProvider, {
13
17
  namespaces: "core.auth.sign_in",
14
18
  children: /*#__PURE__*/ _jsx("div", {
@@ -31,7 +35,9 @@ export const SignInView = async ()=>{
31
35
  })
32
36
  ]
33
37
  }),
34
- /*#__PURE__*/ _jsx(FormSignIn, {}),
38
+ /*#__PURE__*/ _jsx(FormSignIn, {
39
+ isEmail: isEmail
40
+ }),
35
41
  /*#__PURE__*/ _jsx(React.Suspense, {
36
42
  fallback: /*#__PURE__*/ _jsx(SSOButtonsSkeleton, {}),
37
43
  children: /*#__PURE__*/ _jsx(SSOButtons, {})
@@ -42,7 +48,7 @@ export const SignInView = async ()=>{
42
48
  className: "text-accent-foreground p-6 text-center text-sm",
43
49
  children: t.rich('do_not_have_account', {
44
50
  link: (text)=>/*#__PURE__*/ _jsx(Link, {
45
- className: "font-semibold",
51
+ className: "text-primary font-semibold",
46
52
  href: "/register",
47
53
  children: text
48
54
  })
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { ItemAutoFormComponentProps } from '../../../components/form/auto-form';
3
- import { Input } from '../../../components/ui/input';
2
+ import type { ItemAutoFormComponentProps } from '../../../../components/form/auto-form';
3
+ import { Input } from '../../../../components/ui/input';
4
4
  export declare const PasswordInput: ({ label, description: _, field, otherProps: { maxLength, minLength, pattern }, ...props }: ItemAutoFormComponentProps & Omit<React.ComponentProps<typeof Input>, "type">) => import("react/jsx-runtime").JSX.Element;
5
5
  //# sourceMappingURL=password-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-input.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-up/components/password-input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAI9E,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAQ9C,eAAO,MAAM,aAAa,GAAI,2FAO3B,0BAA0B,GAC3B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,MAAM,CAAC,4CA+EjD,CAAC"}
@@ -2,10 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { CheckIcon, XIcon } from "lucide-react";
3
3
  import { useTranslations } from "next-intl";
4
4
  import React from "react";
5
- import { AutoFormLabel } from "../../../components/form/common/label.js";
6
- import { FormControl, FormItem, FormMessage } from "../../../components/ui/form.js";
7
- import { Input } from "../../../components/ui/input.js";
8
- import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../../components/ui/tooltip.js";
5
+ import { AutoFormLabel } from "../../../../components/form/common/label.js";
6
+ import { FormControl, FormItem, FormMessage } from "../../../../components/ui/form.js";
7
+ import { Input } from "../../../../components/ui/input.js";
8
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../../../components/ui/tooltip.js";
9
9
  export const PasswordInput = ({ label, // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
10
  description: _, field, otherProps: { maxLength, minLength, pattern }, ...props })=>{
11
11
  const t = useTranslations('core.auth.sign_up');
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-up/form/form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAc5E,eAAO,MAAM,UAAU,GAAI,uBAGxB;IACD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC;IAC1D,OAAO,EAAE,OAAO,CAAC;CAClB,4CAgGA,CAAC"}
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-up/form/form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAc5E,eAAO,MAAM,UAAU,GAAI,uBAGxB;IACD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC;IAC1D,OAAO,EAAE,OAAO,CAAC;CAClB,4CAuFA,CAAC"}
@@ -6,7 +6,7 @@ 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 "../../components/password-input.js";
9
+ import { PasswordInput } from "../components/password-input.js";
10
10
  import { useFormSignUp } from "./use-form.js";
11
11
  export const FormSignUp = ({ isEmail, captcha })=>{
12
12
  const t = useTranslations('core.auth.sign_up');
@@ -43,7 +43,6 @@ export const FormSignUp = ({ isEmail, captcha })=>{
43
43
  id: 'email',
44
44
  component: (props)=>/*#__PURE__*/ _jsx(AutoFormInput, {
45
45
  label: t('email.label'),
46
- type: "email",
47
46
  ...props
48
47
  })
49
48
  },
@@ -77,19 +76,7 @@ export const FormSignUp = ({ isEmail, captcha })=>{
77
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",
@@ -1,7 +1,7 @@
1
1
  import type { z } from 'zod';
2
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: any;
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":"AAEA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,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,MAAA;CAAE;;;;;;;;;;EAuBpD,CAAC"}
1
+ {"version":3,"file":"mutation-api.d.ts","sourceRoot":"","sources":["../../../../../../src/views/auth/sign-up/form/mutation-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,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,5 +1,6 @@
1
1
  import { z } from 'zod';
2
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;;;;;;;;;;;;;;;;;;;;;CAyFzB,CAAC"}
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"}