@archbase/security 4.0.47 → 4.1.1
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/archbase-security-4.1.1.tgz +0 -0
- package/dist/index.js +427 -381
- package/dist/src/ArchbaseSecurityDiagnosticsService.d.ts +33 -0
- package/dist/src/SecurityDiagnosticsDomain.d.ts +122 -0
- package/dist/src/examples/ContextualAuthenticationExample.d.ts +3 -3
- package/dist/src/index.d.ts +2 -0
- package/package.json +5 -5
- package/dist/archbase-security-4.0.47.tgz +0 -0
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import * as
|
|
3
|
-
import { decorate as
|
|
4
|
-
import { compressString as
|
|
5
|
-
import
|
|
6
|
-
import { jwtDecode as
|
|
7
|
-
import { jsx as n, jsxs as
|
|
8
|
-
import it, { useState as p, useEffect as
|
|
2
|
+
import * as C from "inversify";
|
|
3
|
+
import { decorate as Ot, injectable as Lt } from "inversify";
|
|
4
|
+
import { compressString as $t, decompressString as jt, IOCContainer as zt, ARCHBASE_IOC_API_TYPE as Y, processErrorMessage as ne, IsNotEmpty as Q, IsOptional as ae, IsBoolean as re, IsEmail as Ft, getKeyByEnumValue as Qe, useArchbasePasswordRemember as Vt, getI18nextInstance as x, useArchbaseTheme as Ht, resolveArchbasePasswordPolicy as Wt, isEmailValidate as Gt, validateArchbasePassword as Jt, useArchbaseAppContext as Kt } from "@archbase/core";
|
|
5
|
+
import q from "crypto-js";
|
|
6
|
+
import { jwtDecode as qt } from "jwt-decode";
|
|
7
|
+
import { jsx as n, jsxs as I, Fragment as ie } from "react/jsx-runtime";
|
|
8
|
+
import it, { useState as p, useEffect as X, createContext as Ve, useMemo as at, useRef as ct, useCallback as Ce, useContext as He } from "react";
|
|
9
9
|
import { BehaviorSubject as Ze } from "rxjs";
|
|
10
10
|
import { ArchbaseRemoteApiService as ge, useArchbaseStore as lt } from "@archbase/data";
|
|
11
11
|
import { v4 as Z } from "uuid";
|
|
12
|
-
import { Card as
|
|
12
|
+
import { Card as We, Text as z, Divider as Ue, Stack as Ee, TextInput as xe, Button as G, Anchor as et, Group as ue, Select as Yt, Tooltip as Xt, Loader as dt, PasswordInput as je, Checkbox as Qt, Alert as tt, Code as rt, CopyButton as st, SimpleGrid as Zt, useMantineColorScheme as er, Box as tr, Skeleton as Ie } from "@mantine/core";
|
|
13
13
|
import { useFocusTrap as ut } from "@mantine/hooks";
|
|
14
|
-
import { IconCopy as
|
|
15
|
-
import { ArchbaseQRCode as
|
|
14
|
+
import { IconCopy as rr } from "@tabler/icons-react";
|
|
15
|
+
import { ArchbaseQRCode as sr, ArchbasePasswordStrengthMeter as or, ArchbaseDialog as ot } from "@archbase/components";
|
|
16
16
|
import { useContainer as De } from "inversify-react";
|
|
17
17
|
class ht {
|
|
18
18
|
id;
|
|
@@ -38,13 +38,13 @@ class pt {
|
|
|
38
38
|
return new pt({});
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
const le = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", Ne = "c1ab58e7-c113-4225-a190-a9e59d1207fc", Be = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd",
|
|
42
|
-
class
|
|
41
|
+
const le = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", Ne = "c1ab58e7-c113-4225-a190-a9e59d1207fc", Be = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", Oe = "602b05c5-ec46-451e-aba6-187e463bc245", Le = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
|
|
42
|
+
class nr {
|
|
43
43
|
getUsernameAndPassword() {
|
|
44
44
|
try {
|
|
45
45
|
const e = localStorage.getItem(Be);
|
|
46
46
|
if (e) {
|
|
47
|
-
const t =
|
|
47
|
+
const t = q.AES.decrypt(e, le).toString(q.enc.Utf8), o = atob(t).split(":");
|
|
48
48
|
return { username: o[0], password: o[1], remember: !0 };
|
|
49
49
|
} else
|
|
50
50
|
return null;
|
|
@@ -53,14 +53,14 @@ class or {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
saveUsernameAndPassword(e, t) {
|
|
56
|
-
const s = btoa(`${e}:${t}`), o =
|
|
56
|
+
const s = btoa(`${e}:${t}`), o = q.AES.encrypt(s, le).toString();
|
|
57
57
|
localStorage.setItem(Be, o);
|
|
58
58
|
}
|
|
59
59
|
getUsername() {
|
|
60
60
|
try {
|
|
61
|
-
const e = localStorage.getItem(
|
|
61
|
+
const e = localStorage.getItem(Oe);
|
|
62
62
|
if (e) {
|
|
63
|
-
const t =
|
|
63
|
+
const t = q.AES.decrypt(e, le).toString(q.enc.Utf8);
|
|
64
64
|
return atob(t);
|
|
65
65
|
} else
|
|
66
66
|
return null;
|
|
@@ -69,15 +69,15 @@ class or {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
saveUsername(e) {
|
|
72
|
-
const t = btoa(e), s =
|
|
73
|
-
localStorage.setItem(
|
|
72
|
+
const t = btoa(e), s = q.AES.encrypt(t, le).toString();
|
|
73
|
+
localStorage.setItem(Oe, s);
|
|
74
74
|
}
|
|
75
75
|
isTokenExpired(e, t = 300) {
|
|
76
76
|
let s = e;
|
|
77
77
|
if (!s && !this.getToken())
|
|
78
78
|
return !0;
|
|
79
79
|
try {
|
|
80
|
-
const o =
|
|
80
|
+
const o = qt(s.access_token);
|
|
81
81
|
if (!o)
|
|
82
82
|
return !0;
|
|
83
83
|
const a = Math.floor(Date.now() / 1e3), c = o.exp;
|
|
@@ -88,13 +88,13 @@ class or {
|
|
|
88
88
|
}
|
|
89
89
|
saveToken(e) {
|
|
90
90
|
if (e) {
|
|
91
|
-
const t = JSON.stringify(e), s =
|
|
91
|
+
const t = JSON.stringify(e), s = q.AES.encrypt(t, le).toString(), o = $t(s);
|
|
92
92
|
localStorage.setItem(Ne, o);
|
|
93
93
|
} else
|
|
94
94
|
this.clearToken();
|
|
95
95
|
}
|
|
96
96
|
clearUsernameAndPassword() {
|
|
97
|
-
localStorage.removeItem(Be), localStorage.removeItem(
|
|
97
|
+
localStorage.removeItem(Be), localStorage.removeItem(Oe);
|
|
98
98
|
}
|
|
99
99
|
clearToken() {
|
|
100
100
|
localStorage.removeItem(Ne);
|
|
@@ -104,7 +104,7 @@ class or {
|
|
|
104
104
|
const e = localStorage.getItem(Ne);
|
|
105
105
|
if (!e)
|
|
106
106
|
return null;
|
|
107
|
-
const t =
|
|
107
|
+
const t = jt(e), s = q.AES.decrypt(t, le).toString(q.enc.Utf8);
|
|
108
108
|
return JSON.parse(s);
|
|
109
109
|
} catch {
|
|
110
110
|
return null;
|
|
@@ -112,37 +112,37 @@ class or {
|
|
|
112
112
|
}
|
|
113
113
|
saveContext(e) {
|
|
114
114
|
try {
|
|
115
|
-
const t =
|
|
116
|
-
localStorage.setItem(
|
|
115
|
+
const t = q.AES.encrypt(e, le).toString();
|
|
116
|
+
localStorage.setItem(Le, t);
|
|
117
117
|
} catch (t) {
|
|
118
118
|
console.warn("Erro ao salvar contexto:", t);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
getContext() {
|
|
122
122
|
try {
|
|
123
|
-
const e = localStorage.getItem(
|
|
124
|
-
return e ?
|
|
123
|
+
const e = localStorage.getItem(Le);
|
|
124
|
+
return e ? q.AES.decrypt(e, le).toString(q.enc.Utf8) : null;
|
|
125
125
|
} catch {
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
clearContext() {
|
|
130
|
-
localStorage.removeItem(
|
|
130
|
+
localStorage.removeItem(Le);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
Ot(Lt(), nr);
|
|
134
134
|
function ft(r) {
|
|
135
135
|
const t = new Uint8Array(1);
|
|
136
136
|
return window.crypto.getRandomValues(t), t[0] >= Math.floor(256 / r) * r ? ft(r) : t[0] % r;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function ir(r) {
|
|
139
139
|
let e = "";
|
|
140
140
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
141
141
|
for (let s = 0; s < r; s++)
|
|
142
142
|
e += t.charAt(ft(t.length - 1));
|
|
143
143
|
return e;
|
|
144
144
|
}
|
|
145
|
-
async function
|
|
145
|
+
async function ar(r) {
|
|
146
146
|
if (!window.crypto.subtle?.digest)
|
|
147
147
|
throw new Error(
|
|
148
148
|
"The context/environment is not secure, and does not support the 'crypto.subtle' module. See: https://developer.mozilla.org/en-US/docs/Web/API/Crypto/subtle for details"
|
|
@@ -157,16 +157,16 @@ class mt extends Error {
|
|
|
157
157
|
super(s), this.name = "FetchError", this.status = e, this.statusText = t;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function cr(r) {
|
|
161
161
|
let e = "";
|
|
162
162
|
return Object.entries(r).forEach(([t, s]) => {
|
|
163
163
|
e += (e ? "&" : "") + t + "=" + encodeURIComponent(s);
|
|
164
164
|
}), e;
|
|
165
165
|
}
|
|
166
|
-
async function
|
|
166
|
+
async function lr(r, e) {
|
|
167
167
|
return fetch(r, {
|
|
168
168
|
method: "POST",
|
|
169
|
-
body:
|
|
169
|
+
body: cr(e),
|
|
170
170
|
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
171
171
|
}).then(async (t) => {
|
|
172
172
|
if (!t.ok) {
|
|
@@ -176,10 +176,10 @@ async function cr(r, e) {
|
|
|
176
176
|
return t;
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
const gt = "PKCE_code_verifier",
|
|
180
|
-
async function
|
|
181
|
-
const t =
|
|
182
|
-
return sessionStorage.setItem(gt, t),
|
|
179
|
+
const gt = "PKCE_code_verifier", ze = "ROCP_auth_state";
|
|
180
|
+
async function dr(r, e) {
|
|
181
|
+
const t = ir(96);
|
|
182
|
+
return sessionStorage.setItem(gt, t), ar(t).then((s) => {
|
|
183
183
|
const o = new URLSearchParams({
|
|
184
184
|
response_type: "code",
|
|
185
185
|
client_id: r.clientId,
|
|
@@ -188,22 +188,22 @@ async function lr(r, e) {
|
|
|
188
188
|
code_challenge_method: "S256",
|
|
189
189
|
...r.extraAuthParameters
|
|
190
190
|
});
|
|
191
|
-
r.scope !== void 0 && o.append("scope", r.scope), sessionStorage.removeItem(
|
|
191
|
+
r.scope !== void 0 && o.append("scope", r.scope), sessionStorage.removeItem(ze);
|
|
192
192
|
const a = e ?? r.state;
|
|
193
|
-
a && (sessionStorage.setItem(
|
|
193
|
+
a && (sessionStorage.setItem(ze, a), o.append("state", a)), r?.preLogin && r.preLogin(), window.location.replace(`${r.authorizationEndpoint}?${o.toString()}`);
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function ur(r) {
|
|
197
197
|
return r.access_token !== void 0;
|
|
198
198
|
}
|
|
199
199
|
function yt(r, e) {
|
|
200
|
-
return
|
|
201
|
-
if (
|
|
200
|
+
return lr(r, e).then((t) => t.json().then((s) => {
|
|
201
|
+
if (ur(s))
|
|
202
202
|
return s;
|
|
203
203
|
throw Error(s);
|
|
204
204
|
}));
|
|
205
205
|
}
|
|
206
|
-
const
|
|
206
|
+
const hr = (r) => {
|
|
207
207
|
const t = new URLSearchParams(window.location.search).get("code"), s = window.sessionStorage.getItem(gt);
|
|
208
208
|
if (!t)
|
|
209
209
|
throw Error(`Parâmetro 'código' não encontrado na URL.
|
|
@@ -222,7 +222,7 @@ A autenticação ocorreu?`);
|
|
|
222
222
|
...r.extraAuthParams
|
|
223
223
|
};
|
|
224
224
|
return yt(r.tokenEndpoint, o);
|
|
225
|
-
},
|
|
225
|
+
}, pr = (r) => {
|
|
226
226
|
const { config: e, refreshToken: t } = r, s = {
|
|
227
227
|
grant_type: "refresh_token",
|
|
228
228
|
refresh_token: t,
|
|
@@ -233,7 +233,7 @@ A autenticação ocorreu?`);
|
|
|
233
233
|
};
|
|
234
234
|
return yt(e.tokenEndpoint, s);
|
|
235
235
|
};
|
|
236
|
-
function
|
|
236
|
+
function fr(r, e, t, s, o, a) {
|
|
237
237
|
const c = new URLSearchParams({
|
|
238
238
|
token: t || e,
|
|
239
239
|
token_type_hint: t ? "refresh_token" : "access_token",
|
|
@@ -244,8 +244,8 @@ function pr(r, e, t, s, o, a) {
|
|
|
244
244
|
});
|
|
245
245
|
s && c.append("id_token_hint", s), o && c.append("state", o), a && c.append("logout_hint", a), window.location.replace(`${r.logoutEndpoint}?${c.toString()}`);
|
|
246
246
|
}
|
|
247
|
-
function
|
|
248
|
-
const e = r.get("state"), t = sessionStorage.getItem(
|
|
247
|
+
function mr(r) {
|
|
248
|
+
const e = r.get("state"), t = sessionStorage.getItem(ze);
|
|
249
249
|
if (e !== t)
|
|
250
250
|
throw new Error(
|
|
251
251
|
'"state" valor recebido do servidor de autenticação não corresponde à solicitação do cliente. Possível falsificação de solicitação entre sites'
|
|
@@ -275,7 +275,7 @@ Error: ${d.message}`
|
|
|
275
275
|
console.log(`Falha ao armazenar valor '${i}' para chave '${r}'`);
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
|
-
return
|
|
278
|
+
return X(() => {
|
|
279
279
|
const i = (d) => {
|
|
280
280
|
d.storageArea === s && d.key === r && a(JSON.parse(d.newValue ?? ""));
|
|
281
281
|
};
|
|
@@ -289,7 +289,7 @@ const Wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
289
289
|
function Pe(r) {
|
|
290
290
|
return ["", void 0, null].includes(r);
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function gr(r) {
|
|
293
293
|
const {
|
|
294
294
|
autoLogin: e = !0,
|
|
295
295
|
clearURL: t = !0,
|
|
@@ -310,9 +310,9 @@ function mr(r) {
|
|
|
310
310
|
onRefreshTokenExpire: i,
|
|
311
311
|
storage: d
|
|
312
312
|
};
|
|
313
|
-
return
|
|
313
|
+
return yr(y), y;
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function yr(r) {
|
|
316
316
|
if (Pe(r?.clientId))
|
|
317
317
|
throw Error(
|
|
318
318
|
"'clientId' deve ser definido no objeto 'ArchbaseAuthConfig' passado para ArchbaseAuthProvider"
|
|
@@ -341,14 +341,14 @@ const fe = 600, pe = (r) => Math.round(Date.now() / 1e3 + r);
|
|
|
341
341
|
function nt(r) {
|
|
342
342
|
return Math.round(Date.now()) / 1e3 + 30 >= r;
|
|
343
343
|
}
|
|
344
|
-
const
|
|
344
|
+
const vr = [
|
|
345
345
|
"refresh_expires_in",
|
|
346
346
|
// KeyCloak
|
|
347
347
|
"refresh_token_expires_in"
|
|
348
348
|
// Azure AD
|
|
349
349
|
];
|
|
350
350
|
function wr(r, e) {
|
|
351
|
-
for (const t of
|
|
351
|
+
for (const t of vr)
|
|
352
352
|
if (t in e)
|
|
353
353
|
return e[t];
|
|
354
354
|
return e.refresh_token ? r + fe : r;
|
|
@@ -368,14 +368,14 @@ const Te = (r) => {
|
|
|
368
368
|
Você pode desativar a decodificação JWT definindo o valor 'decodeToken' como 'falso' na configuração.`
|
|
369
369
|
);
|
|
370
370
|
}
|
|
371
|
-
},
|
|
371
|
+
}, br = Ve({
|
|
372
372
|
token: "",
|
|
373
373
|
login: () => null,
|
|
374
374
|
logOut: () => null,
|
|
375
375
|
error: null,
|
|
376
376
|
loginInProgress: !1
|
|
377
|
-
}),
|
|
378
|
-
const t = at(() =>
|
|
377
|
+
}), Gr = ({ authConfig: r, children: e }) => {
|
|
378
|
+
const t = at(() => gr(r), [r]), [s, o] = de(
|
|
379
379
|
"ROCP_refreshToken",
|
|
380
380
|
void 0,
|
|
381
381
|
t.storage
|
|
@@ -391,46 +391,46 @@ const Te = (r) => {
|
|
|
391
391
|
"ROCP_idToken",
|
|
392
392
|
void 0,
|
|
393
393
|
t.storage
|
|
394
|
-
), [A,
|
|
394
|
+
), [A, w] = de(
|
|
395
395
|
"ROCP_loginInProgress",
|
|
396
396
|
!1,
|
|
397
397
|
t.storage
|
|
398
|
-
), [E,
|
|
398
|
+
), [E, P] = de(
|
|
399
399
|
"ROCP_refreshInProgress",
|
|
400
400
|
!1,
|
|
401
401
|
t.storage
|
|
402
|
-
), [M,
|
|
402
|
+
), [M, O] = p(), [V, _] = p(), [b, m] = p(null);
|
|
403
403
|
let R;
|
|
404
|
-
function
|
|
405
|
-
o(void 0), d(""), S(pe(fe)), c(pe(fe)), U(void 0),
|
|
404
|
+
function H() {
|
|
405
|
+
o(void 0), d(""), S(pe(fe)), c(pe(fe)), U(void 0), O(void 0), _(void 0), w(!1);
|
|
406
406
|
}
|
|
407
|
-
function
|
|
408
|
-
|
|
407
|
+
function L(g, v) {
|
|
408
|
+
H(), m(null), t?.logoutEndpoint && fr(t, i, s, h, g, v);
|
|
409
409
|
}
|
|
410
410
|
function N(g) {
|
|
411
|
-
|
|
412
|
-
let
|
|
411
|
+
H(), w(!0);
|
|
412
|
+
let v = g;
|
|
413
413
|
g && typeof g != "string" && (console.warn(
|
|
414
414
|
`O estado de login aprovado deve ser do tipo 'string'. Recebido'${g}'. Ignorando o valor...`
|
|
415
|
-
),
|
|
416
|
-
console.error(
|
|
415
|
+
), v = void 0), dr(t, v).catch((K) => {
|
|
416
|
+
console.error(K), m(K.message), w(!1);
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
|
-
function
|
|
419
|
+
function T(g) {
|
|
420
420
|
d(g.access_token), o(g.refresh_token);
|
|
421
|
-
const
|
|
422
|
-
S(pe(
|
|
423
|
-
const
|
|
424
|
-
c(pe(
|
|
421
|
+
const v = t.tokenExpiresIn ?? g.expires_in ?? fe;
|
|
422
|
+
S(pe(v));
|
|
423
|
+
const K = t.refreshTokenExpiresIn ?? wr(v, g);
|
|
424
|
+
c(pe(K)), U(g.id_token);
|
|
425
425
|
try {
|
|
426
426
|
g.id_token && _(Te(g.id_token));
|
|
427
|
-
} catch (
|
|
428
|
-
console.warn(`Falha ao decodificar idToken: ${
|
|
427
|
+
} catch (W) {
|
|
428
|
+
console.warn(`Falha ao decodificar idToken: ${W.message}`);
|
|
429
429
|
}
|
|
430
430
|
try {
|
|
431
|
-
t.decodeToken &&
|
|
432
|
-
} catch (
|
|
433
|
-
console.warn(`Falha ao decodificar o token de acesso: ${
|
|
431
|
+
t.decodeToken && O(Te(g.access_token));
|
|
432
|
+
} catch (W) {
|
|
433
|
+
console.warn(`Falha ao decodificar o token de acesso: ${W.message}`);
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
436
|
function ee(g = !1) {
|
|
@@ -441,15 +441,15 @@ const Te = (r) => {
|
|
|
441
441
|
if (nt(a))
|
|
442
442
|
return ee(g);
|
|
443
443
|
if (s) {
|
|
444
|
-
|
|
445
|
-
if (
|
|
446
|
-
if (
|
|
444
|
+
P(!0), pr({ config: t, refreshToken: s }).then((v) => T(v)).catch((v) => {
|
|
445
|
+
if (v instanceof mt) {
|
|
446
|
+
if (v.status === 400)
|
|
447
447
|
return ee(g);
|
|
448
|
-
console.error(
|
|
448
|
+
console.error(v), m(v.message), g && N();
|
|
449
449
|
} else
|
|
450
|
-
|
|
450
|
+
v instanceof Error && (console.error(v), m(v.message), g && N());
|
|
451
451
|
}).finally(() => {
|
|
452
|
-
|
|
452
|
+
P(!1);
|
|
453
453
|
});
|
|
454
454
|
return;
|
|
455
455
|
}
|
|
@@ -458,29 +458,29 @@ const Te = (r) => {
|
|
|
458
458
|
);
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
|
|
461
|
+
X(() => (R = setInterval(() => te(), 1e4), () => clearInterval(R)), [i, s, a, y]);
|
|
462
462
|
const se = ct(!1);
|
|
463
|
-
return
|
|
463
|
+
return X(() => {
|
|
464
464
|
if (A) {
|
|
465
465
|
const g = new URLSearchParams(window.location.search);
|
|
466
466
|
if (!g.get("code")) {
|
|
467
|
-
const
|
|
468
|
-
console.error(
|
|
467
|
+
const v = g.get("error_description") || "Estado de autorização inválido. Atualizar a página pode resolver o problema.";
|
|
468
|
+
console.error(v), m(v), L();
|
|
469
469
|
return;
|
|
470
470
|
}
|
|
471
471
|
if (!se.current) {
|
|
472
472
|
se.current = !0;
|
|
473
473
|
try {
|
|
474
|
-
|
|
475
|
-
} catch (
|
|
476
|
-
console.error(
|
|
474
|
+
mr(g);
|
|
475
|
+
} catch (v) {
|
|
476
|
+
console.error(v), m(v.message);
|
|
477
477
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}).catch((
|
|
481
|
-
console.error(
|
|
478
|
+
hr(t).then((v) => {
|
|
479
|
+
T(v), t?.postLogin && t.postLogin();
|
|
480
|
+
}).catch((v) => {
|
|
481
|
+
console.error(v), m(v.message);
|
|
482
482
|
}).finally(() => {
|
|
483
|
-
t.clearURL && window.history.replaceState(null, "", window.location.pathname),
|
|
483
|
+
t.clearURL && window.history.replaceState(null, "", window.location.pathname), w(!1);
|
|
484
484
|
});
|
|
485
485
|
}
|
|
486
486
|
return;
|
|
@@ -493,20 +493,20 @@ const Te = (r) => {
|
|
|
493
493
|
console.warn(`Falha ao decodificar idToken: ${g.message}`);
|
|
494
494
|
}
|
|
495
495
|
try {
|
|
496
|
-
t.decodeToken &&
|
|
496
|
+
t.decodeToken && O(Te(i));
|
|
497
497
|
} catch (g) {
|
|
498
498
|
console.warn(`Falha ao decodificar o token de acesso: ${g.message}`);
|
|
499
499
|
}
|
|
500
500
|
te(!0);
|
|
501
501
|
}, []), /* @__PURE__ */ n(
|
|
502
|
-
|
|
502
|
+
br.Provider,
|
|
503
503
|
{
|
|
504
|
-
value: { token: i, tokenData: M, idToken: h, idTokenData: V, login: N, logOut:
|
|
504
|
+
value: { token: i, tokenData: M, idToken: h, idTokenData: V, login: N, logOut: L, error: b, loginInProgress: A },
|
|
505
505
|
children: e
|
|
506
506
|
}
|
|
507
507
|
);
|
|
508
508
|
};
|
|
509
|
-
class
|
|
509
|
+
class vt {
|
|
510
510
|
resourceService;
|
|
511
511
|
resource;
|
|
512
512
|
actions;
|
|
@@ -515,7 +515,7 @@ class wt {
|
|
|
515
515
|
error;
|
|
516
516
|
isAdmin;
|
|
517
517
|
constructor(e, t, s) {
|
|
518
|
-
this.resourceService = zt.getContainer().get(
|
|
518
|
+
this.resourceService = zt.getContainer().get(Y.Resource), this.resource = { resourceName: e, resourceDescription: t }, this.alreadyApplied = !1, this.actions = [], this.permissions = [], this.error = "", this.isAdmin = s;
|
|
519
519
|
}
|
|
520
520
|
registerAction(e, t) {
|
|
521
521
|
!this.alreadyApplied && this.actions.findIndex((s) => s.actionName === e) < 0 && this.actions.push({ actionName: e, actionDescription: t });
|
|
@@ -586,7 +586,7 @@ class wt {
|
|
|
586
586
|
return [...this.actions];
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
|
-
class
|
|
589
|
+
class J {
|
|
590
590
|
static instance;
|
|
591
591
|
_currentTenant = new Ze(null);
|
|
592
592
|
_availableTenants = new Ze([]);
|
|
@@ -600,7 +600,7 @@ class q {
|
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
602
|
static getInstance() {
|
|
603
|
-
return
|
|
603
|
+
return J.instance || (J.instance = new J()), J.instance;
|
|
604
604
|
}
|
|
605
605
|
get currentTenant$() {
|
|
606
606
|
return this._currentTenant.asObservable();
|
|
@@ -629,15 +629,15 @@ class q {
|
|
|
629
629
|
return t && (e["X-TENANT-ID"] = t.id), e;
|
|
630
630
|
}
|
|
631
631
|
}
|
|
632
|
-
function
|
|
633
|
-
return
|
|
632
|
+
function Jr() {
|
|
633
|
+
return J.getInstance();
|
|
634
634
|
}
|
|
635
|
-
var me = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(me || {}),
|
|
635
|
+
var me = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(me || {}), Ar = Object.defineProperty, k = (r, e, t, s) => {
|
|
636
636
|
for (var o = void 0, a = r.length - 1, c; a >= 0; a--)
|
|
637
637
|
(c = r[a]) && (o = c(e, t, o) || o);
|
|
638
|
-
return o &&
|
|
639
|
-
},
|
|
640
|
-
const
|
|
638
|
+
return o && Ar(e, t, o), o;
|
|
639
|
+
}, Er = /* @__PURE__ */ ((r) => (r.VIEW = "VIEW", r.API = "API", r))(Er || {});
|
|
640
|
+
const wt = class bt {
|
|
641
641
|
id;
|
|
642
642
|
code;
|
|
643
643
|
version;
|
|
@@ -648,7 +648,7 @@ const vt = class bt {
|
|
|
648
648
|
description;
|
|
649
649
|
intervals;
|
|
650
650
|
constructor(e) {
|
|
651
|
-
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.description = e.description || "", this.intervals = e.intervals ? e.intervals.map((t) => new
|
|
651
|
+
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.description = e.description || "", this.intervals = e.intervals ? e.intervals.map((t) => new xr(t)) : [];
|
|
652
652
|
}
|
|
653
653
|
static newInstance = () => new bt({
|
|
654
654
|
id: Z(),
|
|
@@ -659,8 +659,8 @@ k([
|
|
|
659
659
|
Q({
|
|
660
660
|
message: "archbase:Informe a descrição do cronograma de acesso"
|
|
661
661
|
})
|
|
662
|
-
],
|
|
663
|
-
let At =
|
|
662
|
+
], wt.prototype, "description");
|
|
663
|
+
let At = wt;
|
|
664
664
|
const _e = class Et {
|
|
665
665
|
id;
|
|
666
666
|
code;
|
|
@@ -696,7 +696,7 @@ k([
|
|
|
696
696
|
message: "archbase:Informe a hora de término"
|
|
697
697
|
})
|
|
698
698
|
], _e.prototype, "endTime");
|
|
699
|
-
let
|
|
699
|
+
let xr = _e;
|
|
700
700
|
class ye {
|
|
701
701
|
id;
|
|
702
702
|
code;
|
|
@@ -725,7 +725,7 @@ k([
|
|
|
725
725
|
k([
|
|
726
726
|
ae()
|
|
727
727
|
], ye.prototype, "actions");
|
|
728
|
-
const
|
|
728
|
+
const ve = class xt {
|
|
729
729
|
id;
|
|
730
730
|
code;
|
|
731
731
|
version;
|
|
@@ -753,24 +753,24 @@ k([
|
|
|
753
753
|
Q({
|
|
754
754
|
message: "archbase:Informe o nome para a ação"
|
|
755
755
|
})
|
|
756
|
-
],
|
|
756
|
+
], ve.prototype, "name");
|
|
757
757
|
k([
|
|
758
758
|
Q({
|
|
759
759
|
message: "archbase:Informe a descrição para a ação"
|
|
760
760
|
})
|
|
761
|
-
],
|
|
761
|
+
], ve.prototype, "description");
|
|
762
762
|
k([
|
|
763
763
|
ae()
|
|
764
|
-
],
|
|
764
|
+
], ve.prototype, "resource");
|
|
765
765
|
k([
|
|
766
766
|
Q({
|
|
767
767
|
message: "archbase:Informe a categoria para a ação"
|
|
768
768
|
})
|
|
769
|
-
],
|
|
769
|
+
], ve.prototype, "category");
|
|
770
770
|
k([
|
|
771
771
|
re()
|
|
772
|
-
],
|
|
773
|
-
let
|
|
772
|
+
], ve.prototype, "active");
|
|
773
|
+
let kr = ve;
|
|
774
774
|
class ke extends ye {
|
|
775
775
|
type;
|
|
776
776
|
isNewProfile;
|
|
@@ -925,7 +925,7 @@ k([
|
|
|
925
925
|
ae()
|
|
926
926
|
], F.prototype, "profile");
|
|
927
927
|
k([
|
|
928
|
-
|
|
928
|
+
Ft(
|
|
929
929
|
{},
|
|
930
930
|
{
|
|
931
931
|
message: "archbase:Informe um email válido"
|
|
@@ -947,7 +947,7 @@ const Je = class Fe {
|
|
|
947
947
|
companyId;
|
|
948
948
|
projectId;
|
|
949
949
|
constructor(e) {
|
|
950
|
-
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.security = e.security ? Fe.createDtoFromJson(e.security) : void 0, this.action = e.action ? new
|
|
950
|
+
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.security = e.security ? Fe.createDtoFromJson(e.security) : void 0, this.action = e.action ? new kr(e.action) : void 0, this.tenantId = e.tenantId || "", this.companyId = e.companyId || "", this.projectId = e.projectId || "";
|
|
951
951
|
}
|
|
952
952
|
static createDtoFromJson(e) {
|
|
953
953
|
switch (e.type) {
|
|
@@ -974,7 +974,7 @@ k([
|
|
|
974
974
|
k([
|
|
975
975
|
ae()
|
|
976
976
|
], Je.prototype, "action");
|
|
977
|
-
let
|
|
977
|
+
let Kr = Je;
|
|
978
978
|
class Ke {
|
|
979
979
|
id;
|
|
980
980
|
code;
|
|
@@ -1029,7 +1029,7 @@ class It extends ge {
|
|
|
1029
1029
|
super(e);
|
|
1030
1030
|
}
|
|
1031
1031
|
configureHeaders() {
|
|
1032
|
-
return
|
|
1032
|
+
return J.getInstance().getHeaders();
|
|
1033
1033
|
}
|
|
1034
1034
|
transform(e) {
|
|
1035
1035
|
return new Me(e);
|
|
@@ -1051,14 +1051,14 @@ class It extends ge {
|
|
|
1051
1051
|
return this.transform(t);
|
|
1052
1052
|
}
|
|
1053
1053
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1054
|
+
C.decorate(C.inject(Y.ApiClient), It, 0);
|
|
1055
|
+
C.decorate(C.injectable(), It);
|
|
1056
1056
|
class Pt extends ge {
|
|
1057
1057
|
constructor(e) {
|
|
1058
1058
|
super(e);
|
|
1059
1059
|
}
|
|
1060
1060
|
configureHeaders() {
|
|
1061
|
-
return
|
|
1061
|
+
return J.getInstance().getHeaders();
|
|
1062
1062
|
}
|
|
1063
1063
|
transform(e) {
|
|
1064
1064
|
return new Se(e);
|
|
@@ -1073,14 +1073,14 @@ class Pt extends ge {
|
|
|
1073
1073
|
return e.isNewGroup;
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1076
|
+
C.decorate(C.inject(Y.ApiClient), Pt, 0);
|
|
1077
|
+
C.decorate(C.injectable(), Pt);
|
|
1078
1078
|
class Tt extends ge {
|
|
1079
1079
|
constructor(e) {
|
|
1080
1080
|
super(e);
|
|
1081
1081
|
}
|
|
1082
1082
|
configureHeaders() {
|
|
1083
|
-
return
|
|
1083
|
+
return J.getInstance().getHeaders();
|
|
1084
1084
|
}
|
|
1085
1085
|
transform(e) {
|
|
1086
1086
|
return new ke(e);
|
|
@@ -1095,14 +1095,14 @@ class Tt extends ge {
|
|
|
1095
1095
|
return e.isNewProfile;
|
|
1096
1096
|
}
|
|
1097
1097
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1098
|
+
C.decorate(C.inject(Y.ApiClient), Tt, 0);
|
|
1099
|
+
C.decorate(C.injectable(), Tt);
|
|
1100
1100
|
class Ut extends ge {
|
|
1101
1101
|
constructor(e) {
|
|
1102
1102
|
super(e);
|
|
1103
1103
|
}
|
|
1104
1104
|
configureHeaders() {
|
|
1105
|
-
return
|
|
1105
|
+
return J.getInstance().getHeaders();
|
|
1106
1106
|
}
|
|
1107
1107
|
transform(e) {
|
|
1108
1108
|
return new Ke(e);
|
|
@@ -1132,14 +1132,14 @@ class Ut extends ge {
|
|
|
1132
1132
|
);
|
|
1133
1133
|
}
|
|
1134
1134
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1135
|
+
C.decorate(C.inject(Y.ApiClient), Ut, 0);
|
|
1136
|
+
C.decorate(C.injectable(), Ut);
|
|
1137
1137
|
class Dt extends ge {
|
|
1138
1138
|
constructor(e) {
|
|
1139
1139
|
super(e);
|
|
1140
1140
|
}
|
|
1141
1141
|
configureHeaders() {
|
|
1142
|
-
return
|
|
1142
|
+
return J.getInstance().getHeaders();
|
|
1143
1143
|
}
|
|
1144
1144
|
transform(e) {
|
|
1145
1145
|
return new qe(e);
|
|
@@ -1161,14 +1161,14 @@ class Dt extends ge {
|
|
|
1161
1161
|
);
|
|
1162
1162
|
}
|
|
1163
1163
|
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1164
|
+
C.decorate(C.inject(Y.ApiClient), Dt, 0);
|
|
1165
|
+
C.decorate(C.injectable(), Dt);
|
|
1166
1166
|
class _t extends ge {
|
|
1167
1167
|
constructor(e) {
|
|
1168
1168
|
super(e);
|
|
1169
1169
|
}
|
|
1170
1170
|
configureHeaders() {
|
|
1171
|
-
return
|
|
1171
|
+
return J.getInstance().getHeaders();
|
|
1172
1172
|
}
|
|
1173
1173
|
transform(e) {
|
|
1174
1174
|
return new St(e);
|
|
@@ -1225,9 +1225,54 @@ class _t extends ge {
|
|
|
1225
1225
|
);
|
|
1226
1226
|
}
|
|
1227
1227
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1228
|
+
C.decorate(C.inject(Y.ApiClient), _t, 0);
|
|
1229
|
+
C.decorate(C.injectable(), _t);
|
|
1230
|
+
class Rt {
|
|
1231
|
+
client;
|
|
1232
|
+
constructor(e) {
|
|
1233
|
+
this.client = e;
|
|
1234
|
+
}
|
|
1235
|
+
configureHeaders() {
|
|
1236
|
+
return J.getInstance().getHeaders();
|
|
1237
|
+
}
|
|
1238
|
+
getEndpoint() {
|
|
1239
|
+
return "/api/v1/security/diagnostics";
|
|
1240
|
+
}
|
|
1241
|
+
/** Retrato do tenant: contagens do catálogo e o estado das proteções configuráveis. */
|
|
1242
|
+
async getOverview() {
|
|
1243
|
+
return this.client.get(`${this.getEndpoint()}/overview`, this.configureHeaders());
|
|
1244
|
+
}
|
|
1245
|
+
/** O que a pessoa pode, com a origem de cada concessão. */
|
|
1246
|
+
async getEffectiveAccessByUserId(e) {
|
|
1247
|
+
return this.client.get(
|
|
1248
|
+
`${this.getEndpoint()}/users/${encodeURIComponent(e)}/effective`,
|
|
1249
|
+
this.configureHeaders()
|
|
1250
|
+
);
|
|
1251
|
+
}
|
|
1252
|
+
/** Idem, buscando a pessoa pelo e-mail. */
|
|
1253
|
+
async getEffectiveAccessByEmail(e) {
|
|
1254
|
+
return this.client.get(
|
|
1255
|
+
`${this.getEndpoint()}/effective?email=${encodeURIComponent(e)}`,
|
|
1256
|
+
this.configureHeaders()
|
|
1257
|
+
);
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* "Esta pessoa consegue fazer isto?"
|
|
1261
|
+
*
|
|
1262
|
+
* <p>A resposta traz a cadeia dos portões avaliados — é ela, e não o booleano, que diz o
|
|
1263
|
+
* que precisa mudar para o acesso passar a existir.
|
|
1264
|
+
*/
|
|
1265
|
+
async simulate(e) {
|
|
1266
|
+
return this.client.post(
|
|
1267
|
+
`${this.getEndpoint()}/simulate`,
|
|
1268
|
+
e,
|
|
1269
|
+
this.configureHeaders()
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
C.decorate(C.inject(Y.ApiClient), Rt, 0);
|
|
1274
|
+
C.decorate(C.injectable(), Rt);
|
|
1275
|
+
function qr({
|
|
1231
1276
|
onLogin: r,
|
|
1232
1277
|
error: e,
|
|
1233
1278
|
onClickForgotPassword: t,
|
|
@@ -1242,29 +1287,29 @@ function Kr({
|
|
|
1242
1287
|
disabledLogin: h = !1,
|
|
1243
1288
|
isCheckingUsername: U = !1,
|
|
1244
1289
|
showSignIn: A = !0,
|
|
1245
|
-
mfaRequired:
|
|
1290
|
+
mfaRequired: w = !1,
|
|
1246
1291
|
onVerifyMfa: E,
|
|
1247
|
-
mfaError:
|
|
1292
|
+
mfaError: P,
|
|
1248
1293
|
onCancelMfa: M,
|
|
1249
|
-
isVerifyingMfa:
|
|
1294
|
+
isVerifyingMfa: O = !1
|
|
1250
1295
|
}) {
|
|
1251
1296
|
const V = ut(), {
|
|
1252
1297
|
username: _,
|
|
1253
1298
|
password: b,
|
|
1254
1299
|
rememberMe: m,
|
|
1255
1300
|
clearRememberMe: R
|
|
1256
|
-
} =
|
|
1257
|
-
|
|
1301
|
+
} = Vt(), [H, L] = p(_), [N, T] = p(b), [ee, te] = p(m), [se, g] = p(!1), [v, K] = p(null), [W, we] = p("");
|
|
1302
|
+
X(() => {
|
|
1258
1303
|
g(!!e);
|
|
1259
|
-
}, [e]),
|
|
1260
|
-
_ !==
|
|
1304
|
+
}, [e]), X(() => {
|
|
1305
|
+
_ !== H && (L(_), S?.(_)), b !== N && T(b), m !== ee && te(m);
|
|
1261
1306
|
}, [_, b, m]);
|
|
1262
1307
|
const he = () => {
|
|
1263
1308
|
g(!1);
|
|
1264
1309
|
}, B = () => {
|
|
1265
|
-
|
|
1310
|
+
H && N && r(H, N, ee).finally(() => g(!0));
|
|
1266
1311
|
}, ce = () => {
|
|
1267
|
-
const l =
|
|
1312
|
+
const l = W.trim();
|
|
1268
1313
|
l && E && E(l);
|
|
1269
1314
|
}, oe = () => {
|
|
1270
1315
|
if (!d)
|
|
@@ -1273,8 +1318,8 @@ function Kr({
|
|
|
1273
1318
|
label: f.email
|
|
1274
1319
|
}));
|
|
1275
1320
|
const l = i.reduce((f, D) => {
|
|
1276
|
-
const
|
|
1277
|
-
return
|
|
1321
|
+
const j = d[D.type];
|
|
1322
|
+
return j && (f[j] || (f[j] = []), f[j].push({
|
|
1278
1323
|
value: D.email,
|
|
1279
1324
|
label: D.email
|
|
1280
1325
|
})), f;
|
|
@@ -1284,9 +1329,9 @@ function Kr({
|
|
|
1284
1329
|
items: D
|
|
1285
1330
|
}));
|
|
1286
1331
|
}, be = () => {
|
|
1287
|
-
if (
|
|
1288
|
-
const l = i.find((f) => f.email ===
|
|
1289
|
-
l && (
|
|
1332
|
+
if (v) {
|
|
1333
|
+
const l = i.find((f) => f.email === v);
|
|
1334
|
+
l && (L(l.email), T(l.password), he());
|
|
1290
1335
|
}
|
|
1291
1336
|
}, u = {
|
|
1292
1337
|
withBorder: !0,
|
|
@@ -1297,16 +1342,16 @@ function Kr({
|
|
|
1297
1342
|
w: 400,
|
|
1298
1343
|
...y.cardProps
|
|
1299
1344
|
};
|
|
1300
|
-
return /* @__PURE__ */
|
|
1301
|
-
|
|
1345
|
+
return /* @__PURE__ */ I(
|
|
1346
|
+
We,
|
|
1302
1347
|
{
|
|
1303
1348
|
...u,
|
|
1304
1349
|
pos: "relative",
|
|
1305
1350
|
ref: V,
|
|
1306
1351
|
children: [
|
|
1307
|
-
A && /* @__PURE__ */
|
|
1352
|
+
A && /* @__PURE__ */ I(ie, { children: [
|
|
1308
1353
|
/* @__PURE__ */ n(
|
|
1309
|
-
|
|
1354
|
+
z,
|
|
1310
1355
|
{
|
|
1311
1356
|
c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
|
|
1312
1357
|
fw: 800,
|
|
@@ -1319,10 +1364,10 @@ function Kr({
|
|
|
1319
1364
|
/* @__PURE__ */ n(Ue, { m: "md" })
|
|
1320
1365
|
] }),
|
|
1321
1366
|
y?.customContentBefore,
|
|
1322
|
-
|
|
1323
|
-
/* @__PURE__ */
|
|
1324
|
-
/* @__PURE__ */ n(
|
|
1325
|
-
/* @__PURE__ */ n(
|
|
1367
|
+
w && /* @__PURE__ */ I(Ee, { gap: "md", children: [
|
|
1368
|
+
/* @__PURE__ */ I("div", { children: [
|
|
1369
|
+
/* @__PURE__ */ n(z, { fw: 700, fz: "lg", children: x().t("archbase:mfa.title", "Verificação em duas etapas") }),
|
|
1370
|
+
/* @__PURE__ */ n(z, { c: "dimmed", fz: "sm", children: x().t(
|
|
1326
1371
|
"archbase:mfa.subtitle",
|
|
1327
1372
|
"Digite o código do seu aplicativo autenticador (ou um código de recuperação)."
|
|
1328
1373
|
) })
|
|
@@ -1332,21 +1377,21 @@ function Kr({
|
|
|
1332
1377
|
{
|
|
1333
1378
|
label: x().t("archbase:mfa.code", "Código de verificação"),
|
|
1334
1379
|
placeholder: "000000",
|
|
1335
|
-
value:
|
|
1380
|
+
value: W,
|
|
1336
1381
|
autoFocus: !0,
|
|
1337
|
-
onChange: (l) =>
|
|
1382
|
+
onChange: (l) => we(l.currentTarget.value),
|
|
1338
1383
|
onKeyDown: (l) => {
|
|
1339
1384
|
l.key === "Enter" && ce();
|
|
1340
1385
|
}
|
|
1341
1386
|
}
|
|
1342
1387
|
),
|
|
1343
|
-
|
|
1388
|
+
P && /* @__PURE__ */ n(z, { c: "red", fz: "sm", children: P }),
|
|
1344
1389
|
/* @__PURE__ */ n(
|
|
1345
1390
|
G,
|
|
1346
1391
|
{
|
|
1347
1392
|
fullWidth: !0,
|
|
1348
|
-
disabled: !
|
|
1349
|
-
loading:
|
|
1393
|
+
disabled: !W.trim() || O,
|
|
1394
|
+
loading: O,
|
|
1350
1395
|
onClick: ce,
|
|
1351
1396
|
children: x().t("archbase:mfa.verify", "Verificar")
|
|
1352
1397
|
}
|
|
@@ -1364,30 +1409,30 @@ function Kr({
|
|
|
1364
1409
|
}
|
|
1365
1410
|
)
|
|
1366
1411
|
] }),
|
|
1367
|
-
!
|
|
1368
|
-
c && /* @__PURE__ */
|
|
1369
|
-
/* @__PURE__ */
|
|
1412
|
+
!w && /* @__PURE__ */ I(ie, { children: [
|
|
1413
|
+
c && /* @__PURE__ */ I(ie, { children: [
|
|
1414
|
+
/* @__PURE__ */ I(ue, { gap: "sm", mb: "md", children: [
|
|
1370
1415
|
/* @__PURE__ */ n(
|
|
1371
|
-
|
|
1416
|
+
Yt,
|
|
1372
1417
|
{
|
|
1373
1418
|
placeholder: "Selecione um usuário mock",
|
|
1374
1419
|
data: oe(),
|
|
1375
|
-
value:
|
|
1376
|
-
onChange: (l) =>
|
|
1420
|
+
value: v,
|
|
1421
|
+
onChange: (l) => K(l ?? ""),
|
|
1377
1422
|
searchable: !0,
|
|
1378
1423
|
clearable: !0,
|
|
1379
1424
|
style: { flexGrow: 1 }
|
|
1380
1425
|
}
|
|
1381
1426
|
),
|
|
1382
|
-
/* @__PURE__ */ n(
|
|
1427
|
+
/* @__PURE__ */ n(Xt, { label: "Aplicar", children: /* @__PURE__ */ n(
|
|
1383
1428
|
G,
|
|
1384
1429
|
{
|
|
1385
1430
|
variant: "light",
|
|
1386
1431
|
size: "sm",
|
|
1387
1432
|
onClick: be,
|
|
1388
|
-
disabled: !
|
|
1433
|
+
disabled: !v,
|
|
1389
1434
|
"aria-label": "Aplicar usuário mock selecionado",
|
|
1390
|
-
children: /* @__PURE__ */ n(
|
|
1435
|
+
children: /* @__PURE__ */ n(rr, { size: 16 })
|
|
1391
1436
|
}
|
|
1392
1437
|
) })
|
|
1393
1438
|
] }),
|
|
@@ -1399,29 +1444,29 @@ function Kr({
|
|
|
1399
1444
|
label: s,
|
|
1400
1445
|
placeholder: o ?? x().t("archbase:usuario@email.com"),
|
|
1401
1446
|
rightSection: U ? /* @__PURE__ */ n(dt, { size: "xs" }) : null,
|
|
1402
|
-
value:
|
|
1447
|
+
value: H || "",
|
|
1403
1448
|
required: !0,
|
|
1404
1449
|
onChange: (l) => {
|
|
1405
|
-
|
|
1450
|
+
L(l.currentTarget.value), S?.(l.currentTarget.value), he();
|
|
1406
1451
|
}
|
|
1407
1452
|
}
|
|
1408
1453
|
),
|
|
1409
1454
|
/* @__PURE__ */ n(
|
|
1410
|
-
|
|
1455
|
+
je,
|
|
1411
1456
|
{
|
|
1412
1457
|
label: x().t("archbase:Password"),
|
|
1413
1458
|
placeholder: x().t("archbase:Sua senha"),
|
|
1414
1459
|
onChange: (l) => {
|
|
1415
|
-
|
|
1460
|
+
T(l.currentTarget.value), he();
|
|
1416
1461
|
},
|
|
1417
1462
|
value: N || "",
|
|
1418
1463
|
required: !0,
|
|
1419
1464
|
mt: "md"
|
|
1420
1465
|
}
|
|
1421
1466
|
),
|
|
1422
|
-
/* @__PURE__ */
|
|
1467
|
+
/* @__PURE__ */ I(ue, { justify: "space-between", mt: "md", children: [
|
|
1423
1468
|
/* @__PURE__ */ n(
|
|
1424
|
-
|
|
1469
|
+
Qt,
|
|
1425
1470
|
{
|
|
1426
1471
|
label: x().t("archbase:Lembre-me"),
|
|
1427
1472
|
checked: ee,
|
|
@@ -1448,7 +1493,7 @@ function Kr({
|
|
|
1448
1493
|
/* @__PURE__ */ n(
|
|
1449
1494
|
G,
|
|
1450
1495
|
{
|
|
1451
|
-
disabled: !N || !
|
|
1496
|
+
disabled: !N || !H || h,
|
|
1452
1497
|
fullWidth: !0,
|
|
1453
1498
|
mt: "xl",
|
|
1454
1499
|
onClick: B,
|
|
@@ -1457,76 +1502,76 @@ function Kr({
|
|
|
1457
1502
|
)
|
|
1458
1503
|
] }),
|
|
1459
1504
|
y?.customContentAfter,
|
|
1460
|
-
se && e && /* @__PURE__ */ n(
|
|
1505
|
+
se && e && /* @__PURE__ */ n(z, { c: "red", mt: "sm", children: e })
|
|
1461
1506
|
]
|
|
1462
1507
|
}
|
|
1463
1508
|
);
|
|
1464
1509
|
}
|
|
1465
1510
|
const $ = (r, e) => x().t(r, e);
|
|
1466
|
-
function
|
|
1511
|
+
function Yr({
|
|
1467
1512
|
enabled: r,
|
|
1468
1513
|
onSetup: e,
|
|
1469
1514
|
onEnable: t,
|
|
1470
1515
|
onDisable: s,
|
|
1471
1516
|
onStatusChange: o
|
|
1472
1517
|
}) {
|
|
1473
|
-
const [a, c] = p("idle"), [i, d] = p(null), [y, S] = p(""), [h, U] = p([]), [A,
|
|
1474
|
-
|
|
1518
|
+
const [a, c] = p("idle"), [i, d] = p(null), [y, S] = p(""), [h, U] = p([]), [A, w] = p(!1), [E, P] = p(null), M = async () => {
|
|
1519
|
+
w(!0), P(null);
|
|
1475
1520
|
try {
|
|
1476
1521
|
const b = await e();
|
|
1477
1522
|
d(b), S(""), c("setup");
|
|
1478
1523
|
} catch (b) {
|
|
1479
|
-
|
|
1524
|
+
P(b?.message || String(b));
|
|
1480
1525
|
} finally {
|
|
1481
|
-
|
|
1526
|
+
w(!1);
|
|
1482
1527
|
}
|
|
1483
|
-
},
|
|
1528
|
+
}, O = async () => {
|
|
1484
1529
|
const b = y.trim();
|
|
1485
1530
|
if (b) {
|
|
1486
|
-
|
|
1531
|
+
w(!0), P(null);
|
|
1487
1532
|
try {
|
|
1488
1533
|
const m = await t(b);
|
|
1489
1534
|
U(m), c("recovery"), o?.(!0);
|
|
1490
1535
|
} catch (m) {
|
|
1491
|
-
|
|
1536
|
+
P(m?.message || String(m));
|
|
1492
1537
|
} finally {
|
|
1493
|
-
|
|
1538
|
+
w(!1);
|
|
1494
1539
|
}
|
|
1495
1540
|
}
|
|
1496
1541
|
}, V = async () => {
|
|
1497
|
-
|
|
1542
|
+
w(!0), P(null);
|
|
1498
1543
|
try {
|
|
1499
1544
|
await s(), d(null), U([]), c("idle"), o?.(!1);
|
|
1500
1545
|
} catch (b) {
|
|
1501
|
-
|
|
1546
|
+
P(b?.message || String(b));
|
|
1502
1547
|
} finally {
|
|
1503
|
-
|
|
1548
|
+
w(!1);
|
|
1504
1549
|
}
|
|
1505
1550
|
}, _ = () => {
|
|
1506
1551
|
U([]), d(null), S(""), c("idle");
|
|
1507
1552
|
};
|
|
1508
|
-
return /* @__PURE__ */ n(
|
|
1509
|
-
/* @__PURE__ */
|
|
1510
|
-
/* @__PURE__ */ n(
|
|
1511
|
-
/* @__PURE__ */ n(
|
|
1553
|
+
return /* @__PURE__ */ n(We, { withBorder: !0, radius: "md", p: "lg", children: /* @__PURE__ */ I(Ee, { gap: "md", children: [
|
|
1554
|
+
/* @__PURE__ */ I("div", { children: [
|
|
1555
|
+
/* @__PURE__ */ n(z, { fw: 700, fz: "lg", children: $("archbase:mfa.setup.title", "Autenticação em duas etapas (MFA)") }),
|
|
1556
|
+
/* @__PURE__ */ n(z, { c: "dimmed", fz: "sm", children: $(
|
|
1512
1557
|
"archbase:mfa.setup.subtitle",
|
|
1513
1558
|
"Proteja o acesso exigindo um código do seu aplicativo autenticador no login."
|
|
1514
1559
|
) })
|
|
1515
1560
|
] }),
|
|
1516
1561
|
E && /* @__PURE__ */ n(tt, { color: "red", children: E }),
|
|
1517
|
-
r && a === "idle" && /* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */ n(
|
|
1562
|
+
r && a === "idle" && /* @__PURE__ */ I(ue, { justify: "space-between", children: [
|
|
1563
|
+
/* @__PURE__ */ n(z, { c: "teal", fw: 600, children: $("archbase:mfa.setup.active", "MFA ativo") }),
|
|
1519
1564
|
/* @__PURE__ */ n(G, { color: "red", variant: "light", loading: A, onClick: V, children: $("archbase:mfa.setup.disable", "Desativar") })
|
|
1520
1565
|
] }),
|
|
1521
1566
|
!r && a === "idle" && /* @__PURE__ */ n(G, { loading: A, onClick: M, children: $("archbase:mfa.setup.enable", "Ativar MFA") }),
|
|
1522
|
-
a === "setup" && i && /* @__PURE__ */
|
|
1523
|
-
/* @__PURE__ */ n(
|
|
1567
|
+
a === "setup" && i && /* @__PURE__ */ I(Ee, { gap: "sm", align: "center", children: [
|
|
1568
|
+
/* @__PURE__ */ n(z, { fz: "sm", ta: "center", children: $(
|
|
1524
1569
|
"archbase:mfa.setup.scan",
|
|
1525
1570
|
"Escaneie o QR Code no seu app autenticador (Google Authenticator, Authy…):"
|
|
1526
1571
|
) }),
|
|
1527
|
-
/* @__PURE__ */ n(
|
|
1528
|
-
/* @__PURE__ */ n(
|
|
1529
|
-
/* @__PURE__ */
|
|
1572
|
+
/* @__PURE__ */ n(sr, { value: i.provisioningUri, size: 180, level: "M" }),
|
|
1573
|
+
/* @__PURE__ */ n(z, { fz: "xs", c: "dimmed", ta: "center", children: $("archbase:mfa.setup.manual", "Ou informe o código manualmente:") }),
|
|
1574
|
+
/* @__PURE__ */ I(ue, { gap: "xs", children: [
|
|
1530
1575
|
/* @__PURE__ */ n(rt, { children: i.secret }),
|
|
1531
1576
|
/* @__PURE__ */ n(st, { value: i.secret, children: ({ copied: b, copy: m }) => /* @__PURE__ */ n(G, { size: "xs", variant: "subtle", onClick: m, children: b ? $("archbase:mfa.setup.copied", "Copiado") : $("archbase:mfa.setup.copy", "Copiar") }) })
|
|
1532
1577
|
] }),
|
|
@@ -1539,22 +1584,22 @@ function qr({
|
|
|
1539
1584
|
value: y,
|
|
1540
1585
|
onChange: (b) => S(b.currentTarget.value),
|
|
1541
1586
|
onKeyDown: (b) => {
|
|
1542
|
-
b.key === "Enter" &&
|
|
1587
|
+
b.key === "Enter" && O();
|
|
1543
1588
|
}
|
|
1544
1589
|
}
|
|
1545
1590
|
),
|
|
1546
|
-
/* @__PURE__ */
|
|
1591
|
+
/* @__PURE__ */ I(ue, { w: "100%", justify: "flex-end", children: [
|
|
1547
1592
|
/* @__PURE__ */ n(G, { variant: "default", onClick: _, disabled: A, children: $("archbase:mfa.setup.cancel", "Cancelar") }),
|
|
1548
|
-
/* @__PURE__ */ n(G, { onClick:
|
|
1593
|
+
/* @__PURE__ */ n(G, { onClick: O, loading: A, disabled: !y.trim(), children: $("archbase:mfa.setup.confirm", "Confirmar e ativar") })
|
|
1549
1594
|
] })
|
|
1550
1595
|
] }),
|
|
1551
|
-
a === "recovery" && /* @__PURE__ */
|
|
1596
|
+
a === "recovery" && /* @__PURE__ */ I(Ee, { gap: "sm", children: [
|
|
1552
1597
|
/* @__PURE__ */ n(tt, { color: "yellow", children: $(
|
|
1553
1598
|
"archbase:mfa.setup.recoveryWarning",
|
|
1554
1599
|
"Guarde estes códigos de recuperação em local seguro. Cada um funciona uma única vez e permite entrar se você perder o acesso ao app autenticador. Eles não serão exibidos novamente."
|
|
1555
1600
|
) }),
|
|
1556
|
-
/* @__PURE__ */ n(
|
|
1557
|
-
/* @__PURE__ */
|
|
1601
|
+
/* @__PURE__ */ n(Zt, { cols: 2, spacing: "xs", children: h.map((b) => /* @__PURE__ */ n(rt, { fz: "sm", children: b }, b)) }),
|
|
1602
|
+
/* @__PURE__ */ I(ue, { justify: "space-between", children: [
|
|
1558
1603
|
/* @__PURE__ */ n(st, { value: h.join(`
|
|
1559
1604
|
`), children: ({ copied: b, copy: m }) => /* @__PURE__ */ n(G, { variant: "subtle", onClick: m, children: b ? $("archbase:mfa.setup.copied", "Copiado") : $("archbase:mfa.setup.copyAll", "Copiar todos") }) }),
|
|
1560
1605
|
/* @__PURE__ */ n(G, { onClick: _, children: $("archbase:mfa.setup.done", "Guardei os códigos") })
|
|
@@ -1562,50 +1607,50 @@ function qr({
|
|
|
1562
1607
|
] })
|
|
1563
1608
|
] }) });
|
|
1564
1609
|
}
|
|
1565
|
-
const
|
|
1610
|
+
const Sr = {
|
|
1566
1611
|
position: "relative",
|
|
1567
1612
|
width: "90%",
|
|
1568
1613
|
maxWidth: 400,
|
|
1569
1614
|
padding: 30,
|
|
1570
1615
|
marginTop: 30
|
|
1571
1616
|
};
|
|
1572
|
-
function
|
|
1573
|
-
const h = ut(), U =
|
|
1574
|
-
async function
|
|
1575
|
-
B && (
|
|
1576
|
-
ot.showSuccess(`${x().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`),
|
|
1617
|
+
function Xr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: o, validateToken: a, initialEmail: c = "", description: i, style: d, passwordPolicy: y, showPasswordRequirements: S = !0 }) {
|
|
1618
|
+
const h = ut(), U = Ht(), { colorScheme: A } = er(), [w, E] = p(r ?? ""), [P, M] = p(c), [O, V] = p(""), [_, b] = p(""), [m, R] = p(""), [H, L] = p(!1), [N, T] = p(""), [ee, te] = p(""), [se, g] = p(""), [v, K] = p(""), W = Wt(y);
|
|
1619
|
+
async function we(B) {
|
|
1620
|
+
B && (Gt(B) ? await e(B).then(() => {
|
|
1621
|
+
ot.showSuccess(`${x().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), L(!0);
|
|
1577
1622
|
}).catch(() => {
|
|
1578
|
-
}) :
|
|
1623
|
+
}) : T(`${x().t("archbase:Email inválido")}`));
|
|
1579
1624
|
}
|
|
1580
1625
|
async function he(B, ce, oe, be) {
|
|
1581
1626
|
if (B && ce && oe) {
|
|
1582
1627
|
let u = "", l = "", f = "";
|
|
1583
|
-
a && (u = a(ce), te(u)),
|
|
1584
|
-
ot.showSuccess(`${x().t("archbase:Senha redefinida com sucesso.")}`), s(),
|
|
1628
|
+
a && (u = a(ce), te(u)), W && (l = Jt(oe, W).error ?? ""), !l && o && (l = o(oe)), g(l), oe !== be && (f = `${x().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, K(f)), !l && !u && !f && await t(B, ce, oe).then(() => {
|
|
1629
|
+
ot.showSuccess(`${x().t("archbase:Senha redefinida com sucesso.")}`), s(), L(!1);
|
|
1585
1630
|
}).catch(() => {
|
|
1586
1631
|
E(r || `${x().t("archbase:Erro ao redefinir senha.")}`);
|
|
1587
1632
|
});
|
|
1588
1633
|
}
|
|
1589
1634
|
}
|
|
1590
|
-
return
|
|
1635
|
+
return X(() => {
|
|
1591
1636
|
r && E(r);
|
|
1592
|
-
}, [r]),
|
|
1637
|
+
}, [r]), X(() => {
|
|
1593
1638
|
E("");
|
|
1594
|
-
}, [
|
|
1595
|
-
|
|
1639
|
+
}, [P, O, _, m]), /* @__PURE__ */ I(
|
|
1640
|
+
We,
|
|
1596
1641
|
{
|
|
1597
1642
|
withBorder: !0,
|
|
1598
1643
|
shadow: "md",
|
|
1599
1644
|
radius: "md",
|
|
1600
1645
|
ref: h,
|
|
1601
1646
|
style: {
|
|
1602
|
-
...
|
|
1647
|
+
...Sr,
|
|
1603
1648
|
...d
|
|
1604
1649
|
},
|
|
1605
1650
|
children: [
|
|
1606
|
-
|
|
1651
|
+
H ? /* @__PURE__ */ I(ie, { children: [
|
|
1607
1652
|
/* @__PURE__ */ n(
|
|
1608
|
-
|
|
1653
|
+
z,
|
|
1609
1654
|
{
|
|
1610
1655
|
c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
|
|
1611
1656
|
fw: 800,
|
|
@@ -1621,7 +1666,7 @@ function Yr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1621
1666
|
{
|
|
1622
1667
|
label: x().t("archbase:Código de segurança"),
|
|
1623
1668
|
placeholder: `${x().t("archbase:Código enviado no seu e-mail")}`,
|
|
1624
|
-
value:
|
|
1669
|
+
value: O || "",
|
|
1625
1670
|
required: !0,
|
|
1626
1671
|
onChange: (B) => {
|
|
1627
1672
|
V(B.currentTarget.value), te("");
|
|
@@ -1630,46 +1675,46 @@ function Yr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1630
1675
|
}
|
|
1631
1676
|
),
|
|
1632
1677
|
/* @__PURE__ */ n(
|
|
1633
|
-
|
|
1678
|
+
je,
|
|
1634
1679
|
{
|
|
1635
1680
|
label: x().t("archbase:Nova senha"),
|
|
1636
1681
|
placeholder: x().t("archbase:Nova senha"),
|
|
1637
1682
|
onChange: (B) => {
|
|
1638
|
-
b(B.currentTarget.value), g(""),
|
|
1683
|
+
b(B.currentTarget.value), g(""), K("");
|
|
1639
1684
|
},
|
|
1640
1685
|
value: _,
|
|
1641
1686
|
required: !0,
|
|
1642
1687
|
error: se
|
|
1643
1688
|
}
|
|
1644
1689
|
),
|
|
1645
|
-
|
|
1646
|
-
|
|
1690
|
+
W && /* @__PURE__ */ n(
|
|
1691
|
+
or,
|
|
1647
1692
|
{
|
|
1648
1693
|
value: _,
|
|
1649
|
-
policy:
|
|
1694
|
+
policy: W,
|
|
1650
1695
|
showRequirements: S
|
|
1651
1696
|
}
|
|
1652
1697
|
),
|
|
1653
1698
|
/* @__PURE__ */ n(
|
|
1654
|
-
|
|
1699
|
+
je,
|
|
1655
1700
|
{
|
|
1656
1701
|
label: x().t("archbase:Confirmar senha"),
|
|
1657
1702
|
placeholder: x().t("archbase:Confirmar senha"),
|
|
1658
1703
|
onChange: (B) => {
|
|
1659
|
-
R(B.currentTarget.value),
|
|
1704
|
+
R(B.currentTarget.value), K("");
|
|
1660
1705
|
},
|
|
1661
1706
|
value: m || "",
|
|
1662
1707
|
required: !0,
|
|
1663
|
-
error:
|
|
1708
|
+
error: v
|
|
1664
1709
|
}
|
|
1665
1710
|
),
|
|
1666
1711
|
/* @__PURE__ */ n(
|
|
1667
1712
|
G,
|
|
1668
1713
|
{
|
|
1669
|
-
disabled: !
|
|
1714
|
+
disabled: !P || !O || !_ || !m,
|
|
1670
1715
|
mt: "md",
|
|
1671
1716
|
fullWidth: !0,
|
|
1672
|
-
onClick: () => he(
|
|
1717
|
+
onClick: () => he(P, O, _, m),
|
|
1673
1718
|
children: `${x().t("archbase:Redefinir senha")}`
|
|
1674
1719
|
}
|
|
1675
1720
|
),
|
|
@@ -1680,14 +1725,14 @@ function Yr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1680
1725
|
fullWidth: !0,
|
|
1681
1726
|
color: A === "dark" ? U.colors.dark[4] : U.colors.gray[7],
|
|
1682
1727
|
onClick: () => {
|
|
1683
|
-
N ||
|
|
1728
|
+
N || L(!1);
|
|
1684
1729
|
},
|
|
1685
1730
|
children: `${x().t("archbase:Voltar")}`
|
|
1686
1731
|
}
|
|
1687
1732
|
)
|
|
1688
|
-
] }) : /* @__PURE__ */
|
|
1733
|
+
] }) : /* @__PURE__ */ I(ie, { children: [
|
|
1689
1734
|
/* @__PURE__ */ n(
|
|
1690
|
-
|
|
1735
|
+
z,
|
|
1691
1736
|
{
|
|
1692
1737
|
c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
|
|
1693
1738
|
fw: 800,
|
|
@@ -1697,17 +1742,17 @@ function Yr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1697
1742
|
children: x().t("archbase:Redefinir senha")
|
|
1698
1743
|
}
|
|
1699
1744
|
),
|
|
1700
|
-
/* @__PURE__ */ n(
|
|
1745
|
+
/* @__PURE__ */ n(z, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
|
|
1701
1746
|
/* @__PURE__ */ n(Ue, { m: "md" }),
|
|
1702
1747
|
/* @__PURE__ */ n(
|
|
1703
1748
|
xe,
|
|
1704
1749
|
{
|
|
1705
1750
|
label: "Email",
|
|
1706
1751
|
placeholder: `${x().t("archbase:usuario@email.com")}`,
|
|
1707
|
-
value:
|
|
1752
|
+
value: P || "",
|
|
1708
1753
|
required: !0,
|
|
1709
1754
|
onChange: (B) => {
|
|
1710
|
-
M(B.currentTarget.value),
|
|
1755
|
+
M(B.currentTarget.value), T("");
|
|
1711
1756
|
},
|
|
1712
1757
|
error: N
|
|
1713
1758
|
}
|
|
@@ -1715,10 +1760,10 @@ function Yr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1715
1760
|
/* @__PURE__ */ n(
|
|
1716
1761
|
G,
|
|
1717
1762
|
{
|
|
1718
|
-
disabled: !
|
|
1763
|
+
disabled: !P,
|
|
1719
1764
|
mt: "md",
|
|
1720
1765
|
fullWidth: !0,
|
|
1721
|
-
onClick: () =>
|
|
1766
|
+
onClick: () => we(P),
|
|
1722
1767
|
children: `${x().t("archbase:Enviar")}`
|
|
1723
1768
|
}
|
|
1724
1769
|
),
|
|
@@ -1733,13 +1778,13 @@ function Yr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1733
1778
|
}
|
|
1734
1779
|
)
|
|
1735
1780
|
] }),
|
|
1736
|
-
|
|
1781
|
+
w ? /* @__PURE__ */ n(z, { c: "red", style: { textAlign: "justify" }, children: w }) : null
|
|
1737
1782
|
]
|
|
1738
1783
|
}
|
|
1739
1784
|
);
|
|
1740
1785
|
}
|
|
1741
|
-
const
|
|
1742
|
-
const s = lt(
|
|
1786
|
+
const Cr = () => Kt().user, Mt = "archbaseSecurityManagerStore", Qr = ({ resourceName: r, resourceDescription: e, enableSecurity: t = !0 }) => {
|
|
1787
|
+
const s = lt(Mt), o = Cr(), a = o?.isAdmin ?? !1, c = o?.id, i = ct(c), d = at(() => {
|
|
1743
1788
|
if (!t)
|
|
1744
1789
|
return null;
|
|
1745
1790
|
const y = c ? `${r}_${c}` : r;
|
|
@@ -1748,10 +1793,10 @@ const Sr = () => Jt().user, Rt = "archbaseSecurityManagerStore", Xr = ({ resourc
|
|
|
1748
1793
|
if (h && h.isAdmin === a)
|
|
1749
1794
|
return h;
|
|
1750
1795
|
}
|
|
1751
|
-
const S = new
|
|
1796
|
+
const S = new vt(r, e, a);
|
|
1752
1797
|
return s && c && s.setValue(y, S), S;
|
|
1753
1798
|
}, [t, r, e, a, c]);
|
|
1754
|
-
return
|
|
1799
|
+
return X(() => {
|
|
1755
1800
|
i.current = c;
|
|
1756
1801
|
}, [c]), { securityManager: d };
|
|
1757
1802
|
};
|
|
@@ -1759,26 +1804,26 @@ function $e(r) {
|
|
|
1759
1804
|
const e = r?.response?.data ?? r?.data ?? r;
|
|
1760
1805
|
return e?.error === "CREDENTIALS_EXPIRED" || e?.requirePasswordChange === !0;
|
|
1761
1806
|
}
|
|
1762
|
-
const
|
|
1807
|
+
const Zr = ({
|
|
1763
1808
|
checkIntervalTokenHasExpired: r = 3e4,
|
|
1764
1809
|
// Verificar a 30 segundos
|
|
1765
1810
|
expirationThresholdOfToken: e = 300
|
|
1766
1811
|
// Antecipar em 5 minutos
|
|
1767
1812
|
}) => {
|
|
1768
1813
|
const t = De(
|
|
1769
|
-
(u) => u.get(
|
|
1814
|
+
(u) => u.get(Y.TokenManager)
|
|
1770
1815
|
), s = De(
|
|
1771
|
-
(u) => u.get(
|
|
1772
|
-
), [o, a] = p(null), [c, i] = p(!1), [d, y] = p(!0), [S, h] = p(!1), [U, A] = p(!1), [
|
|
1816
|
+
(u) => u.get(Y.Authenticator)
|
|
1817
|
+
), [o, a] = p(null), [c, i] = p(!1), [d, y] = p(!0), [S, h] = p(!1), [U, A] = p(!1), [w, E] = p(""), [P, M] = p(""), [O, V] = p(null), [_, b] = p(!1), [m, R] = p(!1), [H, L] = p(null), N = lt(Mt), T = {
|
|
1773
1818
|
hasContextualLogin: typeof s.loginWithContext == "function",
|
|
1774
1819
|
hasFlexibleLogin: typeof s.loginFlexible == "function",
|
|
1775
1820
|
hasSocialLogin: typeof s.loginSocial == "function",
|
|
1776
1821
|
hasRegistration: typeof s.register == "function",
|
|
1777
1822
|
hasContextSupport: typeof t.saveContext == "function"
|
|
1778
1823
|
};
|
|
1779
|
-
|
|
1824
|
+
X(() => {
|
|
1780
1825
|
const u = t.getUsername();
|
|
1781
|
-
if (u && u != "" && M(u),
|
|
1826
|
+
if (u && u != "" && M(u), T.hasContextSupport && t.getContext) {
|
|
1782
1827
|
const f = t.getContext();
|
|
1783
1828
|
if (f)
|
|
1784
1829
|
try {
|
|
@@ -1796,7 +1841,7 @@ const Qr = ({
|
|
|
1796
1841
|
}, te = () => {
|
|
1797
1842
|
R(!1);
|
|
1798
1843
|
}, se = (u) => {
|
|
1799
|
-
i(!1), h(!1), t.clearToken(), u && t.clearUsernameAndPassword(),
|
|
1844
|
+
i(!1), h(!1), t.clearToken(), u && t.clearUsernameAndPassword(), T.hasContextSupport && t.clearContext && t.clearContext(), M(""), V(null), E(""), A(!1), R(!1), N.clearAllValues();
|
|
1800
1845
|
}, g = async (u, l, f) => {
|
|
1801
1846
|
try {
|
|
1802
1847
|
i(!0), h(!1);
|
|
@@ -1805,69 +1850,69 @@ const Qr = ({
|
|
|
1805
1850
|
} catch (D) {
|
|
1806
1851
|
i(!1), h(!1), $e(D) && (M(u), R(!0)), E(ne(D)), A(!0);
|
|
1807
1852
|
}
|
|
1808
|
-
},
|
|
1809
|
-
if (!
|
|
1853
|
+
}, v = async (u, l = !1) => {
|
|
1854
|
+
if (!T.hasContextualLogin || !s.loginWithContext)
|
|
1810
1855
|
throw new Error("Login contextual não suportado por esta implementação do ArchbaseAuthenticator");
|
|
1811
1856
|
try {
|
|
1812
1857
|
i(!0), h(!1);
|
|
1813
|
-
const { context: f, user: D, ...
|
|
1814
|
-
if (
|
|
1815
|
-
|
|
1858
|
+
const { context: f, user: D, ...j } = await s.loginWithContext(u);
|
|
1859
|
+
if (j.mfa_required) {
|
|
1860
|
+
L(j.challenge_token ?? null), b(!0), M(u.email), i(!1);
|
|
1816
1861
|
return;
|
|
1817
1862
|
}
|
|
1818
1863
|
const Ae = {
|
|
1819
1864
|
scope: "",
|
|
1820
|
-
ext_expires_in:
|
|
1821
|
-
...
|
|
1865
|
+
ext_expires_in: j.expires_in,
|
|
1866
|
+
...j
|
|
1822
1867
|
};
|
|
1823
|
-
t.saveToken(Ae), l ? t.saveUsernameAndPassword(u.email, u.password) : t.clearUsernameAndPassword(), t.saveUsername(u.email),
|
|
1868
|
+
t.saveToken(Ae), l ? t.saveUsernameAndPassword(u.email, u.password) : t.clearUsernameAndPassword(), t.saveUsername(u.email), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), V(f)), M(u.email), a(Ae), i(!1), h(!0);
|
|
1824
1869
|
} catch (f) {
|
|
1825
1870
|
throw i(!1), h(!1), $e(f) && (M(u.email), R(!0)), E(ne(f)), A(!0), f;
|
|
1826
1871
|
}
|
|
1827
|
-
},
|
|
1872
|
+
}, K = async (u) => {
|
|
1828
1873
|
if (!s.verifyMfa)
|
|
1829
1874
|
throw new Error("verifyMfa não suportado por esta implementação do ArchbaseAuthenticator");
|
|
1830
|
-
if (!
|
|
1875
|
+
if (!H)
|
|
1831
1876
|
throw new Error("Nenhum desafio de MFA pendente");
|
|
1832
1877
|
try {
|
|
1833
1878
|
i(!0), E(""), A(!1);
|
|
1834
|
-
const l = await s.verifyMfa(
|
|
1835
|
-
t.saveToken(l), t.saveUsername(
|
|
1879
|
+
const l = await s.verifyMfa(H, u);
|
|
1880
|
+
t.saveToken(l), t.saveUsername(P), a(l), b(!1), L(null), i(!1), h(!0);
|
|
1836
1881
|
} catch (l) {
|
|
1837
1882
|
throw i(!1), E(ne(l)), A(!0), l;
|
|
1838
1883
|
}
|
|
1839
|
-
},
|
|
1840
|
-
b(!1),
|
|
1841
|
-
},
|
|
1842
|
-
if (!
|
|
1884
|
+
}, W = () => {
|
|
1885
|
+
b(!1), L(null), E(""), A(!1);
|
|
1886
|
+
}, we = async (u, l = !1) => {
|
|
1887
|
+
if (!T.hasFlexibleLogin || !s.loginFlexible)
|
|
1843
1888
|
throw new Error("Login flexível não suportado por esta implementação do ArchbaseAuthenticator");
|
|
1844
1889
|
try {
|
|
1845
1890
|
i(!0), h(!1);
|
|
1846
|
-
const { context: f, user: D, ...
|
|
1891
|
+
const { context: f, user: D, ...j } = await s.loginFlexible(u), Ae = {
|
|
1847
1892
|
scope: "",
|
|
1848
|
-
ext_expires_in:
|
|
1849
|
-
...
|
|
1893
|
+
ext_expires_in: j.expires_in,
|
|
1894
|
+
...j
|
|
1850
1895
|
};
|
|
1851
|
-
t.saveToken(Ae), l && t.saveUsernameAndPassword(u.identifier, u.password), t.saveUsername(D.email || u.identifier),
|
|
1896
|
+
t.saveToken(Ae), l && t.saveUsernameAndPassword(u.identifier, u.password), t.saveUsername(D.email || u.identifier), T.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), V(f)), M(D.email || u.identifier), a(Ae), i(!1), h(!0);
|
|
1852
1897
|
} catch (f) {
|
|
1853
1898
|
throw i(!1), h(!1), $e(f) && (M(u.identifier), R(!0)), E(ne(f)), A(!0), f;
|
|
1854
1899
|
}
|
|
1855
1900
|
}, he = async (u) => {
|
|
1856
|
-
if (!
|
|
1901
|
+
if (!T.hasSocialLogin || !s.loginSocial)
|
|
1857
1902
|
throw new Error("Login social não suportado por esta implementação do ArchbaseAuthenticator");
|
|
1858
1903
|
try {
|
|
1859
1904
|
i(!0), h(!1);
|
|
1860
|
-
const { context: l, user: f, ...D } = await s.loginSocial(u),
|
|
1905
|
+
const { context: l, user: f, ...D } = await s.loginSocial(u), j = {
|
|
1861
1906
|
scope: "",
|
|
1862
1907
|
ext_expires_in: D.expires_in,
|
|
1863
1908
|
...D
|
|
1864
1909
|
};
|
|
1865
|
-
t.saveToken(
|
|
1910
|
+
t.saveToken(j), t.saveUsername(f.email), T.hasContextSupport && t.saveContext && l && (t.saveContext(JSON.stringify(l)), V(l)), M(f.email), a(j), i(!1), h(!0);
|
|
1866
1911
|
} catch (l) {
|
|
1867
1912
|
throw i(!1), h(!1), E(ne(l)), A(!0), l;
|
|
1868
1913
|
}
|
|
1869
1914
|
}, B = async (u) => {
|
|
1870
|
-
if (!
|
|
1915
|
+
if (!T.hasRegistration || !s.register)
|
|
1871
1916
|
throw new Error("Registro não suportado por esta implementação do ArchbaseAuthenticator");
|
|
1872
1917
|
try {
|
|
1873
1918
|
i(!0);
|
|
@@ -1877,7 +1922,7 @@ const Qr = ({
|
|
|
1877
1922
|
throw i(!1), E(ne(l)), A(!0), l;
|
|
1878
1923
|
}
|
|
1879
1924
|
}, ce = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, oe = async (u) => s.validateContext ? await s.validateContext(u) : { context: u, supported: u === "DEFAULT" };
|
|
1880
|
-
|
|
1925
|
+
X(() => {
|
|
1881
1926
|
const u = setInterval(() => {
|
|
1882
1927
|
o && o.access_token && t.isTokenExpired(o, e) && be();
|
|
1883
1928
|
}, r);
|
|
@@ -1898,46 +1943,46 @@ const Qr = ({
|
|
|
1898
1943
|
// Métodos básicos (compatibilidade)
|
|
1899
1944
|
login: g,
|
|
1900
1945
|
logout: se,
|
|
1901
|
-
username:
|
|
1946
|
+
username: P,
|
|
1902
1947
|
isAuthenticated: S,
|
|
1903
1948
|
isAuthenticating: c,
|
|
1904
1949
|
isInitializing: d,
|
|
1905
1950
|
isError: U,
|
|
1906
|
-
error:
|
|
1951
|
+
error: w,
|
|
1907
1952
|
clearError: ee,
|
|
1908
1953
|
accessToken: o ? o.access_token : null,
|
|
1909
1954
|
// Métodos opcionais para autenticação avançada
|
|
1910
|
-
loginWithContext:
|
|
1911
|
-
loginFlexible:
|
|
1912
|
-
loginSocial:
|
|
1913
|
-
register:
|
|
1955
|
+
loginWithContext: T.hasContextualLogin ? v : void 0,
|
|
1956
|
+
loginFlexible: T.hasFlexibleLogin ? we : void 0,
|
|
1957
|
+
loginSocial: T.hasSocialLogin ? he : void 0,
|
|
1958
|
+
register: T.hasRegistration ? B : void 0,
|
|
1914
1959
|
getSupportedContexts: ce,
|
|
1915
1960
|
validateContext: oe,
|
|
1916
1961
|
// MFA / segundo fator (2 passos)
|
|
1917
1962
|
mfaRequired: _,
|
|
1918
|
-
verifyMfa: typeof s.verifyMfa == "function" ?
|
|
1919
|
-
cancelMfa:
|
|
1963
|
+
verifyMfa: typeof s.verifyMfa == "function" ? K : void 0,
|
|
1964
|
+
cancelMfa: W,
|
|
1920
1965
|
// Troca de senha obrigatória (CREDENTIALS_EXPIRED)
|
|
1921
1966
|
passwordChangeRequired: m,
|
|
1922
1967
|
clearPasswordChangeRequired: te,
|
|
1923
1968
|
// Informações de contexto
|
|
1924
|
-
context:
|
|
1969
|
+
context: O,
|
|
1925
1970
|
// Detecção de capacidades
|
|
1926
|
-
capabilities:
|
|
1971
|
+
capabilities: T
|
|
1927
1972
|
};
|
|
1928
|
-
},
|
|
1973
|
+
}, es = () => {
|
|
1929
1974
|
const r = De(
|
|
1930
|
-
(s) => s.get(
|
|
1975
|
+
(s) => s.get(Y.TokenManager)
|
|
1931
1976
|
), [e, t] = p(null);
|
|
1932
|
-
return
|
|
1977
|
+
return X(() => {
|
|
1933
1978
|
const s = r.getToken();
|
|
1934
1979
|
s && t(s.access_token);
|
|
1935
1980
|
}, []), {
|
|
1936
1981
|
token: e
|
|
1937
1982
|
};
|
|
1938
|
-
},
|
|
1983
|
+
}, ts = () => {
|
|
1939
1984
|
const r = De(
|
|
1940
|
-
(d) => d.get(
|
|
1985
|
+
(d) => d.get(Y.Authenticator)
|
|
1941
1986
|
), [e, t] = p(!1), [s, o] = p("");
|
|
1942
1987
|
return {
|
|
1943
1988
|
sendResetPasswordEmail: async (d) => {
|
|
@@ -1960,24 +2005,24 @@ const Qr = ({
|
|
|
1960
2005
|
t(!1), o("");
|
|
1961
2006
|
}
|
|
1962
2007
|
};
|
|
1963
|
-
},
|
|
1964
|
-
/* @__PURE__ */
|
|
2008
|
+
}, Ir = () => /* @__PURE__ */ n(tr, { p: "xl", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ I(Ee, { gap: "md", children: [
|
|
2009
|
+
/* @__PURE__ */ I(ue, { gap: "sm", children: [
|
|
1965
2010
|
/* @__PURE__ */ n(dt, { size: "sm" }),
|
|
1966
|
-
/* @__PURE__ */ n(
|
|
2011
|
+
/* @__PURE__ */ n(z, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
|
|
1967
2012
|
] }),
|
|
1968
2013
|
/* @__PURE__ */ n(Ie, { height: 40, radius: "sm" }),
|
|
1969
2014
|
/* @__PURE__ */ n(Ie, { height: 200, radius: "sm" }),
|
|
1970
|
-
/* @__PURE__ */
|
|
2015
|
+
/* @__PURE__ */ I(ue, { gap: "md", children: [
|
|
1971
2016
|
/* @__PURE__ */ n(Ie, { height: 36, width: 100, radius: "sm" }),
|
|
1972
2017
|
/* @__PURE__ */ n(Ie, { height: 36, width: 100, radius: "sm" })
|
|
1973
2018
|
] })
|
|
1974
|
-
] }) }), Ye = Ve(null),
|
|
2019
|
+
] }) }), Ye = Ve(null), rs = ({
|
|
1975
2020
|
children: r,
|
|
1976
2021
|
user: e,
|
|
1977
2022
|
onError: t
|
|
1978
2023
|
}) => {
|
|
1979
|
-
const [s, o] = p(!1), [a, c] = p(null), [i] = p([]), d = e?.isAdministrator || !1, y = Ce((
|
|
1980
|
-
c(
|
|
2024
|
+
const [s, o] = p(!1), [a, c] = p(null), [i] = p([]), d = e?.isAdministrator || !1, y = Ce((w) => d ? !0 : i.includes(w), [i, d]), S = Ce((w) => d ? !0 : w.some((E) => i.includes(E)), [i, d]), h = Ce((w) => d ? !0 : w.every((E) => i.includes(E)), [i, d]), U = Ce((w) => {
|
|
2025
|
+
c(w), w && t && t(w);
|
|
1981
2026
|
}, [t]), A = {
|
|
1982
2027
|
user: e,
|
|
1983
2028
|
isLoading: s,
|
|
@@ -1989,7 +2034,7 @@ const Qr = ({
|
|
|
1989
2034
|
setError: U
|
|
1990
2035
|
};
|
|
1991
2036
|
return /* @__PURE__ */ n(Ye.Provider, { value: A, children: r });
|
|
1992
|
-
},
|
|
2037
|
+
}, Nt = Ve(null), Pr = ({
|
|
1993
2038
|
children: r,
|
|
1994
2039
|
resourceName: e,
|
|
1995
2040
|
resourceDescription: t,
|
|
@@ -1999,31 +2044,31 @@ const Qr = ({
|
|
|
1999
2044
|
onSecurityReady: c,
|
|
2000
2045
|
onError: i
|
|
2001
2046
|
}) => {
|
|
2002
|
-
const d =
|
|
2047
|
+
const d = He(Ye);
|
|
2003
2048
|
if (!d)
|
|
2004
2049
|
throw new Error("ArchbaseViewSecurityProvider deve ser usado dentro de um ArchbaseSecurityProvider");
|
|
2005
|
-
const { user: y, isAdmin: S } = d, [h, U] = p(null), [A,
|
|
2050
|
+
const { user: y, isAdmin: S } = d, [h, U] = p(null), [A, w] = p(!0), [E, P] = p(null);
|
|
2006
2051
|
if (it.useEffect(() => {
|
|
2007
2052
|
if (!y) {
|
|
2008
|
-
|
|
2053
|
+
w(!1);
|
|
2009
2054
|
return;
|
|
2010
2055
|
}
|
|
2011
|
-
const m = new
|
|
2056
|
+
const m = new vt(e, t, S);
|
|
2012
2057
|
(async () => {
|
|
2013
|
-
|
|
2058
|
+
w(!0);
|
|
2014
2059
|
try {
|
|
2015
2060
|
await m.apply(() => {
|
|
2016
|
-
U(m),
|
|
2061
|
+
U(m), w(!1), c && c(m);
|
|
2017
2062
|
});
|
|
2018
2063
|
} catch {
|
|
2019
|
-
const
|
|
2020
|
-
|
|
2064
|
+
const L = m.getError() || "Erro ao carregar permissões";
|
|
2065
|
+
P(L), w(!1), i && i(L);
|
|
2021
2066
|
}
|
|
2022
2067
|
})();
|
|
2023
2068
|
}, [e, t, y, S, c, i]), A)
|
|
2024
|
-
return a ? /* @__PURE__ */ n(ie, { children: a }) : /* @__PURE__ */ n(
|
|
2069
|
+
return a ? /* @__PURE__ */ n(ie, { children: a }) : /* @__PURE__ */ n(Ir, {});
|
|
2025
2070
|
if (E)
|
|
2026
|
-
return /* @__PURE__ */ n("div", { className: "archbase-security-error", children: /* @__PURE__ */
|
|
2071
|
+
return /* @__PURE__ */ n("div", { className: "archbase-security-error", children: /* @__PURE__ */ I("div", { children: [
|
|
2027
2072
|
"Erro ao carregar permissões: ",
|
|
2028
2073
|
E
|
|
2029
2074
|
] }) });
|
|
@@ -2032,9 +2077,9 @@ const Qr = ({
|
|
|
2032
2077
|
if (s.length > 0 && h && !s.every(
|
|
2033
2078
|
(R) => h.hasPermission(R)
|
|
2034
2079
|
))
|
|
2035
|
-
return o || /* @__PURE__ */
|
|
2080
|
+
return o || /* @__PURE__ */ I("div", { className: "archbase-security-access-denied", children: [
|
|
2036
2081
|
/* @__PURE__ */ n("div", { children: "Você não possui permissão para acessar esta área" }),
|
|
2037
|
-
/* @__PURE__ */
|
|
2082
|
+
/* @__PURE__ */ I("small", { children: [
|
|
2038
2083
|
"Permissões necessárias: ",
|
|
2039
2084
|
s.join(", ")
|
|
2040
2085
|
] })
|
|
@@ -2050,18 +2095,18 @@ const Qr = ({
|
|
|
2050
2095
|
isLoading: A,
|
|
2051
2096
|
error: E
|
|
2052
2097
|
};
|
|
2053
|
-
return /* @__PURE__ */ n(
|
|
2054
|
-
},
|
|
2055
|
-
const r =
|
|
2098
|
+
return /* @__PURE__ */ n(Nt.Provider, { value: b, children: r });
|
|
2099
|
+
}, Tr = () => {
|
|
2100
|
+
const r = He(Ye);
|
|
2056
2101
|
if (!r)
|
|
2057
2102
|
throw new Error("useArchbaseSecurity deve ser usado dentro de um ArchbaseSecurityProvider");
|
|
2058
2103
|
return r;
|
|
2059
2104
|
}, Xe = () => {
|
|
2060
|
-
const r =
|
|
2105
|
+
const r = He(Nt);
|
|
2061
2106
|
if (!r)
|
|
2062
2107
|
throw new Error("useArchbaseViewSecurity deve ser usado dentro de um ArchbaseViewSecurityProvider");
|
|
2063
2108
|
return r;
|
|
2064
|
-
},
|
|
2109
|
+
}, ss = (r, e) => {
|
|
2065
2110
|
const t = Xe(), { hasPermission: s, hasAnyPermission: o, hasAllPermissions: a, registerAction: c, securityManager: i, isLoading: d, error: y } = t;
|
|
2066
2111
|
return it.useEffect(() => {
|
|
2067
2112
|
r && e && (c("create", `Criar ${e}`), c("edit", `Editar ${e}`), c("delete", `Deletar ${e}`), c("view", `Visualizar ${e}`), c("list", `Listar ${e}`));
|
|
@@ -2079,15 +2124,15 @@ const Qr = ({
|
|
|
2079
2124
|
isLoading: d,
|
|
2080
2125
|
error: y
|
|
2081
2126
|
};
|
|
2082
|
-
},
|
|
2127
|
+
}, os = () => {
|
|
2083
2128
|
const r = Xe();
|
|
2084
2129
|
return {
|
|
2085
2130
|
check: r.hasPermission,
|
|
2086
2131
|
checkAny: r.hasAnyPermission,
|
|
2087
2132
|
checkAll: r.hasAllPermissions,
|
|
2088
|
-
isAdmin:
|
|
2133
|
+
isAdmin: Tr().isAdmin
|
|
2089
2134
|
};
|
|
2090
|
-
},
|
|
2135
|
+
}, Bt = ({
|
|
2091
2136
|
children: r,
|
|
2092
2137
|
actionName: e,
|
|
2093
2138
|
requiredPermissions: t = [],
|
|
@@ -2097,12 +2142,12 @@ const Qr = ({
|
|
|
2097
2142
|
autoRegister: c = !0
|
|
2098
2143
|
}) => {
|
|
2099
2144
|
const { hasPermission: i, hasAnyPermission: d, hasAllPermissions: y, registerAction: S } = Xe();
|
|
2100
|
-
|
|
2145
|
+
X(() => {
|
|
2101
2146
|
c && e && o && S(e, o);
|
|
2102
2147
|
}, [e, o, c, S]);
|
|
2103
2148
|
let h = !1;
|
|
2104
2149
|
return e ? h = i(e) : t.length > 0 ? h = s ? y(t) : d(t) : h = !0, h ? /* @__PURE__ */ n(ie, { children: r }) : /* @__PURE__ */ n(ie, { children: a });
|
|
2105
|
-
},
|
|
2150
|
+
}, ns = ({
|
|
2106
2151
|
actionName: r,
|
|
2107
2152
|
actionDescription: e,
|
|
2108
2153
|
children: t,
|
|
@@ -2115,8 +2160,8 @@ const Qr = ({
|
|
|
2115
2160
|
type: y = "button"
|
|
2116
2161
|
}) => {
|
|
2117
2162
|
const S = () => {
|
|
2118
|
-
const U = "archbase-secure-btn", A = `archbase-secure-btn--${i}`,
|
|
2119
|
-
return `${U} ${A} ${
|
|
2163
|
+
const U = "archbase-secure-btn", A = `archbase-secure-btn--${i}`, w = `archbase-secure-btn--${d}`;
|
|
2164
|
+
return `${U} ${A} ${w} ${a}`.trim();
|
|
2120
2165
|
}, h = () => {
|
|
2121
2166
|
const U = {
|
|
2122
2167
|
small: { padding: "4px 8px", fontSize: "12px" },
|
|
@@ -2141,7 +2186,7 @@ const Qr = ({
|
|
|
2141
2186
|
};
|
|
2142
2187
|
};
|
|
2143
2188
|
return /* @__PURE__ */ n(
|
|
2144
|
-
|
|
2189
|
+
Bt,
|
|
2145
2190
|
{
|
|
2146
2191
|
actionName: r,
|
|
2147
2192
|
actionDescription: e,
|
|
@@ -2159,7 +2204,7 @@ const Qr = ({
|
|
|
2159
2204
|
)
|
|
2160
2205
|
}
|
|
2161
2206
|
);
|
|
2162
|
-
},
|
|
2207
|
+
}, is = ({
|
|
2163
2208
|
children: r,
|
|
2164
2209
|
actionName: e,
|
|
2165
2210
|
actionDescription: t,
|
|
@@ -2168,11 +2213,11 @@ const Qr = ({
|
|
|
2168
2213
|
fallbackText: a = "Campo não disponível",
|
|
2169
2214
|
fallbackComponent: c
|
|
2170
2215
|
}) => e ? /* @__PURE__ */ n(
|
|
2171
|
-
|
|
2216
|
+
Bt,
|
|
2172
2217
|
{
|
|
2173
2218
|
actionName: e,
|
|
2174
2219
|
actionDescription: t,
|
|
2175
|
-
fallback: c || /* @__PURE__ */
|
|
2220
|
+
fallback: c || /* @__PURE__ */ I("div", { className: "archbase-secure-field-fallback", style: {
|
|
2176
2221
|
padding: "8px",
|
|
2177
2222
|
color: "#666",
|
|
2178
2223
|
fontStyle: "italic",
|
|
@@ -2180,7 +2225,7 @@ const Qr = ({
|
|
|
2180
2225
|
border: "1px dashed #dee2e6",
|
|
2181
2226
|
borderRadius: "4px"
|
|
2182
2227
|
}, children: [
|
|
2183
|
-
s && o && /* @__PURE__ */
|
|
2228
|
+
s && o && /* @__PURE__ */ I("label", { style: { fontWeight: "bold" }, children: [
|
|
2184
2229
|
o,
|
|
2185
2230
|
": "
|
|
2186
2231
|
] }),
|
|
@@ -2189,11 +2234,11 @@ const Qr = ({
|
|
|
2189
2234
|
children: r
|
|
2190
2235
|
}
|
|
2191
2236
|
) : /* @__PURE__ */ n(ie, { children: r });
|
|
2192
|
-
function
|
|
2237
|
+
function as(r, e) {
|
|
2193
2238
|
return function(s) {
|
|
2194
2239
|
const { resourceName: o, resourceDescription: a, requiredPermissions: c, fallbackComponent: i } = e;
|
|
2195
2240
|
return /* @__PURE__ */ n(
|
|
2196
|
-
|
|
2241
|
+
Pr,
|
|
2197
2242
|
{
|
|
2198
2243
|
resourceName: o,
|
|
2199
2244
|
resourceDescription: a,
|
|
@@ -2205,76 +2250,77 @@ function is(r, e) {
|
|
|
2205
2250
|
};
|
|
2206
2251
|
}
|
|
2207
2252
|
export {
|
|
2208
|
-
|
|
2209
|
-
|
|
2253
|
+
Mt as ARCHBASE_SECURITY_MANAGER_STORE,
|
|
2254
|
+
xr as AccessIntervalDto,
|
|
2210
2255
|
At as AccessScheduleDto,
|
|
2211
2256
|
qe as AccessTokenDto,
|
|
2212
|
-
|
|
2257
|
+
kr as ActionDto,
|
|
2213
2258
|
Ke as ApiTokenDto,
|
|
2214
2259
|
Dt as ArchbaseAccessTokenService,
|
|
2215
2260
|
Ut as ArchbaseApiTokenService,
|
|
2216
|
-
|
|
2217
|
-
|
|
2261
|
+
br as ArchbaseAuthContext,
|
|
2262
|
+
Gr as ArchbaseAuthProvider,
|
|
2218
2263
|
Pt as ArchbaseGroupService,
|
|
2219
|
-
|
|
2220
|
-
|
|
2264
|
+
qr as ArchbaseLogin,
|
|
2265
|
+
Yr as ArchbaseMfaSetup,
|
|
2221
2266
|
Tt as ArchbaseProfileService,
|
|
2222
|
-
|
|
2223
|
-
|
|
2267
|
+
Bt as ArchbaseProtectedComponent,
|
|
2268
|
+
Xr as ArchbaseResetPassword,
|
|
2224
2269
|
_t as ArchbaseResourceService,
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2270
|
+
ns as ArchbaseSecureActionButton,
|
|
2271
|
+
is as ArchbaseSecureFormField,
|
|
2272
|
+
Rt as ArchbaseSecurityDiagnosticsService,
|
|
2273
|
+
vt as ArchbaseSecurityManager,
|
|
2274
|
+
rs as ArchbaseSecurityProvider,
|
|
2275
|
+
J as ArchbaseTenantManager,
|
|
2230
2276
|
ht as ArchbaseUser,
|
|
2231
2277
|
It as ArchbaseUserService,
|
|
2232
2278
|
pt as ArchbaseUsernameAndPassword,
|
|
2233
2279
|
pt as ArchbaseUsernameAndPasswordImpl,
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2280
|
+
Pr as ArchbaseViewSecurityProvider,
|
|
2281
|
+
Le as CONTEXT_STORAGE_KEY,
|
|
2282
|
+
nr as DefaultArchbaseTokenManager,
|
|
2283
|
+
Ir as DefaultSecurityLoading,
|
|
2238
2284
|
le as ENCRYPTION_KEY,
|
|
2239
2285
|
mt as FetchError,
|
|
2240
2286
|
Se as GroupDto,
|
|
2241
|
-
|
|
2287
|
+
Kr as PermissionDto,
|
|
2242
2288
|
ke as ProfileDto,
|
|
2243
2289
|
St as ResourceDto,
|
|
2244
2290
|
ye as SecurityDto,
|
|
2245
2291
|
me as SecurityType,
|
|
2246
2292
|
Ne as TOKEN_COOKIE_NAME,
|
|
2247
|
-
|
|
2248
|
-
|
|
2293
|
+
Er as TipoRecurso,
|
|
2294
|
+
Oe as USER_NAME,
|
|
2249
2295
|
Be as USER_NAME_AND_PASSWORD,
|
|
2250
2296
|
Me as UserDto,
|
|
2251
2297
|
Ge as UserGroupDto,
|
|
2252
|
-
|
|
2298
|
+
gr as createInternalConfig,
|
|
2253
2299
|
Te as decodeJWT,
|
|
2254
2300
|
pe as epochAtSecondsFromNow,
|
|
2255
2301
|
nt as epochTimeIsPast,
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2302
|
+
hr as fetchTokens,
|
|
2303
|
+
pr as fetchWithRefreshToken,
|
|
2304
|
+
ar as generateCodeChallenge,
|
|
2305
|
+
ir as generateRandomString,
|
|
2260
2306
|
ft as getRandomInteger,
|
|
2261
2307
|
wr as getRefreshExpiresIn,
|
|
2262
2308
|
$e as isCredentialsExpiredError,
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2309
|
+
lr as postWithXForm,
|
|
2310
|
+
dr as redirectToLogin,
|
|
2311
|
+
fr as redirectToLogout,
|
|
2312
|
+
Zr as useArchbaseAuthenticationManager,
|
|
2313
|
+
es as useArchbaseGetCurrentToken,
|
|
2314
|
+
Cr as useArchbaseGetLoggedUser,
|
|
2315
|
+
os as useArchbasePermissionCheck,
|
|
2316
|
+
ts as useArchbaseResetPassword,
|
|
2317
|
+
ss as useArchbaseSecureForm,
|
|
2318
|
+
Tr as useArchbaseSecurity,
|
|
2319
|
+
Qr as useArchbaseSecurityManager,
|
|
2320
|
+
Jr as useArchbaseTenantManager,
|
|
2275
2321
|
Xe as useArchbaseViewSecurity,
|
|
2276
2322
|
Wr as useBrowserStorage,
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2323
|
+
yr as validateConfig,
|
|
2324
|
+
mr as validateState,
|
|
2325
|
+
as as withArchbaseSecurity
|
|
2280
2326
|
};
|