@orbe-agro/client-core 5.2.1 → 5.2.2
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/@ecme/locales/lang/ptBR/pages.js +1 -1
- package/dist/@ecme/locales/lang/ptBR/pages.js.map +1 -1
- package/dist/@ecme/views/auth/ResetPassword/ResetPassword.js +44 -36
- package/dist/@ecme/views/auth/ResetPassword/ResetPassword.js.map +1 -1
- package/dist/@ecme/views/auth/ResetPassword/components/ResetPasswordForm.js +55 -51
- package/dist/@ecme/views/auth/ResetPassword/components/ResetPasswordForm.js.map +1 -1
- package/dist/@types/@ecme/views/auth/ResetPassword/ResetPassword.d.ts +2 -1
- package/dist/@types/@ecme/views/auth/ResetPassword/ResetPassword.d.ts.map +1 -1
- package/dist/@types/@ecme/views/auth/ResetPassword/components/ResetPasswordForm.d.ts +1 -0
- package/dist/@types/@ecme/views/auth/ResetPassword/components/ResetPasswordForm.d.ts.map +1 -1
- package/dist/base/configs/endpoints.config/adm/config/auth.js +1 -1
- package/dist/base/configs/endpoints.config/adm/config/auth.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ const e = {
|
|
|
3
3
|
auth: {
|
|
4
4
|
forgotPassword: {
|
|
5
5
|
title: "Recuperar Senha",
|
|
6
|
-
desc: "Por favor, insira seu email para receber um
|
|
6
|
+
desc: "Por favor, insira seu email para receber um link de recuperação.",
|
|
7
7
|
mailSent: "Verifique seu email",
|
|
8
8
|
mailSentDesc: "Enviamos uma recuperação de senha para seu email"
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages.js","sources":["../../../../../lib/@ecme/locales/lang/ptBR/pages.ts"],"sourcesContent":["import EnPages from '../en/pages'\n\nexport default {\n pages: {\n auth: {\n forgotPassword: {\n title: 'Recuperar Senha',\n desc: 'Por favor, insira seu email para receber um
|
|
1
|
+
{"version":3,"file":"pages.js","sources":["../../../../../lib/@ecme/locales/lang/ptBR/pages.ts"],"sourcesContent":["import EnPages from '../en/pages'\n\nexport default {\n pages: {\n auth: {\n forgotPassword: {\n title: 'Recuperar Senha',\n desc: 'Por favor, insira seu email para receber um link de recuperação.',\n mailSent: 'Verifique seu email',\n mailSentDesc:\n 'Enviamos uma recuperação de senha para seu email',\n },\n },\n },\n} as typeof EnPages\n"],"names":["pages"],"mappings":"AAEA,MAAAA,IAAe;AAAA,EACX,OAAO;AAAA,IACH,MAAM;AAAA,MACF,gBAAgB;AAAA,QACZ,OAAO;AAAA,QACP,MAAM;AAAA,QACN,UAAU;AAAA,QACV,cACI;AAAA,MAAA;AAAA,IACR;AAAA,EACJ;AAER;"}
|
|
@@ -1,71 +1,79 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as p } from "react";
|
|
1
|
+
import { jsxs as a, jsx as e, Fragment as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as c, useEffect as p } from "react";
|
|
3
3
|
import "../../../components/ui/Alert/index.js";
|
|
4
4
|
import "../../../components/ui/Button/index.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { useNavigate as
|
|
9
|
-
import
|
|
5
|
+
import g from "../../../components/shared/ActionLink.js";
|
|
6
|
+
import N from "./components/ResetPasswordForm.js";
|
|
7
|
+
import b from "../../../utils/hooks/useTimeOutMessage.js";
|
|
8
|
+
import { useNavigate as v, useSearchParams as x } from "react-router-dom";
|
|
9
|
+
import C from "../../../components/template/Logo.js";
|
|
10
10
|
import "../../../../base/utils/index.js";
|
|
11
11
|
import "../../../store/index.js";
|
|
12
12
|
import "../../../auth/index.js";
|
|
13
|
-
import { useThemeStore as
|
|
13
|
+
import { useThemeStore as k } from "../../../store/themeStore.js";
|
|
14
14
|
import R from "../../../auth/useAuth.js";
|
|
15
|
-
import { getLogoFilename as
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
const
|
|
19
|
-
signInUrl:
|
|
20
|
-
type: r
|
|
15
|
+
import { getLogoFilename as A } from "../../../../base/utils/logo.js";
|
|
16
|
+
import E from "../../../components/ui/Alert/Alert.js";
|
|
17
|
+
import P from "../../../components/ui/Button/Button.js";
|
|
18
|
+
const S = ({
|
|
19
|
+
signInUrl: o = "/sign-in",
|
|
20
|
+
type: r,
|
|
21
|
+
token: i
|
|
21
22
|
}) => {
|
|
22
|
-
const [
|
|
23
|
-
|
|
24
|
-
}, { mode:
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */ e("div", { className: "mb-12 flex flex-col items-center", children:
|
|
23
|
+
const [t, m] = c(!1), [s, l] = b(), d = v(), h = () => {
|
|
24
|
+
d(o);
|
|
25
|
+
}, { mode: u } = k(), { user: f } = R();
|
|
26
|
+
return /* @__PURE__ */ a("div", { children: [
|
|
27
|
+
/* @__PURE__ */ e("div", { className: "mb-12 flex flex-col items-center", children: t ? /* @__PURE__ */ a(n, { children: [
|
|
27
28
|
/* @__PURE__ */ e("h3", { className: "mb-2 text-success", children: "Operação finalizada" }),
|
|
28
29
|
/* @__PURE__ */ e("p", { className: "font-semibold", children: "Sua senha foi alterada com sucesso!" })
|
|
29
|
-
] }) : /* @__PURE__ */ e(
|
|
30
|
-
/* @__PURE__ */ e("h3", { className: "mb-2", children: "
|
|
31
|
-
/* @__PURE__ */ e("p", { className: "font-semibold", children: "
|
|
32
|
-
] }) : /* @__PURE__ */
|
|
30
|
+
] }) : /* @__PURE__ */ e(n, { children: r === "RECUPERARSENHA" ? /* @__PURE__ */ a(n, { children: [
|
|
31
|
+
/* @__PURE__ */ e("h3", { className: "mb-2", children: "Crie sua nova senha" }),
|
|
32
|
+
/* @__PURE__ */ e("p", { className: "font-semibold", children: "Digite e confirme sua nova senha abaixo." })
|
|
33
|
+
] }) : /* @__PURE__ */ a(n, { children: [
|
|
33
34
|
/* @__PURE__ */ e(
|
|
34
|
-
|
|
35
|
+
C,
|
|
35
36
|
{
|
|
36
37
|
imgClass: "mb-6 max-h-20",
|
|
37
|
-
name:
|
|
38
|
+
name: A(!0, u)
|
|
38
39
|
}
|
|
39
40
|
),
|
|
40
41
|
/* @__PURE__ */ e("h3", { className: "mb-2", children: "Primeiro Acesso" }),
|
|
41
42
|
" ",
|
|
42
43
|
/* @__PURE__ */ e("p", { className: "font-semibold", children: "Digite uma nova senha." })
|
|
43
44
|
] }) }) }),
|
|
44
|
-
|
|
45
|
+
s && /* @__PURE__ */ e(E, { showIcon: !0, className: "mb-4", type: "danger", children: /* @__PURE__ */ e("span", { className: "break-all", children: s }) }),
|
|
45
46
|
/* @__PURE__ */ e(
|
|
46
|
-
|
|
47
|
+
N,
|
|
47
48
|
{
|
|
48
|
-
resetComplete:
|
|
49
|
-
setMessage:
|
|
49
|
+
resetComplete: t,
|
|
50
|
+
setMessage: l,
|
|
50
51
|
setResetComplete: m,
|
|
51
52
|
type: r,
|
|
52
|
-
userId:
|
|
53
|
-
|
|
53
|
+
userId: f.userId ?? void 0,
|
|
54
|
+
token: i,
|
|
55
|
+
children: /* @__PURE__ */ e(P, { block: !0, variant: "solid", type: "button", onClick: h, children: "Continuar" })
|
|
54
56
|
}
|
|
55
57
|
),
|
|
56
58
|
/* @__PURE__ */ e("div", { className: "mt-4 text-center", children: /* @__PURE__ */ e(
|
|
57
|
-
|
|
59
|
+
g,
|
|
58
60
|
{
|
|
59
|
-
to:
|
|
61
|
+
to: o,
|
|
60
62
|
className: "heading-text font-bold",
|
|
61
63
|
themeColor: !1,
|
|
62
64
|
children: "Voltar"
|
|
63
65
|
}
|
|
64
66
|
) })
|
|
65
67
|
] });
|
|
66
|
-
},
|
|
68
|
+
}, J = () => {
|
|
69
|
+
const [o] = x(), [r, i] = c(null), [t, m] = c(null);
|
|
70
|
+
return p(() => {
|
|
71
|
+
const s = o.get("token");
|
|
72
|
+
s ? i(s) : m("Link de redefinição inválido ou token não encontrado.");
|
|
73
|
+
}, [o]), t ? /* @__PURE__ */ e("div", { className: "text-center text-red-500", children: t }) : r ? /* @__PURE__ */ e(S, { type: "RECUPERARSENHA", token: r }) : /* @__PURE__ */ e("div", { className: "text-center", children: "Carregando..." });
|
|
74
|
+
};
|
|
67
75
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
S as ResetPasswordBase,
|
|
77
|
+
J as default
|
|
70
78
|
};
|
|
71
79
|
//# sourceMappingURL=ResetPassword.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetPassword.js","sources":["../../../../../lib/@ecme/views/auth/ResetPassword/ResetPassword.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport Alert from \"@/components/ui/Alert\";\nimport Button from \"@/components/ui/Button\";\nimport ActionLink from \"@/components/shared/ActionLink\";\nimport ResetPasswordForm from \"./components/ResetPasswordForm\";\nimport useTimeOutMessage from \"@/utils/hooks/useTimeOutMessage\";\nimport { useNavigate } from \"react-router-dom\";\nimport { TAlterarPasswordType } from \"@base/@types/models/auth\";\nimport Logo from \"@/components/template/Logo\";\nimport { getLogoFilename } from \"@base/utils\";\nimport { useThemeStore } from \"@/store\";\nimport { useAuth } from \"@/auth\";\n\ntype ResetPasswordProps = {\n signInUrl?: string;\n type: TAlterarPasswordType;\n};\n\nexport const ResetPasswordBase = ({\n signInUrl = \"/sign-in\",\n type,\n}: ResetPasswordProps) => {\n const [resetComplete, setResetComplete] = useState(false);\n\n const [message, setMessage] = useTimeOutMessage();\n\n const navigate = useNavigate();\n\n const handleContinue = () => {\n navigate(signInUrl);\n };\n\n const { mode } = useThemeStore();\n const { user } = useAuth();\n\n return (\n <div>\n <div className=\"mb-12 flex flex-col items-center\">\n {resetComplete ? (\n <>\n <h3 className=\"mb-2 text-success\">Operação finalizada</h3>\n <p className=\"font-semibold\">Sua senha foi alterada com sucesso!</p>\n </>\n ) : (\n <>\n {type === \"RECUPERARSENHA\" ? (\n <>\n <h3 className=\"mb-2\">
|
|
1
|
+
{"version":3,"file":"ResetPassword.js","sources":["../../../../../lib/@ecme/views/auth/ResetPassword/ResetPassword.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport Alert from \"@/components/ui/Alert\";\nimport Button from \"@/components/ui/Button\";\nimport ActionLink from \"@/components/shared/ActionLink\";\nimport ResetPasswordForm from \"./components/ResetPasswordForm\";\nimport useTimeOutMessage from \"@/utils/hooks/useTimeOutMessage\";\nimport { useNavigate, useSearchParams } from \"react-router-dom\";\nimport { TAlterarPasswordType } from \"@base/@types/models/auth\";\nimport Logo from \"@/components/template/Logo\";\nimport { getLogoFilename } from \"@base/utils\";\nimport { useThemeStore } from \"@/store\";\nimport { useAuth } from \"@/auth\";\n\ntype ResetPasswordProps = {\n signInUrl?: string;\n type: TAlterarPasswordType;\n token?: string;\n};\n\nexport const ResetPasswordBase = ({\n signInUrl = \"/sign-in\",\n type,\n token,\n}: ResetPasswordProps) => {\n const [resetComplete, setResetComplete] = useState(false);\n\n const [message, setMessage] = useTimeOutMessage();\n\n const navigate = useNavigate();\n\n const handleContinue = () => {\n navigate(signInUrl);\n };\n\n const { mode } = useThemeStore();\n const { user } = useAuth();\n\n return (\n <div>\n <div className=\"mb-12 flex flex-col items-center\">\n {resetComplete ? (\n <>\n <h3 className=\"mb-2 text-success\">Operação finalizada</h3>\n <p className=\"font-semibold\">Sua senha foi alterada com sucesso!</p>\n </>\n ) : (\n <>\n {type === \"RECUPERARSENHA\" ? (\n <>\n <h3 className=\"mb-2\">Crie sua nova senha</h3>\n <p className=\"font-semibold\">\n Digite e confirme sua nova senha abaixo.\n </p>\n </>\n ) : (\n <>\n <Logo\n imgClass=\"mb-6 max-h-20\"\n name={getLogoFilename(true, mode)}\n />\n <h3 className=\"mb-2\">Primeiro Acesso</h3>{\" \"}\n <p className=\"font-semibold\">Digite uma nova senha.</p>\n </>\n )}\n </>\n )}\n </div>\n {message && (\n <Alert showIcon className=\"mb-4\" type=\"danger\">\n <span className=\"break-all\">{message}</span>\n </Alert>\n )}\n <ResetPasswordForm\n resetComplete={resetComplete}\n setMessage={setMessage}\n setResetComplete={setResetComplete}\n type={type}\n userId={user.userId ?? undefined}\n token={token}\n >\n <Button block variant=\"solid\" type=\"button\" onClick={handleContinue}>\n Continuar\n </Button>\n </ResetPasswordForm>\n <div className=\"mt-4 text-center\">\n <ActionLink\n to={signInUrl}\n className=\"heading-text font-bold\"\n themeColor={false}\n >\n Voltar\n </ActionLink>\n </div>\n </div>\n );\n};\n\nconst ResetPassword = () => {\n const [searchParams] = useSearchParams();\n const [token, setToken] = useState<string | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n const tokenFromUrl = searchParams.get(\"token\");\n\n if (tokenFromUrl) {\n setToken(tokenFromUrl);\n } else {\n setError(\"Link de redefinição inválido ou token não encontrado.\");\n }\n }, [searchParams]);\n\n if (error) {\n return <div className=\"text-center text-red-500\">{error}</div>;\n }\n\n if (!token) {\n return <div className=\"text-center\">Carregando...</div>;\n }\n\n return <ResetPasswordBase type=\"RECUPERARSENHA\" token={token} />;\n};\n\nexport default ResetPassword;\n"],"names":["ResetPasswordBase","signInUrl","type","token","resetComplete","setResetComplete","useState","message","setMessage","useTimeOutMessage","navigate","useNavigate","handleContinue","mode","useThemeStore","user","useAuth","jsx","jsxs","Fragment","Logo","getLogoFilename","Alert","ResetPasswordForm","Button","ActionLink","ResetPassword","searchParams","useSearchParams","setToken","error","setError","useEffect","tokenFromUrl"],"mappings":";;;;;;;;;;;;;;;;;AAmBO,MAAMA,IAAoB,CAAC;AAAA,EAChC,WAAAC,IAAY;AAAA,EACZ,MAAAC;AAAA,EACA,OAAAC;AACF,MAA0B;AACxB,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAK,GAElD,CAACC,GAASC,CAAU,IAAIC,EAAA,GAExBC,IAAWC,EAAA,GAEXC,IAAiB,MAAM;AAC3B,IAAAF,EAAST,CAAS;AAAA,EAAA,GAGd,EAAE,MAAAY,EAAA,IAASC,EAAA,GACX,EAAE,MAAAC,EAAA,IAASC,EAAA;AAEjB,2BACG,OAAA,EACC,UAAA;AAAA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,MAAK,UAAS,SAASZ,GAAgB,UAAA,YAAA,CAErE;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,gBAAAK,EAAC,OAAA,EAAI,WAAU,oBACb,UAAA,gBAAAA;AAAA,MAACQ;AAAA,MAAA;AAAA,QACC,IAAIxB;AAAA,QACJ,WAAU;AAAA,QACV,YAAY;AAAA,QACb,UAAA;AAAA,MAAA;AAAA,IAAA,EAED,CACF;AAAA,EAAA,GACF;AAEJ,GAEMyB,IAAgB,MAAM;AAC1B,QAAM,CAACC,CAAY,IAAIC,EAAA,GACjB,CAACzB,GAAO0B,CAAQ,IAAIvB,EAAwB,IAAI,GAChD,CAACwB,GAAOC,CAAQ,IAAIzB,EAAwB,IAAI;AAYtD,SAVA0B,EAAU,MAAM;AACd,UAAMC,IAAeN,EAAa,IAAI,OAAO;AAE7C,IAAIM,IACFJ,EAASI,CAAY,IAErBF,EAAS,uDAAuD;AAAA,EAClE,GACC,CAACJ,CAAY,CAAC,GAEbG,IACK,gBAAAb,EAAC,OAAA,EAAI,WAAU,4BAA4B,UAAAa,GAAM,IAGrD3B,IAIE,gBAAAc,EAACjB,GAAA,EAAkB,MAAK,kBAAiB,OAAAG,EAAA,CAAc,IAHrD,gBAAAc,EAAC,OAAA,EAAI,WAAU,eAAc,UAAA,iBAAa;AAIrD;"}
|
|
@@ -1,75 +1,79 @@
|
|
|
1
|
-
import { jsx as r, jsxs as L, Fragment as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsx as r, jsxs as L, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { useState as I } from "react";
|
|
3
3
|
import "../../../../components/ui/Button/index.js";
|
|
4
4
|
import "../../../../components/ui/Form/index.js";
|
|
5
5
|
import w from "../../../../components/shared/PasswordInput.js";
|
|
6
|
-
import { apiResetPassword as
|
|
6
|
+
import { apiResetPassword as k } from "../../../../services/AuthService.js";
|
|
7
7
|
import { useForm as B, Controller as h } from "react-hook-form";
|
|
8
8
|
import { zodResolver as N } from "@hookform/resolvers/zod";
|
|
9
|
-
import { z as
|
|
9
|
+
import { z as s } from "zod";
|
|
10
10
|
import "../../../../auth/index.js";
|
|
11
11
|
import { useNavigate as _ } from "react-router-dom";
|
|
12
12
|
import j from "../../../../configs/app.config.js";
|
|
13
13
|
import { useThemeStore as x } from "../../../../store/themeStore.js";
|
|
14
|
-
import { LAYOUT_COLLAPSIBLE_SIDE as
|
|
15
|
-
import
|
|
16
|
-
import { Form as
|
|
14
|
+
import { LAYOUT_COLLAPSIBLE_SIDE as T } from "../../../../constants/theme.constant.js";
|
|
15
|
+
import U from "../../../../auth/useAuth.js";
|
|
16
|
+
import { Form as q } from "../../../../components/ui/Form/Form.js";
|
|
17
17
|
import P from "../../../../components/ui/Form/FormItem.js";
|
|
18
|
-
import
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
import z from "../../../../components/ui/Button/Button.js";
|
|
19
|
+
const H = s.object({
|
|
20
|
+
token: s.string().optional(),
|
|
21
|
+
id: s.string().optional(),
|
|
22
|
+
newPassword: s.string({ required_error: "Por favor digite uma senha" }),
|
|
23
|
+
confirmPassword: s.string({
|
|
23
24
|
required_error: "Confirme sua nova senha."
|
|
24
25
|
})
|
|
25
|
-
}).refine((
|
|
26
|
+
}).refine((t) => t.newPassword === t.confirmPassword, {
|
|
26
27
|
message: "As senhas não são iguais.",
|
|
27
28
|
path: ["confirmPassword"]
|
|
28
|
-
}),
|
|
29
|
-
var
|
|
30
|
-
const [
|
|
29
|
+
}), nr = (t) => {
|
|
30
|
+
var p, c;
|
|
31
|
+
const [d, a] = I(!1), g = _(), { updateUserSession: v } = U(), S = x((o) => o.setLayout), {
|
|
31
32
|
className: b,
|
|
32
|
-
setMessage:
|
|
33
|
-
setResetComplete:
|
|
34
|
-
resetComplete:
|
|
35
|
-
children:
|
|
36
|
-
type:
|
|
37
|
-
userId:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
setMessage: i,
|
|
34
|
+
setResetComplete: m,
|
|
35
|
+
resetComplete: y,
|
|
36
|
+
children: C,
|
|
37
|
+
type: E,
|
|
38
|
+
userId: A,
|
|
39
|
+
token: l
|
|
40
|
+
} = t, {
|
|
41
|
+
handleSubmit: R,
|
|
42
|
+
formState: { errors: n },
|
|
43
|
+
control: f
|
|
42
44
|
} = B({
|
|
43
|
-
resolver: N(
|
|
45
|
+
resolver: N(H)
|
|
44
46
|
});
|
|
45
|
-
return /* @__PURE__ */ r("div", { className: b, children:
|
|
46
|
-
const { newPassword:
|
|
47
|
-
|
|
47
|
+
return /* @__PURE__ */ r("div", { className: b, children: y ? /* @__PURE__ */ r(F, { children: C }) : /* @__PURE__ */ L(q, { onSubmit: R(async (o) => {
|
|
48
|
+
const { newPassword: u } = o;
|
|
49
|
+
a(!0);
|
|
48
50
|
try {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
let e;
|
|
52
|
+
if (E === "RECUPERARSENHA") {
|
|
53
|
+
if (!l)
|
|
54
|
+
throw new Error("Token de recuperação não fornecido.");
|
|
55
|
+
e = { token: l, password: u };
|
|
56
|
+
} else
|
|
57
|
+
e = { id: A ?? "", password: u };
|
|
58
|
+
await k(e), a(!1), m == null || m(!0), v({ primeiroAcesso: !1 }), S(T), g(j.authenticatedEntryPath);
|
|
59
|
+
} catch (e) {
|
|
60
|
+
i == null || i(
|
|
61
|
+
typeof e == "string" ? e : "Houve um erro ao alterar sua senha."
|
|
62
|
+
), a(!1);
|
|
58
63
|
}
|
|
59
|
-
|
|
64
|
+
a(!1);
|
|
60
65
|
}), children: [
|
|
61
|
-
d === "RECUPERARSENHA" && /* @__PURE__ */ r(u, {}),
|
|
62
66
|
/* @__PURE__ */ r(
|
|
63
67
|
P,
|
|
64
68
|
{
|
|
65
69
|
label: "Senha",
|
|
66
|
-
invalid: !!
|
|
67
|
-
errorMessage: (
|
|
70
|
+
invalid: !!n.newPassword,
|
|
71
|
+
errorMessage: (p = n.newPassword) == null ? void 0 : p.message,
|
|
68
72
|
children: /* @__PURE__ */ r(
|
|
69
73
|
h,
|
|
70
74
|
{
|
|
71
75
|
name: "newPassword",
|
|
72
|
-
control:
|
|
76
|
+
control: f,
|
|
73
77
|
render: ({ field: o }) => /* @__PURE__ */ r(
|
|
74
78
|
w,
|
|
75
79
|
{
|
|
@@ -86,13 +90,13 @@ const O = t.object({
|
|
|
86
90
|
P,
|
|
87
91
|
{
|
|
88
92
|
label: "Confirmar Senha",
|
|
89
|
-
invalid: !!
|
|
90
|
-
errorMessage: (c =
|
|
93
|
+
invalid: !!n.confirmPassword,
|
|
94
|
+
errorMessage: (c = n.confirmPassword) == null ? void 0 : c.message,
|
|
91
95
|
children: /* @__PURE__ */ r(
|
|
92
96
|
h,
|
|
93
97
|
{
|
|
94
98
|
name: "confirmPassword",
|
|
95
|
-
control:
|
|
99
|
+
control: f,
|
|
96
100
|
render: ({ field: o }) => /* @__PURE__ */ r(
|
|
97
101
|
w,
|
|
98
102
|
{
|
|
@@ -106,19 +110,19 @@ const O = t.object({
|
|
|
106
110
|
}
|
|
107
111
|
),
|
|
108
112
|
/* @__PURE__ */ r(
|
|
109
|
-
|
|
113
|
+
z,
|
|
110
114
|
{
|
|
111
115
|
className: "mt-5",
|
|
112
116
|
block: !0,
|
|
113
|
-
loading:
|
|
117
|
+
loading: d,
|
|
114
118
|
variant: "solid",
|
|
115
119
|
type: "submit",
|
|
116
|
-
children:
|
|
120
|
+
children: d ? "Enviando..." : "Enviar"
|
|
117
121
|
}
|
|
118
122
|
)
|
|
119
123
|
] }) });
|
|
120
124
|
};
|
|
121
125
|
export {
|
|
122
|
-
|
|
126
|
+
nr as default
|
|
123
127
|
};
|
|
124
128
|
//# sourceMappingURL=ResetPasswordForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetPasswordForm.js","sources":["../../../../../../lib/@ecme/views/auth/ResetPassword/components/ResetPasswordForm.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport Button from \"@/components/ui/Button\";\nimport { FormItem, Form } from \"@/components/ui/Form\";\nimport PasswordInput from \"@/components/shared/PasswordInput\";\nimport { apiResetPassword } from \"@/services/AuthService\";\nimport { useForm, Controller } from \"react-hook-form\";\nimport { zodResolver } from \"@hookform/resolvers/zod\";\nimport { z } from \"zod\";\nimport type { ZodType } from \"zod\";\nimport type { CommonProps } from \"@/@types/common\";\nimport { TAlterarPasswordType } from \"@base/@types/models/auth\";\nimport {
|
|
1
|
+
{"version":3,"file":"ResetPasswordForm.js","sources":["../../../../../../lib/@ecme/views/auth/ResetPassword/components/ResetPasswordForm.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport Button from \"@/components/ui/Button\";\nimport { FormItem, Form } from \"@/components/ui/Form\";\nimport PasswordInput from \"@/components/shared/PasswordInput\";\nimport { apiResetPassword } from \"@/services/AuthService\";\nimport { useForm, Controller } from \"react-hook-form\";\nimport { zodResolver } from \"@hookform/resolvers/zod\";\nimport { z } from \"zod\";\nimport type { ZodType } from \"zod\";\nimport type { CommonProps } from \"@/@types/common\";\nimport { TAlterarPasswordType } from \"@base/@types/models/auth\";\nimport { useAuth } from \"@/auth\";\nimport { useNavigate } from \"react-router-dom\";\nimport appConfig from \"@/configs/app.config\";\nimport { useThemeStore } from \"@/store/themeStore\";\nimport { LAYOUT_COLLAPSIBLE_SIDE } from \"@/constants/theme.constant\";\n\ninterface ResetPasswordFormProps extends CommonProps {\n resetComplete: boolean;\n setResetComplete?: (compplete: boolean) => void;\n setMessage?: (message: string) => void;\n type: TAlterarPasswordType;\n userId?: string;\n token?: string;\n}\n\ntype ResetPasswordFormSchema = {\n newPassword: string;\n confirmPassword: string;\n};\n\nconst validationSchema: ZodType<ResetPasswordFormSchema> = z\n .object({\n token: z.string().optional(),\n id: z.string().optional(),\n newPassword: z.string({ required_error: \"Por favor digite uma senha\" }),\n confirmPassword: z.string({\n required_error: \"Confirme sua nova senha.\",\n }),\n })\n .refine((data) => data.newPassword === data.confirmPassword, {\n message: \"As senhas não são iguais.\",\n path: [\"confirmPassword\"],\n });\n\nconst ResetPasswordForm = (props: ResetPasswordFormProps) => {\n const [isSubmitting, setSubmitting] = useState<boolean>(false);\n const navigate = useNavigate();\n const { updateUserSession } = useAuth();\n const setLayout = useThemeStore((state) => state.setLayout);\n\n const {\n className,\n setMessage,\n setResetComplete,\n resetComplete,\n children,\n type,\n userId,\n token,\n } = props;\n\n const {\n handleSubmit,\n formState: { errors },\n control,\n } = useForm<ResetPasswordFormSchema>({\n resolver: zodResolver(validationSchema),\n });\n\n const onResetPassword = async (values: ResetPasswordFormSchema) => {\n const { newPassword } = values;\n setSubmitting(true);\n\n try {\n let payload;\n if (type === \"RECUPERARSENHA\") {\n if (!token) {\n throw new Error(\"Token de recuperação não fornecido.\");\n }\n payload = { token, password: newPassword };\n } else {\n payload = { id: userId ?? \"\", password: newPassword };\n }\n await apiResetPassword(payload);\n\n setSubmitting(false);\n setResetComplete?.(true);\n updateUserSession({ primeiroAcesso: false });\n setLayout(LAYOUT_COLLAPSIBLE_SIDE);\n navigate(appConfig.authenticatedEntryPath);\n } catch (errors) {\n setMessage?.(\n typeof errors === \"string\"\n ? errors\n : \"Houve um erro ao alterar sua senha.\"\n );\n setSubmitting(false);\n }\n\n setSubmitting(false);\n };\n\n return (\n <div className={className}>\n {!resetComplete ? (\n <Form onSubmit={handleSubmit(onResetPassword)}>\n <FormItem\n label=\"Senha\"\n invalid={Boolean(errors.newPassword)}\n errorMessage={errors.newPassword?.message}\n >\n <Controller\n name=\"newPassword\"\n control={control}\n render={({ field }) => (\n <PasswordInput\n autoComplete=\"off\"\n placeholder=\"••••••••••••\"\n {...field}\n />\n )}\n />\n </FormItem>\n <FormItem\n label=\"Confirmar Senha\"\n invalid={Boolean(errors.confirmPassword)}\n errorMessage={errors.confirmPassword?.message}\n >\n <Controller\n name=\"confirmPassword\"\n control={control}\n render={({ field }) => (\n <PasswordInput\n autoComplete=\"off\"\n placeholder=\"Confirm Password\"\n {...field}\n />\n )}\n />\n </FormItem>\n <Button\n className=\"mt-5\"\n block\n loading={isSubmitting}\n variant=\"solid\"\n type=\"submit\"\n >\n {isSubmitting ? \"Enviando...\" : \"Enviar\"}\n </Button>\n </Form>\n ) : (\n <>{children}</>\n )}\n </div>\n );\n};\n\nexport default ResetPasswordForm;\n"],"names":["validationSchema","z","data","ResetPasswordForm","props","isSubmitting","setSubmitting","useState","navigate","useNavigate","updateUserSession","useAuth","setLayout","useThemeStore","state","className","setMessage","setResetComplete","resetComplete","children","type","userId","token","handleSubmit","errors","control","useForm","zodResolver","jsx","Fragment","Form","values","newPassword","payload","apiResetPassword","LAYOUT_COLLAPSIBLE_SIDE","appConfig","FormItem","_a","Controller","field","PasswordInput","_b","Button"],"mappings":";;;;;;;;;;;;;;;;;;AA+BA,MAAMA,IAAqDC,EACxD,OAAO;AAAA,EACN,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,IAAIA,EAAE,OAAA,EAAS,SAAA;AAAA,EACf,aAAaA,EAAE,OAAO,EAAE,gBAAgB,8BAA8B;AAAA,EACtE,iBAAiBA,EAAE,OAAO;AAAA,IACxB,gBAAgB;AAAA,EAAA,CACjB;AACH,CAAC,EACA,OAAO,CAACC,MAASA,EAAK,gBAAgBA,EAAK,iBAAiB;AAAA,EAC3D,SAAS;AAAA,EACT,MAAM,CAAC,iBAAiB;AAC1B,CAAC,GAEGC,KAAoB,CAACC,MAAkC;;AAC3D,QAAM,CAACC,GAAcC,CAAa,IAAIC,EAAkB,EAAK,GACvDC,IAAWC,EAAA,GACX,EAAE,mBAAAC,EAAA,IAAsBC,EAAA,GACxBC,IAAYC,EAAc,CAACC,MAAUA,EAAM,SAAS,GAEpD;AAAA,IACJ,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,UAAAC;AAA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AAA,YACC,MAAK;AAAA,YACL,SAAAd;AAAA,YACA,QAAQ,CAAC,EAAE,OAAAe,EAAA,MACT,gBAAAZ;AAAA,cAACa;AAAA,cAAA;AAAA,gBACC,cAAa;AAAA,gBACb,aAAY;AAAA,gBACX,GAAGD;AAAA,cAAA;AAAA,YAAA;AAAA,UACN;AAAA,QAAA;AAAA,MAEJ;AAAA,IAAA;AAAA,IAEF,gBAAAZ;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,SAAS,EAAQb,EAAO;AAAA,QACxB,eAAckB,IAAAlB,EAAO,oBAAP,gBAAAkB,EAAwB;AAAA,QAEtC,UAAA,gBAAAd;AAAA,UAACW;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAAd;AAAA,YACA,QAAQ,CAAC,EAAE,OAAAe,EAAA,MACT,gBAAAZ;AAAA,cAACa;AAAA,cAAA;AAAA,gBACC,cAAa;AAAA,gBACb,aAAY;AAAA,gBACX,GAAGD;AAAA,cAAA;AAAA,YAAA;AAAA,UACN;AAAA,QAAA;AAAA,MAEJ;AAAA,IAAA;AAAA,IAEF,gBAAAZ;AAAA,MAACe;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,QACV,OAAK;AAAA,QACL,SAAStC;AAAA,QACT,SAAQ;AAAA,QACR,MAAK;AAAA,QAEJ,cAAe,gBAAgB;AAAA,MAAA;AAAA,IAAA;AAAA,EAClC,EAAA,CACF,EAEY,CAEhB;AAEJ;"}
|
|
@@ -2,8 +2,9 @@ import { TAlterarPasswordType } from "@base/@types/models/auth";
|
|
|
2
2
|
type ResetPasswordProps = {
|
|
3
3
|
signInUrl?: string;
|
|
4
4
|
type: TAlterarPasswordType;
|
|
5
|
+
token?: string;
|
|
5
6
|
};
|
|
6
|
-
export declare const ResetPasswordBase: ({ signInUrl, type, }: ResetPasswordProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const ResetPasswordBase: ({ signInUrl, type, token, }: ResetPasswordProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
declare const ResetPassword: () => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export default ResetPassword;
|
|
9
10
|
//# sourceMappingURL=ResetPassword.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetPassword.d.ts","sourceRoot":"","sources":["../../../../../../lib/@ecme/views/auth/ResetPassword/ResetPassword.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAMhE,KAAK,kBAAkB,GAAG;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ResetPassword.d.ts","sourceRoot":"","sources":["../../../../../../lib/@ecme/views/auth/ResetPassword/ResetPassword.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAMhE,KAAK,kBAAkB,GAAG;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,6BAI/B,kBAAkB,4CAwEpB,CAAC;AAEF,QAAA,MAAM,aAAa,+CAwBlB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -6,6 +6,7 @@ interface ResetPasswordFormProps extends CommonProps {
|
|
|
6
6
|
setMessage?: (message: string) => void;
|
|
7
7
|
type: TAlterarPasswordType;
|
|
8
8
|
userId?: string;
|
|
9
|
+
token?: string;
|
|
9
10
|
}
|
|
10
11
|
declare const ResetPasswordForm: (props: ResetPasswordFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export default ResetPasswordForm;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetPasswordForm.d.ts","sourceRoot":"","sources":["../../../../../../../lib/@ecme/views/auth/ResetPassword/components/ResetPasswordForm.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"ResetPasswordForm.d.ts","sourceRoot":"","sources":["../../../../../../../lib/@ecme/views/auth/ResetPassword/components/ResetPasswordForm.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAOhE,UAAU,sBAAuB,SAAQ,WAAW;IAClD,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAqBD,QAAA,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,4CA+GvD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -2,7 +2,7 @@ const a = {
|
|
|
2
2
|
signin: "/auth/api/auth/login",
|
|
3
3
|
signout: "/",
|
|
4
4
|
register: "/auth/register",
|
|
5
|
-
forgotPassword: "/auth/esqueci-minha-senha",
|
|
5
|
+
forgotPassword: "/auth/api/auth/esqueci-minha-senha",
|
|
6
6
|
alterPassword: "/auth/api/auth/alter-password",
|
|
7
7
|
changeProfilePic: "/auth/change-profile-picture"
|
|
8
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sources":["../../../../../../lib/base/configs/endpoints.config/adm/config/auth.ts"],"sourcesContent":["const auth = {\n signin: \"/auth/api/auth/login\",\n signout: \"/\",\n register: \"/auth/register\",\n forgotPassword: \"/auth/esqueci-minha-senha\",\n alterPassword: \"/auth/api/auth/alter-password\",\n changeProfilePic: \"/auth/change-profile-picture\",\n};\n\nexport default auth;\n"],"names":["auth"],"mappings":"AAAA,MAAMA,IAAO;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,kBAAkB;AACpB;"}
|
|
1
|
+
{"version":3,"file":"auth.js","sources":["../../../../../../lib/base/configs/endpoints.config/adm/config/auth.ts"],"sourcesContent":["const auth = {\n signin: \"/auth/api/auth/login\",\n signout: \"/\",\n register: \"/auth/register\",\n forgotPassword: \"/auth/api/auth/esqueci-minha-senha\",\n alterPassword: \"/auth/api/auth/alter-password\",\n changeProfilePic: \"/auth/change-profile-picture\",\n};\n\nexport default auth;\n"],"names":["auth"],"mappings":"AAAA,MAAMA,IAAO;AAAA,EACX,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,kBAAkB;AACpB;"}
|