@vitnode/core 1.2.0-canary.50 → 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.
- package/dist/scripts/scripts.js +2 -2
- package/dist/src/api/middlewares/global.middleware.d.ts +2 -10
- package/dist/src/api/middlewares/global.middleware.d.ts.map +1 -1
- package/dist/src/api/models/email.d.ts +24 -8
- package/dist/src/api/models/email.d.ts.map +1 -1
- package/dist/src/api/models/email.js +27 -15
- 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 +8 -0
- package/dist/src/api/models/session-admin.d.ts +1 -0
- package/dist/src/api/models/session-admin.d.ts.map +1 -1
- package/dist/src/api/models/session.d.ts +1 -0
- package/dist/src/api/models/session.d.ts.map +1 -1
- package/dist/src/api/models/sso.d.ts.map +1 -1
- package/dist/src/api/models/sso.js +8 -5
- package/dist/src/api/models/user/get-user-by-id.d.ts +1 -0
- 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 +2 -1
- package/dist/src/api/models/user/sign-up.js +2 -2
- 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/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/sign-up.route.d.ts +6 -0
- 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 +6 -0
- package/dist/src/api/modules/users/routes/test.route.d.ts.map +1 -1
- package/dist/src/api/modules/users/routes/test.route.js +0 -6
- package/dist/src/api/modules/users/sso/routes/callback.route.d.ts +4 -1
- 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 +3 -0
- package/dist/src/api/modules/users/sso/sso.module.d.ts +4 -1
- package/dist/src/api/modules/users/sso/sso.module.d.ts.map +1 -1
- package/dist/src/api/modules/users/users.module.d.ts +93 -1
- package/dist/src/api/modules/users/users.module.d.ts.map +1 -1
- package/dist/src/api/modules/users/users.module.js +5 -1
- 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/components/form/auto-form.d.ts +2 -1
- package/dist/src/components/form/auto-form.d.ts.map +1 -1
- package/dist/src/components/form/auto-form.js +3 -2
- package/dist/src/components/form/common/label.d.ts +3 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/src/components/form/fields/combobox-async.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox-async.js +2 -1
- package/dist/src/components/form/fields/combobox.d.ts +1 -1
- package/dist/src/components/form/fields/combobox.d.ts.map +1 -1
- package/dist/src/components/form/fields/combobox.js +2 -1
- package/dist/src/components/form/fields/input.d.ts +1 -1
- package/dist/src/components/form/fields/input.d.ts.map +1 -1
- package/dist/src/components/form/fields/input.js +2 -1
- package/dist/src/components/form/fields/radio-group.d.ts +1 -1
- package/dist/src/components/form/fields/radio-group.d.ts.map +1 -1
- package/dist/src/components/form/fields/radio-group.js +2 -1
- package/dist/src/components/form/fields/select.d.ts +1 -1
- package/dist/src/components/form/fields/select.d.ts.map +1 -1
- package/dist/src/components/form/fields/select.js +2 -1
- package/dist/src/components/form/fields/switch.d.ts +1 -1
- 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 +1 -1
- package/dist/src/components/form/fields/textarea.d.ts.map +1 -1
- package/dist/src/components/form/fields/textarea.js +2 -1
- package/dist/src/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/src/components/ui/alert-dialog.js +1 -2
- package/dist/src/components/ui/alert.d.ts +1 -1
- package/dist/src/components/ui/badge.d.ts +1 -1
- package/dist/src/components/ui/button.d.ts +1 -1
- package/dist/src/components/ui/button.js +1 -1
- package/dist/src/components/ui/card.d.ts +1 -1
- package/dist/src/components/ui/card.d.ts.map +1 -1
- package/dist/src/components/ui/card.js +1 -2
- package/dist/src/components/ui/form.js +1 -1
- package/dist/src/components/ui/popover.d.ts +1 -1
- package/dist/src/components/ui/popover.d.ts.map +1 -1
- package/dist/src/components/ui/popover.js +2 -1
- package/dist/src/components/ui/tooltip.d.ts +1 -1
- package/dist/src/components/ui/tooltip.d.ts.map +1 -1
- package/dist/src/components/ui/tooltip.js +6 -7
- 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 +5 -2
- 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 +57 -63
- 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-captcha.d.ts.map +1 -1
- package/dist/src/hooks/use-captcha.js +47 -15
- package/dist/src/lib/fetcher/core.d.ts.map +1 -1
- package/dist/src/lib/fetcher/core.js +6 -1
- package/dist/src/views/admin/sign-in/sign-in-admin-view.js +2 -1
- 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 +7 -2
- 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 +10 -4
- package/dist/src/views/auth/{components → sign-up/components}/password-input.d.ts +2 -2
- 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 +4 -4
- package/dist/src/views/auth/sign-up/form/form.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/form.js +2 -15
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts +1 -1
- package/dist/src/views/auth/sign-up/form/mutation-api.d.ts.map +1 -1
- package/dist/src/views/auth/sign-up/form/use-form.d.ts +1 -6
- 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 +12 -9
- package/dist/src/views/auth/sign-up/sign-up-view.js +1 -1
- 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 +19 -5
- 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 +32 -3
- 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 +5 -0
- 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 +24 -22
- package/dist/src/views/layouts/theme/header/header.js +1 -1
- package/dist/src/vitnode.config.d.ts +3 -0
- package/dist/src/vitnode.config.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +45 -44
- package/src/app/login/reset-password/page.tsx +27 -0
- package/src/locales/en.json +42 -2
- package/dist/src/views/auth/components/password-input.d.ts.map +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const zodChangePasswordSchema: z.ZodObject<{
|
|
3
|
+
password: z.ZodString;
|
|
4
|
+
userId: z.ZodNumber;
|
|
5
|
+
token: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export declare const changePasswordRoute: {
|
|
8
|
+
handler: (c: import("hono").Context<import("../../../middlewares/global.middleware").EnvVitNode, "/change-password", {
|
|
9
|
+
in: {
|
|
10
|
+
json: {
|
|
11
|
+
password: string;
|
|
12
|
+
userId: number;
|
|
13
|
+
token: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
out: {
|
|
17
|
+
json: {
|
|
18
|
+
password: string;
|
|
19
|
+
userId: number;
|
|
20
|
+
token: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}>) => Promise<Response & import("hono").TypedResponse<"Password changed", 201, "text">>;
|
|
24
|
+
pluginId: "@vitnode/core";
|
|
25
|
+
route: {
|
|
26
|
+
method: "post";
|
|
27
|
+
description: string;
|
|
28
|
+
path: "/change-password";
|
|
29
|
+
request: {
|
|
30
|
+
body: {
|
|
31
|
+
required: true;
|
|
32
|
+
content: {
|
|
33
|
+
'application/json': {
|
|
34
|
+
schema: z.ZodObject<{
|
|
35
|
+
password: z.ZodString;
|
|
36
|
+
userId: z.ZodNumber;
|
|
37
|
+
token: z.ZodString;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
responses: {
|
|
44
|
+
201: {
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
} & {
|
|
49
|
+
getRoutingPath: () => "/change-password";
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=change-password.route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change-password.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/change-password.route.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,uBAAuB;;;;iBAMlC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyD9B,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { and, eq, gt } from "drizzle-orm";
|
|
2
|
+
import { HTTPException } from "hono/http-exception";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { buildRoute } from "../../../lib/route.js";
|
|
5
|
+
import { PasswordModel } from "../../../models/password.js";
|
|
6
|
+
import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
7
|
+
import { core_users, core_users_forgot_password } from "../../../../database/users.js";
|
|
8
|
+
export const zodChangePasswordSchema = z.object({
|
|
9
|
+
password: z.string().min(8).openapi({
|
|
10
|
+
example: 'Test123!'
|
|
11
|
+
}),
|
|
12
|
+
userId: z.number().openapi({
|
|
13
|
+
example: 123456
|
|
14
|
+
}),
|
|
15
|
+
token: z.string().openapi({
|
|
16
|
+
example: 'abcdefg12345'
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
export const changePasswordRoute = buildRoute({
|
|
20
|
+
...CONFIG_PLUGIN,
|
|
21
|
+
route: {
|
|
22
|
+
method: 'post',
|
|
23
|
+
description: 'Change user password',
|
|
24
|
+
path: '/change-password',
|
|
25
|
+
request: {
|
|
26
|
+
body: {
|
|
27
|
+
required: true,
|
|
28
|
+
content: {
|
|
29
|
+
'application/json': {
|
|
30
|
+
schema: zodChangePasswordSchema
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
responses: {
|
|
36
|
+
201: {
|
|
37
|
+
description: 'Password changed'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
handler: async (c)=>{
|
|
42
|
+
const { password, userId, token } = c.req.valid('json');
|
|
43
|
+
const [user] = await c.get('db').select().from(core_users_forgot_password).where(and(eq(core_users_forgot_password.userId, userId), eq(core_users_forgot_password.token, token), gt(core_users_forgot_password.expiresAt, new Date()))).limit(1);
|
|
44
|
+
if (!user) {
|
|
45
|
+
throw new HTTPException(400, {
|
|
46
|
+
message: 'Invalid token'
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const hashPassword = await new PasswordModel().encryptPassword(password);
|
|
50
|
+
await Promise.all([
|
|
51
|
+
c.get('db').update(core_users).set({
|
|
52
|
+
password: hashPassword
|
|
53
|
+
}).where(eq(core_users.id, userId)),
|
|
54
|
+
c.get('db').delete(core_users_forgot_password).where(eq(core_users_forgot_password.id, user.id))
|
|
55
|
+
]);
|
|
56
|
+
return c.text('Password changed', 201);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const resetPasswordRoute: {
|
|
3
|
+
handler: (c: import("hono").Context<import("../../../middlewares/global.middleware").EnvVitNode, "/reset-password", {
|
|
4
|
+
in: {
|
|
5
|
+
json: {
|
|
6
|
+
email: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
out: {
|
|
10
|
+
json: {
|
|
11
|
+
email: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}>) => Promise<Response & import("hono").TypedResponse<"Email sent", 201, "text">>;
|
|
15
|
+
pluginId: "@vitnode/core";
|
|
16
|
+
route: {
|
|
17
|
+
method: "post";
|
|
18
|
+
description: string;
|
|
19
|
+
path: "/reset-password";
|
|
20
|
+
withCaptcha: true;
|
|
21
|
+
request: {
|
|
22
|
+
body: {
|
|
23
|
+
required: true;
|
|
24
|
+
content: {
|
|
25
|
+
'application/json': {
|
|
26
|
+
schema: z.ZodObject<{
|
|
27
|
+
email: z.ZodEmail;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
responses: {
|
|
34
|
+
201: {
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
} & {
|
|
39
|
+
getRoutingPath: () => "/reset-password";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=reset-passowrd.route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-passowrd.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/reset-passowrd.route.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgH7B,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { eq } from "drizzle-orm";
|
|
2
|
+
import { createTranslator } from "use-intl";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { buildRoute } from "../../../lib/route.js";
|
|
5
|
+
import { ForgotPasswordTokenModel } from "../../../models/password.js";
|
|
6
|
+
import { CONFIG_PLUGIN } from "../../../../config.js";
|
|
7
|
+
import { core_users, core_users_forgot_password } from "../../../../database/users.js";
|
|
8
|
+
import ResetPasswordEmailTemplate from "../../../../emails/reset-password.js";
|
|
9
|
+
import { CONFIG } from "../../../../lib/config.js";
|
|
10
|
+
export const resetPasswordRoute = buildRoute({
|
|
11
|
+
...CONFIG_PLUGIN,
|
|
12
|
+
route: {
|
|
13
|
+
method: 'post',
|
|
14
|
+
description: 'Request a password reset',
|
|
15
|
+
path: '/reset-password',
|
|
16
|
+
withCaptcha: true,
|
|
17
|
+
request: {
|
|
18
|
+
body: {
|
|
19
|
+
required: true,
|
|
20
|
+
content: {
|
|
21
|
+
'application/json': {
|
|
22
|
+
schema: z.object({
|
|
23
|
+
email: z.email().toLowerCase().openapi({
|
|
24
|
+
example: 'test@test.com'
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
responses: {
|
|
32
|
+
201: {
|
|
33
|
+
description: 'Email sent'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
handler: async (c)=>{
|
|
38
|
+
const RESPONSE_TEXT = c.text('Email sent', 201);
|
|
39
|
+
const { email } = c.req.valid('json');
|
|
40
|
+
const [findUser] = await c.get('db').select({
|
|
41
|
+
email: core_users.email,
|
|
42
|
+
id: core_users.id,
|
|
43
|
+
language: core_users.language
|
|
44
|
+
}).from(core_users).where(eq(core_users.email, email)).limit(1);
|
|
45
|
+
if (!findUser) {
|
|
46
|
+
return RESPONSE_TEXT;
|
|
47
|
+
}
|
|
48
|
+
const hashToken = new ForgotPasswordTokenModel().generateResetToken();
|
|
49
|
+
const [findLastRecord] = await c.get('db').select().from(core_users_forgot_password).where(eq(core_users_forgot_password.userId, findUser.id)).limit(1);
|
|
50
|
+
// If a record will be found with createdAt in the last 5 minutes, skip
|
|
51
|
+
if (findLastRecord?.createdAt > new Date(Date.now() - 1000 * 60 * 5)) {
|
|
52
|
+
return RESPONSE_TEXT;
|
|
53
|
+
}
|
|
54
|
+
const EXPIRES_AT = new Date(Date.now() + 1000 * 60 * 30); // 30 minutes
|
|
55
|
+
if (findLastRecord) {
|
|
56
|
+
await c.get('db').update(core_users_forgot_password).set({
|
|
57
|
+
createdAt: new Date(),
|
|
58
|
+
expiresAt: EXPIRES_AT,
|
|
59
|
+
token: hashToken,
|
|
60
|
+
ipAddress: c.get('ipAddress')
|
|
61
|
+
}).where(eq(core_users_forgot_password.id, findLastRecord.id));
|
|
62
|
+
} else {
|
|
63
|
+
await c.get('db').insert(core_users_forgot_password).values({
|
|
64
|
+
token: hashToken,
|
|
65
|
+
ipAddress: c.get('ipAddress'),
|
|
66
|
+
userId: findUser.id,
|
|
67
|
+
expiresAt: EXPIRES_AT
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
// Send email
|
|
71
|
+
const resetUrlNative = new URL(`login/reset-password?token=${hashToken}&userId=${findUser.id}`, CONFIG.web.href);
|
|
72
|
+
await c.get('email').send({
|
|
73
|
+
user: {
|
|
74
|
+
id: findUser.id,
|
|
75
|
+
email: findUser.email,
|
|
76
|
+
language: findUser.language
|
|
77
|
+
},
|
|
78
|
+
content: (props)=>ResetPasswordEmailTemplate({
|
|
79
|
+
...props,
|
|
80
|
+
resetUrl: resetUrlNative.href,
|
|
81
|
+
expiryDate: EXPIRES_AT,
|
|
82
|
+
userIpAddress: c.get('ipAddress')
|
|
83
|
+
}),
|
|
84
|
+
subject: ({ i18n })=>{
|
|
85
|
+
const t = createTranslator(i18n);
|
|
86
|
+
return t('core.auth.reset_password.email.subject');
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return RESPONSE_TEXT;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-up.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/sign-up.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,eAAe;;;;;iBAe1B,CAAC;AAEH,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"sign-up.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/sign-up.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,eAAe;;;;;iBAe1B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/test.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"test.route.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/routes/test.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BpB,CAAC"}
|
|
@@ -27,12 +27,6 @@ export const testRoute = buildRoute({
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
handler: async (c)=>{
|
|
30
|
-
await c.get('email').send({
|
|
31
|
-
to: 'ithereplay@gmail.com',
|
|
32
|
-
subject: 'Test Email',
|
|
33
|
-
content: ({ locale })=>`This is a test email in ${locale} locale.`
|
|
34
|
-
});
|
|
35
|
-
// throw new Error('Test error');
|
|
36
30
|
await c.get('log').warn('This is a test warn log');
|
|
37
31
|
return c.text('test');
|
|
38
32
|
}
|
|
@@ -27,7 +27,7 @@ export declare const callbackRoute: {
|
|
|
27
27
|
}>) => Promise<Response & import("hono").TypedResponse<{
|
|
28
28
|
id: number;
|
|
29
29
|
token: string;
|
|
30
|
-
}, 200, "json">>;
|
|
30
|
+
}, 200 | 409, "json">>;
|
|
31
31
|
pluginId: "@vitnode/core";
|
|
32
32
|
route: {
|
|
33
33
|
method: "get";
|
|
@@ -54,6 +54,9 @@ export declare const callbackRoute: {
|
|
|
54
54
|
};
|
|
55
55
|
description: string;
|
|
56
56
|
};
|
|
57
|
+
409: {
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
57
60
|
};
|
|
58
61
|
} & {
|
|
59
62
|
getRoutingPath: () => "/:providerId/callback";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/users/sso/routes/callback.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"callback.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/users/sso/routes/callback.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CxB,CAAC"}
|
|
@@ -26,7 +26,7 @@ export declare const ssoUserModule: import("../../../../api/lib/module").BuildMo
|
|
|
26
26
|
}>) => Promise<Response & import("hono").TypedResponse<{
|
|
27
27
|
id: number;
|
|
28
28
|
token: string;
|
|
29
|
-
}, 200, "json">>;
|
|
29
|
+
}, 200 | 409, "json">>;
|
|
30
30
|
pluginId: "@vitnode/core";
|
|
31
31
|
route: {
|
|
32
32
|
method: "get";
|
|
@@ -53,6 +53,9 @@ export declare const ssoUserModule: import("../../../../api/lib/module").BuildMo
|
|
|
53
53
|
};
|
|
54
54
|
description: string;
|
|
55
55
|
};
|
|
56
|
+
409: {
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
56
59
|
};
|
|
57
60
|
} & {
|
|
58
61
|
getRoutingPath: () => "/:providerId/callback";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sso.module.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/sso/sso.module.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"sso.module.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/sso/sso.module.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mQAIxB,CAAC"}
|
|
@@ -201,6 +201,12 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
|
|
|
201
201
|
};
|
|
202
202
|
description: string;
|
|
203
203
|
};
|
|
204
|
+
400: {
|
|
205
|
+
description: string;
|
|
206
|
+
};
|
|
207
|
+
409: {
|
|
208
|
+
description: string;
|
|
209
|
+
};
|
|
204
210
|
};
|
|
205
211
|
} & {
|
|
206
212
|
getRoutingPath: () => "/sign_up";
|
|
@@ -233,6 +239,89 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
|
|
|
233
239
|
} & {
|
|
234
240
|
getRoutingPath: () => "/test";
|
|
235
241
|
};
|
|
242
|
+
}, {
|
|
243
|
+
handler: (c: import("hono").Context<import("../../middlewares/global.middleware").EnvVitNode, "/reset-password", {
|
|
244
|
+
in: {
|
|
245
|
+
json: {
|
|
246
|
+
email: string;
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
out: {
|
|
250
|
+
json: {
|
|
251
|
+
email: string;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
}>) => Promise<Response & import("hono").TypedResponse<"Email sent", 201, "text">>;
|
|
255
|
+
pluginId: "@vitnode/core";
|
|
256
|
+
route: {
|
|
257
|
+
method: "post";
|
|
258
|
+
description: string;
|
|
259
|
+
path: "/reset-password";
|
|
260
|
+
withCaptcha: true;
|
|
261
|
+
request: {
|
|
262
|
+
body: {
|
|
263
|
+
required: true;
|
|
264
|
+
content: {
|
|
265
|
+
'application/json': {
|
|
266
|
+
schema: import("zod").ZodObject<{
|
|
267
|
+
email: import("zod").ZodEmail;
|
|
268
|
+
}, import("zod/v4/core").$strip>;
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
responses: {
|
|
274
|
+
201: {
|
|
275
|
+
description: string;
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
} & {
|
|
279
|
+
getRoutingPath: () => "/reset-password";
|
|
280
|
+
};
|
|
281
|
+
}, {
|
|
282
|
+
handler: (c: import("hono").Context<import("../../middlewares/global.middleware").EnvVitNode, "/change-password", {
|
|
283
|
+
in: {
|
|
284
|
+
json: {
|
|
285
|
+
password: string;
|
|
286
|
+
userId: number;
|
|
287
|
+
token: string;
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
out: {
|
|
291
|
+
json: {
|
|
292
|
+
password: string;
|
|
293
|
+
userId: number;
|
|
294
|
+
token: string;
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
}>) => Promise<Response & import("hono").TypedResponse<"Password changed", 201, "text">>;
|
|
298
|
+
pluginId: "@vitnode/core";
|
|
299
|
+
route: {
|
|
300
|
+
method: "post";
|
|
301
|
+
description: string;
|
|
302
|
+
path: "/change-password";
|
|
303
|
+
request: {
|
|
304
|
+
body: {
|
|
305
|
+
required: true;
|
|
306
|
+
content: {
|
|
307
|
+
'application/json': {
|
|
308
|
+
schema: import("zod").ZodObject<{
|
|
309
|
+
password: import("zod").ZodString;
|
|
310
|
+
userId: import("zod").ZodNumber;
|
|
311
|
+
token: import("zod").ZodString;
|
|
312
|
+
}, import("zod/v4/core").$strip>;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
responses: {
|
|
318
|
+
201: {
|
|
319
|
+
description: string;
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
} & {
|
|
323
|
+
getRoutingPath: () => "/change-password";
|
|
324
|
+
};
|
|
236
325
|
}], import("../../../api/lib/module").BuildModuleReturn<"@vitnode/core", "sso", [{
|
|
237
326
|
handler: (c: import("hono").Context<import("../../middlewares/global.middleware").EnvVitNode, "/:providerId/callback", {
|
|
238
327
|
in: {
|
|
@@ -261,7 +350,7 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
|
|
|
261
350
|
}>) => Promise<Response & import("hono").TypedResponse<{
|
|
262
351
|
id: number;
|
|
263
352
|
token: string;
|
|
264
|
-
}, 200, "json">>;
|
|
353
|
+
}, 200 | 409, "json">>;
|
|
265
354
|
pluginId: "@vitnode/core";
|
|
266
355
|
route: {
|
|
267
356
|
method: "get";
|
|
@@ -288,6 +377,9 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
|
|
|
288
377
|
};
|
|
289
378
|
description: string;
|
|
290
379
|
};
|
|
380
|
+
409: {
|
|
381
|
+
description: string;
|
|
382
|
+
};
|
|
291
383
|
};
|
|
292
384
|
} & {
|
|
293
385
|
getRoutingPath: () => "/:providerId/callback";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/users/users.module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"users.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/users/users.module.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mQAatB,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { buildModule } from "../../lib/module.js";
|
|
2
2
|
import { CONFIG_PLUGIN } from "../../../config.js";
|
|
3
|
+
import { changePasswordRoute } from "./routes/change-password.route.js";
|
|
4
|
+
import { resetPasswordRoute } from "./routes/reset-passowrd.route.js";
|
|
3
5
|
import { sessionRoute } from "./routes/session.route.js";
|
|
4
6
|
import { signInRoute } from "./routes/sign-in.route.js";
|
|
5
7
|
import { signOutRoute } from "./routes/sign-out.route.js";
|
|
@@ -14,7 +16,9 @@ export const usersModule = buildModule({
|
|
|
14
16
|
signInRoute,
|
|
15
17
|
signOutRoute,
|
|
16
18
|
signUpRoute,
|
|
17
|
-
testRoute
|
|
19
|
+
testRoute,
|
|
20
|
+
resetPasswordRoute,
|
|
21
|
+
changePasswordRoute
|
|
18
22
|
],
|
|
19
23
|
modules: [
|
|
20
24
|
ssoUserModule
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Metadata } from 'next/dist/types';
|
|
2
|
+
import { PasswordResetView } from '../../../views/auth/password-reset/password-reset-view';
|
|
3
|
+
export declare const generateMetadata: ({ params, }: {
|
|
4
|
+
params: Promise<{
|
|
5
|
+
locale: string;
|
|
6
|
+
}>;
|
|
7
|
+
}) => Promise<Metadata>;
|
|
8
|
+
export default function Page(props: React.ComponentProps<typeof PasswordResetView>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../../../src/app/login/reset-password/page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AAEpF,eAAO,MAAM,gBAAgB,GAAU,aAEpC;IACD,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrC,KAAG,OAAO,CAAC,QAAQ,CAUnB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,IAAI,CAC1B,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,2CAGtD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getTranslations } from "next-intl/server";
|
|
3
|
+
import { PasswordResetView } from "../../../views/auth/password-reset/password-reset-view.js";
|
|
4
|
+
export const generateMetadata = async ({ params })=>{
|
|
5
|
+
const { locale } = await params;
|
|
6
|
+
const t = await getTranslations({
|
|
7
|
+
locale,
|
|
8
|
+
namespace: 'core.auth.reset_password'
|
|
9
|
+
});
|
|
10
|
+
return {
|
|
11
|
+
title: t('title')
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default function Page(props) {
|
|
15
|
+
return /*#__PURE__*/ _jsx(PasswordResetView, {
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -6,6 +6,7 @@ export interface ItemAutoFormComponentProps {
|
|
|
6
6
|
description?: React.ReactNode;
|
|
7
7
|
field: ControllerRenderProps<FieldValues, string>;
|
|
8
8
|
label?: React.ReactNode;
|
|
9
|
+
labelRight?: React.ReactNode;
|
|
9
10
|
otherProps: {
|
|
10
11
|
enum?: string[];
|
|
11
12
|
isOptional?: boolean;
|
|
@@ -27,7 +28,7 @@ type ItemAutoFormProps<T extends z.ZodObject<z.ZodRawShape> = z.ZodObject<z.ZodR
|
|
|
27
28
|
export type AutoFormOnSubmit<T extends z.ZodObject<z.ZodRawShape>, TContext = unknown> = (values: z.infer<T>, form: UseFormReturn<z.input<T>, TContext, z.output<T>>, options: {
|
|
28
29
|
captchaToken: string;
|
|
29
30
|
}) => Promise<void> | void;
|
|
30
|
-
export declare function AutoForm<T extends z.ZodObject<z.ZodRawShape>, TContext = unknown>({ formSchema, mode, onSubmit: onSubmitProp, captcha, fields, submitButtonProps, ...props }: Omit<React.ComponentProps<'form'>, 'onSubmit'> & {
|
|
31
|
+
export declare function AutoForm<T extends z.ZodObject<z.ZodRawShape>, TContext = unknown>({ formSchema, mode, onSubmit: onSubmitProp, captcha, fields, submitButtonProps, children, ...props }: Omit<React.ComponentProps<'form'>, 'onSubmit'> & {
|
|
31
32
|
captcha?: z.infer<typeof routeMiddlewareSchema>['captcha'];
|
|
32
33
|
fields: ItemAutoFormProps<T>[];
|
|
33
34
|
formSchema: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-form.d.ts","sourceRoot":"","sources":["../../../../src/components/form/auto-form.tsx"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,IAAI,EAET,KAAK,aAAa,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAQhF,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC,MAAM,WAAW,0BAA0B;IACzC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,KAAK,EAAE,qBAAqB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAClD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,UAAU,EAAE;QACV,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,KAAK,iBAAiB,CACpB,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,EACjE,KAAK,SAAS,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAEzD;IACE,SAAS,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,KAAK,CAAC,SAAS,CAAC;IAClE,EAAE,EAAE,KAAK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AE,gBAAgB,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACzC,iBAAiB,CAAC,EAAE,IAAI,CACtB,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EACnC,WAAW,GAAG,MAAM,CACrB,CAAC;CACH,2CAgIA"}
|
|
@@ -9,7 +9,7 @@ import { getDefaults, getNestedParam, getZodInputParams } from "../../lib/helper
|
|
|
9
9
|
import { Button } from "../ui/button.js";
|
|
10
10
|
import { DialogClose, DialogFooter, useDialog } from "../ui/dialog.js";
|
|
11
11
|
import { Form, FormField } from "../ui/form.js";
|
|
12
|
-
export function AutoForm({ formSchema, mode, onSubmit: onSubmitProp, captcha, fields, submitButtonProps, ...props }) {
|
|
12
|
+
export function AutoForm({ formSchema, mode, onSubmit: onSubmitProp, captcha, fields, submitButtonProps, children, ...props }) {
|
|
13
13
|
const { isReady, getToken: getTokenCaptcha, onReset: onResetCaptcha } = useCaptcha(captcha);
|
|
14
14
|
const { setIsDirty } = useDialog();
|
|
15
15
|
const t = useTranslations('core.global');
|
|
@@ -75,13 +75,14 @@ export function AutoForm({ formSchema, mode, onSubmit: onSubmitProp, captcha, fi
|
|
|
75
75
|
maxLength: typeof params.maxLength === 'number' ? params.maxLength : undefined,
|
|
76
76
|
minLength: typeof params.minLength === 'number' ? params.minLength : undefined,
|
|
77
77
|
pattern: typeof params.pattern === 'string' ? params.pattern : undefined,
|
|
78
|
-
type: params.type === 'string' ? params.type : undefined
|
|
78
|
+
type: typeof params.type === 'string' ? params.type : undefined
|
|
79
79
|
}
|
|
80
80
|
})
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
}, item.id);
|
|
84
84
|
}),
|
|
85
|
+
children,
|
|
85
86
|
captcha && /*#__PURE__*/ _jsx("div", {
|
|
86
87
|
id: "vitnode_captcha"
|
|
87
88
|
}),
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { FormLabel } from '../../../components/ui/form';
|
|
2
|
-
export declare const AutoFormLabel: ({ children, ...props }: React.ComponentProps<typeof FormLabel>
|
|
2
|
+
export declare const AutoFormLabel: ({ children, labelRight, className, ...props }: React.ComponentProps<typeof FormLabel> & {
|
|
3
|
+
labelRight?: React.ReactNode;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
3
5
|
//# sourceMappingURL=label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/common/label.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/common/label.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,eAAO,MAAM,aAAa,GAAI,+CAK3B,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,GAAG;IAC1C,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B,4CAeA,CAAC"}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { FormLabel } from "../../ui/form.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { cn } from "../../../lib/utils.js";
|
|
4
|
+
export const AutoFormLabel = ({ children, labelRight, className, ...props })=>{
|
|
5
|
+
return /*#__PURE__*/ _jsxs(FormLabel, {
|
|
6
|
+
className: cn({
|
|
7
|
+
'flex flex-wrap items-center': labelRight
|
|
8
|
+
}, className),
|
|
5
9
|
...props,
|
|
6
|
-
children:
|
|
10
|
+
children: [
|
|
11
|
+
children,
|
|
12
|
+
labelRight && /*#__PURE__*/ _jsx("span", {
|
|
13
|
+
className: "ml-auto",
|
|
14
|
+
children: labelRight
|
|
15
|
+
})
|
|
16
|
+
]
|
|
7
17
|
});
|
|
8
18
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ItemAutoFormComponentProps } from '../auto-form';
|
|
2
2
|
import { Checkbox } from '../../ui/checkbox';
|
|
3
|
-
export declare const AutoFormCheckbox: ({ label, description, otherProps: { isOptional }, field, ...props }: ItemAutoFormComponentProps & Omit<React.ComponentProps<typeof Checkbox>, "checked">) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const AutoFormCheckbox: ({ label, labelRight, description, otherProps: { isOptional }, field, ...props }: ItemAutoFormComponentProps & Omit<React.ComponentProps<typeof Checkbox>, "checked">) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
//# sourceMappingURL=checkbox.d.ts.map
|