@strapi/admin 5.52.1 → 5.52.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/admin/admin/src/pages/Auth/AuthPage.js +14 -9
- package/dist/admin/admin/src/pages/Auth/AuthPage.js.map +1 -1
- package/dist/admin/admin/src/pages/Auth/AuthPage.mjs +15 -10
- package/dist/admin/admin/src/pages/Auth/AuthPage.mjs.map +1 -1
- package/dist/admin/admin/src/pages/Auth/components/Login.js +2 -6
- package/dist/admin/admin/src/pages/Auth/components/Login.js.map +1 -1
- package/dist/admin/admin/src/pages/Auth/components/Login.mjs +2 -6
- package/dist/admin/admin/src/pages/Auth/components/Login.mjs.map +1 -1
- package/dist/admin/admin/src/pages/Auth/constants.js +24 -8
- package/dist/admin/admin/src/pages/Auth/constants.js.map +1 -1
- package/dist/admin/admin/src/pages/Auth/constants.mjs +23 -9
- package/dist/admin/admin/src/pages/Auth/constants.mjs.map +1 -1
- package/dist/admin/admin/src/pages/Auth/utils.js +34 -0
- package/dist/admin/admin/src/pages/Auth/utils.js.map +1 -0
- package/dist/admin/admin/src/pages/Auth/utils.mjs +32 -0
- package/dist/admin/admin/src/pages/Auth/utils.mjs.map +1 -0
- package/dist/admin/admin/src/translations/pt-BR.json.js +1 -1
- package/dist/admin/admin/src/translations/pt-BR.json.mjs +1 -1
- package/dist/admin/admin/src/utils/getFetchClient.js +4 -0
- package/dist/admin/admin/src/utils/getFetchClient.js.map +1 -1
- package/dist/admin/admin/src/utils/getFetchClient.mjs +4 -0
- package/dist/admin/admin/src/utils/getFetchClient.mjs.map +1 -1
- package/dist/admin/admin/src/utils/rulesEngine.js +27 -9
- package/dist/admin/admin/src/utils/rulesEngine.js.map +1 -1
- package/dist/admin/admin/src/utils/rulesEngine.mjs +2 -2
- package/dist/admin/admin/src/utils/rulesEngine.mjs.map +1 -1
- package/dist/admin/index.js +0 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/pages/Auth/constants.d.ts +19 -5
- package/dist/admin/src/pages/Auth/utils.d.ts +7 -0
- package/dist/admin/src/utils/rulesEngine.d.ts +9 -13
- package/dist/ee/server/src/audit-logs/services/audit-logs.d.ts.map +1 -1
- package/dist/server/ee/server/src/audit-logs/services/audit-logs.js +22 -4
- package/dist/server/ee/server/src/audit-logs/services/audit-logs.js.map +1 -1
- package/dist/server/ee/server/src/audit-logs/services/audit-logs.mjs +22 -4
- package/dist/server/ee/server/src/audit-logs/services/audit-logs.mjs.map +1 -1
- package/dist/server/server/src/controllers/validation/schema.js +36 -16
- package/dist/server/server/src/controllers/validation/schema.js.map +1 -1
- package/dist/server/server/src/controllers/validation/schema.mjs +1 -1
- package/dist/server/server/src/controllers/validation/schema.mjs.map +1 -1
- package/dist/server/server/src/services/content-type.js +8 -3
- package/dist/server/server/src/services/content-type.js.map +1 -1
- package/dist/server/server/src/services/content-type.mjs +8 -3
- package/dist/server/server/src/services/content-type.mjs.map +1 -1
- package/dist/server/server/src/services/permission/queries.js +3 -1
- package/dist/server/server/src/services/permission/queries.js.map +1 -1
- package/dist/server/server/src/services/permission/queries.mjs +3 -1
- package/dist/server/server/src/services/permission/queries.mjs.map +1 -1
- package/dist/server/src/controllers/validation/schema.d.ts +8 -48
- package/dist/server/src/controllers/validation/schema.d.ts.map +1 -1
- package/dist/server/src/services/content-type.d.ts.map +1 -1
- package/dist/server/src/services/permission/queries.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -8,6 +8,7 @@ var admin = require('../../services/admin.js');
|
|
|
8
8
|
var retryDynamicImport = require('../../utils/retryDynamicImport.js');
|
|
9
9
|
var Login = require('./components/Login.js');
|
|
10
10
|
var constants = require('./constants.js');
|
|
11
|
+
var utils = require('./utils.js');
|
|
11
12
|
|
|
12
13
|
/* -------------------------------------------------------------------------------------------------
|
|
13
14
|
* AuthPage
|
|
@@ -28,7 +29,7 @@ var constants = require('./constants.js');
|
|
|
28
29
|
defaultValue: constants.FORMS
|
|
29
30
|
});
|
|
30
31
|
const { token } = Auth.useAuth('AuthPage', (auth)=>auth);
|
|
31
|
-
if (!authType || !forms) {
|
|
32
|
+
if (!constants.isAuthType(authType) || !forms) {
|
|
32
33
|
return /*#__PURE__*/ jsxRuntime.jsx(reactRouterDom.Navigate, {
|
|
33
34
|
to: "/"
|
|
34
35
|
});
|
|
@@ -42,32 +43,36 @@ var constants = require('./constants.js');
|
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
// User is already logged in
|
|
45
|
-
if (authType !==
|
|
46
|
+
if (authType !== constants.AUTH_TYPES.REGISTER_ADMIN && authType !== constants.AUTH_TYPES.REGISTER && token) {
|
|
47
|
+
// Honour the `?redirectTo` the user was sent here with, otherwise logging in from a
|
|
48
|
+
// deep link always lands on the home page. `login()` sets the token before the login
|
|
49
|
+
// form gets to navigate, so this branch is what actually performs the redirect.
|
|
50
|
+
// See https://github.com/strapi/strapi/issues/19557
|
|
46
51
|
return /*#__PURE__*/ jsxRuntime.jsx(reactRouterDom.Navigate, {
|
|
47
|
-
to:
|
|
52
|
+
to: utils.getRedirectTo(search)
|
|
48
53
|
});
|
|
49
54
|
}
|
|
50
55
|
// there is already an admin user oo
|
|
51
|
-
if (hasAdmin && authType ===
|
|
56
|
+
if (hasAdmin && authType === constants.AUTH_TYPES.REGISTER_ADMIN && token) {
|
|
52
57
|
return /*#__PURE__*/ jsxRuntime.jsx(reactRouterDom.Navigate, {
|
|
53
|
-
to:
|
|
58
|
+
to: utils.getRedirectTo(search)
|
|
54
59
|
});
|
|
55
60
|
}
|
|
56
61
|
// Redirect the user to the register-admin if it is the first user
|
|
57
|
-
if (!hasAdmin && authType !==
|
|
62
|
+
if (!hasAdmin && authType !== constants.AUTH_TYPES.REGISTER_ADMIN) {
|
|
58
63
|
return /*#__PURE__*/ jsxRuntime.jsx(reactRouterDom.Navigate, {
|
|
59
64
|
to: {
|
|
60
|
-
pathname:
|
|
65
|
+
pathname: `/auth/${constants.AUTH_TYPES.REGISTER_ADMIN}`,
|
|
61
66
|
// Forward the `?redirectTo` from /auth/login
|
|
62
67
|
// /abc => /auth/login?redirectTo=%2Fabc => /auth/register-admin?redirectTo=%2Fabc
|
|
63
68
|
search
|
|
64
69
|
}
|
|
65
70
|
});
|
|
66
71
|
}
|
|
67
|
-
if (Login$1 && authType ===
|
|
72
|
+
if (Login$1 && authType === constants.AUTH_TYPES.LOGIN) {
|
|
68
73
|
// Assign the component to render for the login form
|
|
69
74
|
return /*#__PURE__*/ jsxRuntime.jsx(Login$1, {});
|
|
70
|
-
} else if (authType ===
|
|
75
|
+
} else if (authType === constants.AUTH_TYPES.LOGIN && !Login$1) {
|
|
71
76
|
// block rendering until the Login EE component is fully loaded
|
|
72
77
|
return null;
|
|
73
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthPage.js","sources":["../../../../../../admin/src/pages/Auth/AuthPage.tsx"],"sourcesContent":["import { Navigate, useLocation, useMatch } from 'react-router-dom';\n\nimport { useAuth } from '../../features/Auth';\nimport { useEnterprise } from '../../hooks/useEnterprise';\nimport { useInitQuery } from '../../services/admin';\nimport { retryDynamicImport } from '../../utils/retryDynamicImport';\n\nimport { Login as LoginCE } from './components/Login';\nimport { FORMS, FormDictionary } from './constants';\n\n/* -------------------------------------------------------------------------------------------------\n * AuthPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst AuthPage = () => {\n const { search } = useLocation();\n const match = useMatch('/auth/:authType');\n const authType = match?.params.authType;\n const { data } = useInitQuery();\n const { hasAdmin } = data ?? {};\n const Login = useEnterprise(\n LoginCE,\n async () =>\n (\n await retryDynamicImport(\n () => import('../../../../ee/admin/src/pages/AuthPage/components/Login')\n )\n ).LoginEE\n );\n const forms = useEnterprise<FormDictionary, Partial<FormDictionary>>(\n FORMS,\n async () =>\n (await retryDynamicImport(() => import('../../../../ee/admin/src/pages/AuthPage/constants')))\n .FORMS,\n {\n combine(ceForms, eeForms) {\n return {\n ...ceForms,\n ...eeForms,\n };\n },\n defaultValue: FORMS,\n }\n );\n\n const { token } = useAuth('AuthPage', (auth) => auth);\n\n if (!authType || !forms) {\n return <Navigate to=\"/\" />;\n }\n\n const Component = forms[authType
|
|
1
|
+
{"version":3,"file":"AuthPage.js","sources":["../../../../../../admin/src/pages/Auth/AuthPage.tsx"],"sourcesContent":["import { Navigate, useLocation, useMatch } from 'react-router-dom';\n\nimport { useAuth } from '../../features/Auth';\nimport { useEnterprise } from '../../hooks/useEnterprise';\nimport { useInitQuery } from '../../services/admin';\nimport { retryDynamicImport } from '../../utils/retryDynamicImport';\n\nimport { Login as LoginCE } from './components/Login';\nimport { AUTH_TYPES, FORMS, FormDictionary, isAuthType } from './constants';\nimport { getRedirectTo } from './utils';\n\n/* -------------------------------------------------------------------------------------------------\n * AuthPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst AuthPage = () => {\n const { search } = useLocation();\n const match = useMatch('/auth/:authType');\n const authType = match?.params.authType;\n const { data } = useInitQuery();\n const { hasAdmin } = data ?? {};\n const Login = useEnterprise(\n LoginCE,\n async () =>\n (\n await retryDynamicImport(\n () => import('../../../../ee/admin/src/pages/AuthPage/components/Login')\n )\n ).LoginEE\n );\n const forms = useEnterprise<FormDictionary, Partial<FormDictionary>>(\n FORMS,\n async () =>\n (await retryDynamicImport(() => import('../../../../ee/admin/src/pages/AuthPage/constants')))\n .FORMS,\n {\n combine(ceForms, eeForms) {\n return {\n ...ceForms,\n ...eeForms,\n };\n },\n defaultValue: FORMS,\n }\n );\n\n const { token } = useAuth('AuthPage', (auth) => auth);\n\n if (!isAuthType(authType) || !forms) {\n return <Navigate to=\"/\" />;\n }\n\n const Component = forms[authType];\n\n // Redirect the user to the login page if\n // the endpoint does not exists\n if (!Component) {\n return <Navigate to=\"/\" />;\n }\n\n // User is already logged in\n if (authType !== AUTH_TYPES.REGISTER_ADMIN && authType !== AUTH_TYPES.REGISTER && token) {\n // Honour the `?redirectTo` the user was sent here with, otherwise logging in from a\n // deep link always lands on the home page. `login()` sets the token before the login\n // form gets to navigate, so this branch is what actually performs the redirect.\n // See https://github.com/strapi/strapi/issues/19557\n return <Navigate to={getRedirectTo(search)} />;\n }\n\n // there is already an admin user oo\n if (hasAdmin && authType === AUTH_TYPES.REGISTER_ADMIN && token) {\n return <Navigate to={getRedirectTo(search)} />;\n }\n\n // Redirect the user to the register-admin if it is the first user\n if (!hasAdmin && authType !== AUTH_TYPES.REGISTER_ADMIN) {\n return (\n <Navigate\n to={{\n pathname: `/auth/${AUTH_TYPES.REGISTER_ADMIN}`,\n // Forward the `?redirectTo` from /auth/login\n // /abc => /auth/login?redirectTo=%2Fabc => /auth/register-admin?redirectTo=%2Fabc\n search,\n }}\n />\n );\n }\n\n if (Login && authType === AUTH_TYPES.LOGIN) {\n // Assign the component to render for the login form\n return <Login />;\n } else if (authType === AUTH_TYPES.LOGIN && !Login) {\n // block rendering until the Login EE component is fully loaded\n return null;\n }\n\n return <Component hasAdmin={hasAdmin} />;\n};\n\nexport { AuthPage };\n"],"names":["AuthPage","search","useLocation","match","useMatch","authType","params","data","useInitQuery","hasAdmin","Login","useEnterprise","LoginCE","retryDynamicImport","LoginEE","forms","FORMS","combine","ceForms","eeForms","defaultValue","token","useAuth","auth","isAuthType","_jsx","Navigate","to","Component","AUTH_TYPES","REGISTER_ADMIN","REGISTER","getRedirectTo","pathname","LOGIN"],"mappings":";;;;;;;;;;;;AAWA;;AAEkG,2GAE5FA,QAAAA,GAAW,IAAA;IACf,MAAM,EAAEC,MAAM,EAAE,GAAGC,0BAAAA,EAAAA;AACnB,IAAA,MAAMC,QAAQC,uBAAAA,CAAS,iBAAA,CAAA;IACvB,MAAMC,QAAAA,GAAWF,OAAOG,MAAAA,CAAOD,QAAAA;IAC/B,MAAM,EAAEE,IAAI,EAAE,GAAGC,kBAAAA,EAAAA;AACjB,IAAA,MAAM,EAAEC,QAAQ,EAAE,GAAGF,QAAQ,EAAC;AAC9B,IAAA,MAAMG,OAAAA,GAAQC,2BAAA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AASC,YAAAA,EAAAA,EAAIK,mBAAAA,CAAc/B,MAAAA;;AACrC,IAAA;;AAGA,IAAA,IAAI,CAACQ,QAAAA,IAAYJ,QAAAA,KAAawB,oBAAAA,CAAWC,cAAc,EAAE;AACvD,QAAA,qBACEL,cAAA,CAACC,uBAAAA,EAAAA;YACCC,EAAAA,EAAI;AACFM,gBAAAA,QAAAA,EAAU,CAAC,MAAM,EAAEJ,oBAAAA,CAAWC,cAAc,CAAA,CAAE;;;AAG9C7B,gBAAAA;AACF;;AAGN,IAAA;AAEA,IAAA,IAAIS,OAAAA,IAASL,QAAAA,KAAawB,oBAAAA,CAAWK,KAAK,EAAE;;AAE1C,QAAA,qBAAOT,cAAA,CAACf,OAAAA,EAAAA,EAAAA,CAAAA;AACV,IAAA,CAAA,MAAO,IAAIL,QAAAA,KAAawB,oBAAAA,CAAWK,KAAK,IAAI,CAACxB,OAAAA,EAAO;;QAElD,OAAO,IAAA;AACT,IAAA;AAEA,IAAA,qBAAOe,cAAA,CAACG,SAAAA,EAAAA;QAAUnB,QAAAA,EAAUA;;AAC9B;;;;"}
|
|
@@ -5,7 +5,8 @@ import { useEnterprise } from '../../hooks/useEnterprise.mjs';
|
|
|
5
5
|
import { useInitQuery } from '../../services/admin.mjs';
|
|
6
6
|
import { retryDynamicImport } from '../../utils/retryDynamicImport.mjs';
|
|
7
7
|
import { Login } from './components/Login.mjs';
|
|
8
|
-
import { FORMS } from './constants.mjs';
|
|
8
|
+
import { FORMS, isAuthType, AUTH_TYPES } from './constants.mjs';
|
|
9
|
+
import { getRedirectTo } from './utils.mjs';
|
|
9
10
|
|
|
10
11
|
/* -------------------------------------------------------------------------------------------------
|
|
11
12
|
* AuthPage
|
|
@@ -26,7 +27,7 @@ import { FORMS } from './constants.mjs';
|
|
|
26
27
|
defaultValue: FORMS
|
|
27
28
|
});
|
|
28
29
|
const { token } = useAuth('AuthPage', (auth)=>auth);
|
|
29
|
-
if (!authType || !forms) {
|
|
30
|
+
if (!isAuthType(authType) || !forms) {
|
|
30
31
|
return /*#__PURE__*/ jsx(Navigate, {
|
|
31
32
|
to: "/"
|
|
32
33
|
});
|
|
@@ -40,32 +41,36 @@ import { FORMS } from './constants.mjs';
|
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
// User is already logged in
|
|
43
|
-
if (authType !==
|
|
44
|
+
if (authType !== AUTH_TYPES.REGISTER_ADMIN && authType !== AUTH_TYPES.REGISTER && token) {
|
|
45
|
+
// Honour the `?redirectTo` the user was sent here with, otherwise logging in from a
|
|
46
|
+
// deep link always lands on the home page. `login()` sets the token before the login
|
|
47
|
+
// form gets to navigate, so this branch is what actually performs the redirect.
|
|
48
|
+
// See https://github.com/strapi/strapi/issues/19557
|
|
44
49
|
return /*#__PURE__*/ jsx(Navigate, {
|
|
45
|
-
to:
|
|
50
|
+
to: getRedirectTo(search)
|
|
46
51
|
});
|
|
47
52
|
}
|
|
48
53
|
// there is already an admin user oo
|
|
49
|
-
if (hasAdmin && authType ===
|
|
54
|
+
if (hasAdmin && authType === AUTH_TYPES.REGISTER_ADMIN && token) {
|
|
50
55
|
return /*#__PURE__*/ jsx(Navigate, {
|
|
51
|
-
to:
|
|
56
|
+
to: getRedirectTo(search)
|
|
52
57
|
});
|
|
53
58
|
}
|
|
54
59
|
// Redirect the user to the register-admin if it is the first user
|
|
55
|
-
if (!hasAdmin && authType !==
|
|
60
|
+
if (!hasAdmin && authType !== AUTH_TYPES.REGISTER_ADMIN) {
|
|
56
61
|
return /*#__PURE__*/ jsx(Navigate, {
|
|
57
62
|
to: {
|
|
58
|
-
pathname:
|
|
63
|
+
pathname: `/auth/${AUTH_TYPES.REGISTER_ADMIN}`,
|
|
59
64
|
// Forward the `?redirectTo` from /auth/login
|
|
60
65
|
// /abc => /auth/login?redirectTo=%2Fabc => /auth/register-admin?redirectTo=%2Fabc
|
|
61
66
|
search
|
|
62
67
|
}
|
|
63
68
|
});
|
|
64
69
|
}
|
|
65
|
-
if (Login$1 && authType ===
|
|
70
|
+
if (Login$1 && authType === AUTH_TYPES.LOGIN) {
|
|
66
71
|
// Assign the component to render for the login form
|
|
67
72
|
return /*#__PURE__*/ jsx(Login$1, {});
|
|
68
|
-
} else if (authType ===
|
|
73
|
+
} else if (authType === AUTH_TYPES.LOGIN && !Login$1) {
|
|
69
74
|
// block rendering until the Login EE component is fully loaded
|
|
70
75
|
return null;
|
|
71
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthPage.mjs","sources":["../../../../../../admin/src/pages/Auth/AuthPage.tsx"],"sourcesContent":["import { Navigate, useLocation, useMatch } from 'react-router-dom';\n\nimport { useAuth } from '../../features/Auth';\nimport { useEnterprise } from '../../hooks/useEnterprise';\nimport { useInitQuery } from '../../services/admin';\nimport { retryDynamicImport } from '../../utils/retryDynamicImport';\n\nimport { Login as LoginCE } from './components/Login';\nimport { FORMS, FormDictionary } from './constants';\n\n/* -------------------------------------------------------------------------------------------------\n * AuthPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst AuthPage = () => {\n const { search } = useLocation();\n const match = useMatch('/auth/:authType');\n const authType = match?.params.authType;\n const { data } = useInitQuery();\n const { hasAdmin } = data ?? {};\n const Login = useEnterprise(\n LoginCE,\n async () =>\n (\n await retryDynamicImport(\n () => import('../../../../ee/admin/src/pages/AuthPage/components/Login')\n )\n ).LoginEE\n );\n const forms = useEnterprise<FormDictionary, Partial<FormDictionary>>(\n FORMS,\n async () =>\n (await retryDynamicImport(() => import('../../../../ee/admin/src/pages/AuthPage/constants')))\n .FORMS,\n {\n combine(ceForms, eeForms) {\n return {\n ...ceForms,\n ...eeForms,\n };\n },\n defaultValue: FORMS,\n }\n );\n\n const { token } = useAuth('AuthPage', (auth) => auth);\n\n if (!authType || !forms) {\n return <Navigate to=\"/\" />;\n }\n\n const Component = forms[authType
|
|
1
|
+
{"version":3,"file":"AuthPage.mjs","sources":["../../../../../../admin/src/pages/Auth/AuthPage.tsx"],"sourcesContent":["import { Navigate, useLocation, useMatch } from 'react-router-dom';\n\nimport { useAuth } from '../../features/Auth';\nimport { useEnterprise } from '../../hooks/useEnterprise';\nimport { useInitQuery } from '../../services/admin';\nimport { retryDynamicImport } from '../../utils/retryDynamicImport';\n\nimport { Login as LoginCE } from './components/Login';\nimport { AUTH_TYPES, FORMS, FormDictionary, isAuthType } from './constants';\nimport { getRedirectTo } from './utils';\n\n/* -------------------------------------------------------------------------------------------------\n * AuthPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst AuthPage = () => {\n const { search } = useLocation();\n const match = useMatch('/auth/:authType');\n const authType = match?.params.authType;\n const { data } = useInitQuery();\n const { hasAdmin } = data ?? {};\n const Login = useEnterprise(\n LoginCE,\n async () =>\n (\n await retryDynamicImport(\n () => import('../../../../ee/admin/src/pages/AuthPage/components/Login')\n )\n ).LoginEE\n );\n const forms = useEnterprise<FormDictionary, Partial<FormDictionary>>(\n FORMS,\n async () =>\n (await retryDynamicImport(() => import('../../../../ee/admin/src/pages/AuthPage/constants')))\n .FORMS,\n {\n combine(ceForms, eeForms) {\n return {\n ...ceForms,\n ...eeForms,\n };\n },\n defaultValue: FORMS,\n }\n );\n\n const { token } = useAuth('AuthPage', (auth) => auth);\n\n if (!isAuthType(authType) || !forms) {\n return <Navigate to=\"/\" />;\n }\n\n const Component = forms[authType];\n\n // Redirect the user to the login page if\n // the endpoint does not exists\n if (!Component) {\n return <Navigate to=\"/\" />;\n }\n\n // User is already logged in\n if (authType !== AUTH_TYPES.REGISTER_ADMIN && authType !== AUTH_TYPES.REGISTER && token) {\n // Honour the `?redirectTo` the user was sent here with, otherwise logging in from a\n // deep link always lands on the home page. `login()` sets the token before the login\n // form gets to navigate, so this branch is what actually performs the redirect.\n // See https://github.com/strapi/strapi/issues/19557\n return <Navigate to={getRedirectTo(search)} />;\n }\n\n // there is already an admin user oo\n if (hasAdmin && authType === AUTH_TYPES.REGISTER_ADMIN && token) {\n return <Navigate to={getRedirectTo(search)} />;\n }\n\n // Redirect the user to the register-admin if it is the first user\n if (!hasAdmin && authType !== AUTH_TYPES.REGISTER_ADMIN) {\n return (\n <Navigate\n to={{\n pathname: `/auth/${AUTH_TYPES.REGISTER_ADMIN}`,\n // Forward the `?redirectTo` from /auth/login\n // /abc => /auth/login?redirectTo=%2Fabc => /auth/register-admin?redirectTo=%2Fabc\n search,\n }}\n />\n );\n }\n\n if (Login && authType === AUTH_TYPES.LOGIN) {\n // Assign the component to render for the login form\n return <Login />;\n } else if (authType === AUTH_TYPES.LOGIN && !Login) {\n // block rendering until the Login EE component is fully loaded\n return null;\n }\n\n return <Component hasAdmin={hasAdmin} />;\n};\n\nexport { AuthPage };\n"],"names":["AuthPage","search","useLocation","match","useMatch","authType","params","data","useInitQuery","hasAdmin","Login","useEnterprise","LoginCE","retryDynamicImport","LoginEE","forms","FORMS","combine","ceForms","eeForms","defaultValue","token","useAuth","auth","isAuthType","_jsx","Navigate","to","Component","AUTH_TYPES","REGISTER_ADMIN","REGISTER","getRedirectTo","pathname","LOGIN"],"mappings":";;;;;;;;;;AAWA;;AAEkG,2GAE5FA,QAAAA,GAAW,IAAA;IACf,MAAM,EAAEC,MAAM,EAAE,GAAGC,WAAAA,EAAAA;AACnB,IAAA,MAAMC,QAAQC,QAAAA,CAAS,iBAAA,CAAA;IACvB,MAAMC,QAAAA,GAAWF,OAAOG,MAAAA,CAAOD,QAAAA;IAC/B,MAAM,EAAEE,IAAI,EAAE,GAAGC,YAAAA,EAAAA;AACjB,IAAA,MAAM,EAAEC,QAAQ,EAAE,GAAGF,QAAQ,EAAC;AAC9B,IAAA,MAAMG,OAAAA,GAAQC,aAAAA,CACZC,KAAAA,EACA,UACE,CACE,MAAMC,kBAAAA,CACJ,IAAM,OAAO,8DAAA,CAAA,CACf,EACAC,OAAO,CAAA;AAEb,IAAA,MAAMC,KAAAA,GAAQJ,aAAAA,CACZK,KAAAA,EACA,UACE,CAAC,MAAMH,kBAAAA,CAAmB,IAAM,OAAO,uDAAA,CAAA,CAAoD,EACxFG,KAA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AAEJ,UAAAA,CAAWC,cAAc,CAAA,CAAE;;;AAG9C7B,gBAAAA;AACF;;AAGN,IAAA;AAEA,IAAA,IAAIS,OAAAA,IAASL,QAAAA,KAAawB,UAAAA,CAAWK,KAAK,EAAE;;AAE1C,QAAA,qBAAOT,GAAA,CAACf,OAAAA,EAAAA,EAAAA,CAAAA;AACV,IAAA,CAAA,MAAO,IAAIL,QAAAA,KAAawB,UAAAA,CAAWK,KAAK,IAAI,CAACxB,OAAAA,EAAO;;QAElD,OAAO,IAAA;AACT,IAAA;AAEA,IAAA,qBAAOe,GAAA,CAACG,SAAAA,EAAAA;QAAUnB,QAAAA,EAAUA;;AAC9B;;;;"}
|
|
@@ -13,6 +13,7 @@ var UnauthenticatedLogo = require('../../../components/UnauthenticatedLogo.js');
|
|
|
13
13
|
var Auth = require('../../../features/Auth.js');
|
|
14
14
|
var UnauthenticatedLayout = require('../../../layouts/UnauthenticatedLayout.js');
|
|
15
15
|
var translatedErrors = require('../../../utils/translatedErrors.js');
|
|
16
|
+
var utils = require('../utils.js');
|
|
16
17
|
|
|
17
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
19
|
|
|
@@ -50,9 +51,6 @@ const Login = ({ children })=>{
|
|
|
50
51
|
const [apiError, setApiError] = React__namespace.useState();
|
|
51
52
|
const { formatMessage } = reactIntl.useIntl();
|
|
52
53
|
const { search: searchString } = reactRouterDom.useLocation();
|
|
53
|
-
const query = React__namespace.useMemo(()=>new URLSearchParams(searchString), [
|
|
54
|
-
searchString
|
|
55
|
-
]);
|
|
56
54
|
const navigate = reactRouterDom.useNavigate();
|
|
57
55
|
const { login } = Auth.useAuth('Login', (auth)=>auth);
|
|
58
56
|
const handleLogin = async (body)=>{
|
|
@@ -66,9 +64,7 @@ const Login = ({ children })=>{
|
|
|
66
64
|
}
|
|
67
65
|
setApiError(message);
|
|
68
66
|
} else {
|
|
69
|
-
|
|
70
|
-
const redirectUrl = redirectTo ? decodeURIComponent(redirectTo) : '/';
|
|
71
|
-
navigate(redirectUrl);
|
|
67
|
+
navigate(utils.getRedirectTo(searchString));
|
|
72
68
|
}
|
|
73
69
|
};
|
|
74
70
|
return /*#__PURE__*/ jsxRuntime.jsx(UnauthenticatedLayout.UnauthenticatedLayout, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Login.js","sources":["../../../../../../../admin/src/pages/Auth/components/Login.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, Button, Flex, Main, Typography, Link } from '@strapi/design-system';\nimport camelCase from 'lodash/camelCase';\nimport { useIntl } from 'react-intl';\nimport { NavLink, useLocation, useNavigate } from 'react-router-dom';\nimport * as yup from 'yup';\n\nimport { Form } from '../../../components/Form';\nimport { InputRenderer } from '../../../components/FormInputs/Renderer';\nimport { Logo } from '../../../components/UnauthenticatedLogo';\nimport { useAuth } from '../../../features/Auth';\nimport {\n UnauthenticatedLayout,\n Column,\n LayoutContent,\n} from '../../../layouts/UnauthenticatedLayout';\nimport { translatedErrors } from '../../../utils/translatedErrors';\n\nimport type { Login } from '../../../../../shared/contracts/authentication';\n\ninterface LoginProps {\n children?: React.ReactNode;\n}\n\nconst LOGIN_SCHEMA = yup.object().shape({\n email: yup\n .string()\n .nullable()\n .email({\n id: translatedErrors.email.id,\n defaultMessage: 'Not a valid email',\n })\n .required(translatedErrors.required),\n password: yup.string().required(translatedErrors.required).nullable(),\n rememberMe: yup.bool().nullable(),\n});\n\nconst Login = ({ children }: LoginProps) => {\n const [apiError, setApiError] = React.useState<string>();\n const { formatMessage } = useIntl();\n const { search: searchString } = useLocation();\n const query = React.useMemo(() => new URLSearchParams(searchString), [searchString]);\n const navigate = useNavigate();\n\n const { login } = useAuth('Login', (auth) => auth);\n\n const handleLogin = async (body: Parameters<typeof login>[0]) => {\n setApiError(undefined);\n\n const res = await login(body);\n\n if ('error' in res) {\n const message = res.error.message ?? 'Something went wrong';\n\n if (camelCase(message).toLowerCase() === 'usernotactive') {\n navigate('/auth/oops');\n return;\n }\n\n setApiError(message);\n } else {\n const redirectTo = query.get('redirectTo');\n const redirectUrl = redirectTo ? decodeURIComponent(redirectTo) : '/';\n\n navigate(redirectUrl);\n }\n };\n\n return (\n <UnauthenticatedLayout>\n <Main>\n <LayoutContent>\n <Column>\n <Logo />\n <Box paddingTop={6} paddingBottom={1}>\n <Typography variant=\"alpha\" tag=\"h1\" textAlign=\"center\">\n {formatMessage({\n id: 'Auth.form.welcome.title',\n defaultMessage: 'Welcome!',\n })}\n </Typography>\n </Box>\n <Box paddingBottom={7}>\n <Typography\n variant=\"epsilon\"\n textColor=\"neutral600\"\n textAlign=\"center\"\n display=\"block\"\n >\n {formatMessage({\n id: 'Auth.form.welcome.subtitle',\n defaultMessage: 'Log in to your Strapi account',\n })}\n </Typography>\n </Box>\n {apiError ? (\n <Typography id=\"global-form-error\" role=\"alert\" tabIndex={-1} textColor=\"danger600\">\n {apiError}\n </Typography>\n ) : null}\n </Column>\n <Form\n method=\"PUT\"\n initialValues={{\n email: '',\n password: '',\n rememberMe: false,\n }}\n onSubmit={(values) => {\n handleLogin(values);\n }}\n validationSchema={LOGIN_SCHEMA}\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {[\n {\n label: formatMessage({ id: 'Auth.form.email.label', defaultMessage: 'Email' }),\n name: 'email',\n placeholder: formatMessage({\n id: 'Auth.form.email.placeholder',\n defaultMessage: 'kai@doe.com',\n }),\n required: true,\n type: 'email' as const,\n },\n {\n label: formatMessage({\n id: 'global.password',\n defaultMessage: 'Password',\n }),\n name: 'password',\n required: true,\n type: 'password' as const,\n },\n {\n label: formatMessage({\n id: 'Auth.form.rememberMe.label',\n defaultMessage: 'Remember me',\n }),\n name: 'rememberMe',\n type: 'checkbox' as const,\n },\n ].map((field) => (\n <InputRenderer key={field.name} {...field} />\n ))}\n <Button fullWidth type=\"submit\">\n {formatMessage({ id: 'Auth.form.button.login', defaultMessage: 'Login' })}\n </Button>\n </Flex>\n </Form>\n {children}\n </LayoutContent>\n <Flex justifyContent=\"center\">\n <Box paddingTop={4}>\n <Link isExternal={false} tag={NavLink} to=\"/auth/forgot-password\">\n {formatMessage({\n id: 'Auth.link.forgot-password',\n defaultMessage: 'Forgot your password?',\n })}\n </Link>\n </Box>\n </Flex>\n </Main>\n </UnauthenticatedLayout>\n );\n};\n\nexport { Login };\nexport type { LoginProps };\n"],"names":["LOGIN_SCHEMA","yup","object","shape","email","string","nullable","id","translatedErrors","defaultMessage","required","password","rememberMe","bool","Login","children","apiError","setApiError","React","useState","formatMessage","useIntl","search","searchString","useLocation","query","useMemo","URLSearchParams","navigate","useNavigate","login","useAuth","auth","handleLogin","body","undefined","res","message","error","camelCase","toLowerCase","redirectTo","get","redirectUrl","decodeURIComponent","_jsx","UnauthenticatedLayout","_jsxs","Main","LayoutContent","Column","Logo","Box","paddingTop","paddingBottom","Typography","variant","tag","textAlign","textColor","display","role","tabIndex","Form","method","initialValues","onSubmit","values","validationSchema","Flex","direction","alignItems","gap","label","name","placeholder","type","map","field","InputRenderer","Button","fullWidth","justifyContent","Link","isExternal","NavLink","to"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAMA,YAAAA,GAAeC,cAAAA,CAAIC,MAAM,EAAA,CAAGC,KAAK,CAAC;AACtCC,IAAAA,KAAAA,EAAOH,eACJI,MAAM,EAAA,CACNC,QAAQ,EAAA,CACRF,KAAK,CAAC;QACLG,EAAAA,EAAIC,iCAAAA,CAAiBJ,KAAK,CAACG,EAAE;QAC7BE,cAAAA,EAAgB;KAClB,CAAA,CACCC,QAAQ,CAACF,iCAAAA,CAAiBE,QAAQ,CAAA;IACrCC,QAAAA,EAAUV,cAAAA,CAAII,MAAM,EAAA,CAAGK,QAAQ,CAACF,iCAAAA,CAAiBE,QAAQ,EAAEJ,QAAQ,EAAA;IACnEM,UAAAA,EAAYX,cAAAA,CAAIY,IAAI,EAAA,CAAGP,QAAQ;AACjC,CAAA,CAAA;AAEA,M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AACmC,mBAAAA,EAAAA;wCAAOC,SAAS,EAAA,IAAA;wCAACL,IAAAA,EAAK,QAAA;kDACpBxD,aAAAA,CAAc;4CAAEb,EAAAA,EAAI,wBAAA;4CAA0BE,cAAAA,EAAgB;AAAQ,yCAAA;;;;;AAI5EM,wBAAAA;;;8BAEH8B,cAAA,CAACwB,iBAAAA,EAAAA;oBAAKa,cAAAA,EAAe,QAAA;AACnB,oBAAA,QAAA,gBAAArC,cAAA,CAACO,gBAAAA,EAAAA;wBAAIC,UAAAA,EAAY,CAAA;AACf,wBAAA,QAAA,gBAAAR,cAAA,CAACsC,iBAAAA,EAAAA;4BAAKC,UAAAA,EAAY,KAAA;4BAAO3B,GAAAA,EAAK4B,sBAAAA;4BAASC,EAAAA,EAAG,uBAAA;sCACvClE,aAAAA,CAAc;gCACbb,EAAAA,EAAI,2BAAA;gCACJE,cAAAA,EAAgB;AAClB,6BAAA;;;;;;;AAOd;;;;"}
|
|
1
|
+
{"version":3,"file":"Login.js","sources":["../../../../../../../admin/src/pages/Auth/components/Login.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, Button, Flex, Main, Typography, Link } from '@strapi/design-system';\nimport camelCase from 'lodash/camelCase';\nimport { useIntl } from 'react-intl';\nimport { NavLink, useLocation, useNavigate } from 'react-router-dom';\nimport * as yup from 'yup';\n\nimport { Form } from '../../../components/Form';\nimport { InputRenderer } from '../../../components/FormInputs/Renderer';\nimport { Logo } from '../../../components/UnauthenticatedLogo';\nimport { useAuth } from '../../../features/Auth';\nimport {\n UnauthenticatedLayout,\n Column,\n LayoutContent,\n} from '../../../layouts/UnauthenticatedLayout';\nimport { translatedErrors } from '../../../utils/translatedErrors';\nimport { getRedirectTo } from '../utils';\n\nimport type { Login } from '../../../../../shared/contracts/authentication';\n\ninterface LoginProps {\n children?: React.ReactNode;\n}\n\nconst LOGIN_SCHEMA = yup.object().shape({\n email: yup\n .string()\n .nullable()\n .email({\n id: translatedErrors.email.id,\n defaultMessage: 'Not a valid email',\n })\n .required(translatedErrors.required),\n password: yup.string().required(translatedErrors.required).nullable(),\n rememberMe: yup.bool().nullable(),\n});\n\nconst Login = ({ children }: LoginProps) => {\n const [apiError, setApiError] = React.useState<string>();\n const { formatMessage } = useIntl();\n const { search: searchString } = useLocation();\n const navigate = useNavigate();\n\n const { login } = useAuth('Login', (auth) => auth);\n\n const handleLogin = async (body: Parameters<typeof login>[0]) => {\n setApiError(undefined);\n\n const res = await login(body);\n\n if ('error' in res) {\n const message = res.error.message ?? 'Something went wrong';\n\n if (camelCase(message).toLowerCase() === 'usernotactive') {\n navigate('/auth/oops');\n return;\n }\n\n setApiError(message);\n } else {\n navigate(getRedirectTo(searchString));\n }\n };\n\n return (\n <UnauthenticatedLayout>\n <Main>\n <LayoutContent>\n <Column>\n <Logo />\n <Box paddingTop={6} paddingBottom={1}>\n <Typography variant=\"alpha\" tag=\"h1\" textAlign=\"center\">\n {formatMessage({\n id: 'Auth.form.welcome.title',\n defaultMessage: 'Welcome!',\n })}\n </Typography>\n </Box>\n <Box paddingBottom={7}>\n <Typography\n variant=\"epsilon\"\n textColor=\"neutral600\"\n textAlign=\"center\"\n display=\"block\"\n >\n {formatMessage({\n id: 'Auth.form.welcome.subtitle',\n defaultMessage: 'Log in to your Strapi account',\n })}\n </Typography>\n </Box>\n {apiError ? (\n <Typography id=\"global-form-error\" role=\"alert\" tabIndex={-1} textColor=\"danger600\">\n {apiError}\n </Typography>\n ) : null}\n </Column>\n <Form\n method=\"PUT\"\n initialValues={{\n email: '',\n password: '',\n rememberMe: false,\n }}\n onSubmit={(values) => {\n handleLogin(values);\n }}\n validationSchema={LOGIN_SCHEMA}\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {[\n {\n label: formatMessage({ id: 'Auth.form.email.label', defaultMessage: 'Email' }),\n name: 'email',\n placeholder: formatMessage({\n id: 'Auth.form.email.placeholder',\n defaultMessage: 'kai@doe.com',\n }),\n required: true,\n type: 'email' as const,\n },\n {\n label: formatMessage({\n id: 'global.password',\n defaultMessage: 'Password',\n }),\n name: 'password',\n required: true,\n type: 'password' as const,\n },\n {\n label: formatMessage({\n id: 'Auth.form.rememberMe.label',\n defaultMessage: 'Remember me',\n }),\n name: 'rememberMe',\n type: 'checkbox' as const,\n },\n ].map((field) => (\n <InputRenderer key={field.name} {...field} />\n ))}\n <Button fullWidth type=\"submit\">\n {formatMessage({ id: 'Auth.form.button.login', defaultMessage: 'Login' })}\n </Button>\n </Flex>\n </Form>\n {children}\n </LayoutContent>\n <Flex justifyContent=\"center\">\n <Box paddingTop={4}>\n <Link isExternal={false} tag={NavLink} to=\"/auth/forgot-password\">\n {formatMessage({\n id: 'Auth.link.forgot-password',\n defaultMessage: 'Forgot your password?',\n })}\n </Link>\n </Box>\n </Flex>\n </Main>\n </UnauthenticatedLayout>\n );\n};\n\nexport { Login };\nexport type { LoginProps };\n"],"names":["LOGIN_SCHEMA","yup","object","shape","email","string","nullable","id","translatedErrors","defaultMessage","required","password","rememberMe","bool","Login","children","apiError","setApiError","React","useState","formatMessage","useIntl","search","searchString","useLocation","navigate","useNavigate","login","useAuth","auth","handleLogin","body","undefined","res","message","error","camelCase","toLowerCase","getRedirectTo","_jsx","UnauthenticatedLayout","_jsxs","Main","LayoutContent","Column","Logo","Box","paddingTop","paddingBottom","Typography","variant","tag","textAlign","textColor","display","role","tabIndex","Form","method","initialValues","onSubmit","values","validationSchema","Flex","direction","alignItems","gap","label","name","placeholder","type","map","field","InputRenderer","Button","fullWidth","justifyContent","Link","isExternal","NavLink","to"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,YAAAA,GAAeC,cAAAA,CAAIC,MAAM,EAAA,CAAGC,KAAK,CAAC;AACtCC,IAAAA,KAAAA,EAAOH,eACJI,MAAM,EAAA,CACNC,QAAQ,EAAA,CACRF,KAAK,CAAC;QACLG,EAAAA,EAAIC,iCAAAA,CAAiBJ,KAAK,CAACG,EAAE;QAC7BE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AA;kDAEhC7B,cAAA,CAACmC,mBAAAA,EAAAA;wCAAOC,SAAS,EAAA,IAAA;wCAACL,IAAAA,EAAK,QAAA;kDACpBlD,aAAAA,CAAc;4CAAEb,EAAAA,EAAI,wBAAA;4CAA0BE,cAAAA,EAAgB;AAAQ,yCAAA;;;;;AAI5EM,wBAAAA;;;8BAEHwB,cAAA,CAACwB,iBAAAA,EAAAA;oBAAKa,cAAAA,EAAe,QAAA;AACnB,oBAAA,QAAA,gBAAArC,cAAA,CAACO,gBAAAA,EAAAA;wBAAIC,UAAAA,EAAY,CAAA;AACf,wBAAA,QAAA,gBAAAR,cAAA,CAACsC,iBAAAA,EAAAA;4BAAKC,UAAAA,EAAY,KAAA;4BAAO3B,GAAAA,EAAK4B,sBAAAA;4BAASC,EAAAA,EAAG,uBAAA;sCACvC5D,aAAAA,CAAc;gCACbb,EAAAA,EAAI,2BAAA;gCACJE,cAAAA,EAAgB;AAClB,6BAAA;;;;;;;AAOd;;;;"}
|
|
@@ -11,6 +11,7 @@ import { Logo } from '../../../components/UnauthenticatedLogo.mjs';
|
|
|
11
11
|
import { useAuth } from '../../../features/Auth.mjs';
|
|
12
12
|
import { UnauthenticatedLayout, LayoutContent, Column } from '../../../layouts/UnauthenticatedLayout.mjs';
|
|
13
13
|
import { translatedErrors as errorsTrads } from '../../../utils/translatedErrors.mjs';
|
|
14
|
+
import { getRedirectTo } from '../utils.mjs';
|
|
14
15
|
|
|
15
16
|
const LOGIN_SCHEMA = yup.object().shape({
|
|
16
17
|
email: yup.string().nullable().email({
|
|
@@ -24,9 +25,6 @@ const Login = ({ children })=>{
|
|
|
24
25
|
const [apiError, setApiError] = React.useState();
|
|
25
26
|
const { formatMessage } = useIntl();
|
|
26
27
|
const { search: searchString } = useLocation();
|
|
27
|
-
const query = React.useMemo(()=>new URLSearchParams(searchString), [
|
|
28
|
-
searchString
|
|
29
|
-
]);
|
|
30
28
|
const navigate = useNavigate();
|
|
31
29
|
const { login } = useAuth('Login', (auth)=>auth);
|
|
32
30
|
const handleLogin = async (body)=>{
|
|
@@ -40,9 +38,7 @@ const Login = ({ children })=>{
|
|
|
40
38
|
}
|
|
41
39
|
setApiError(message);
|
|
42
40
|
} else {
|
|
43
|
-
|
|
44
|
-
const redirectUrl = redirectTo ? decodeURIComponent(redirectTo) : '/';
|
|
45
|
-
navigate(redirectUrl);
|
|
41
|
+
navigate(getRedirectTo(searchString));
|
|
46
42
|
}
|
|
47
43
|
};
|
|
48
44
|
return /*#__PURE__*/ jsx(UnauthenticatedLayout, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Login.mjs","sources":["../../../../../../../admin/src/pages/Auth/components/Login.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, Button, Flex, Main, Typography, Link } from '@strapi/design-system';\nimport camelCase from 'lodash/camelCase';\nimport { useIntl } from 'react-intl';\nimport { NavLink, useLocation, useNavigate } from 'react-router-dom';\nimport * as yup from 'yup';\n\nimport { Form } from '../../../components/Form';\nimport { InputRenderer } from '../../../components/FormInputs/Renderer';\nimport { Logo } from '../../../components/UnauthenticatedLogo';\nimport { useAuth } from '../../../features/Auth';\nimport {\n UnauthenticatedLayout,\n Column,\n LayoutContent,\n} from '../../../layouts/UnauthenticatedLayout';\nimport { translatedErrors } from '../../../utils/translatedErrors';\n\nimport type { Login } from '../../../../../shared/contracts/authentication';\n\ninterface LoginProps {\n children?: React.ReactNode;\n}\n\nconst LOGIN_SCHEMA = yup.object().shape({\n email: yup\n .string()\n .nullable()\n .email({\n id: translatedErrors.email.id,\n defaultMessage: 'Not a valid email',\n })\n .required(translatedErrors.required),\n password: yup.string().required(translatedErrors.required).nullable(),\n rememberMe: yup.bool().nullable(),\n});\n\nconst Login = ({ children }: LoginProps) => {\n const [apiError, setApiError] = React.useState<string>();\n const { formatMessage } = useIntl();\n const { search: searchString } = useLocation();\n const query = React.useMemo(() => new URLSearchParams(searchString), [searchString]);\n const navigate = useNavigate();\n\n const { login } = useAuth('Login', (auth) => auth);\n\n const handleLogin = async (body: Parameters<typeof login>[0]) => {\n setApiError(undefined);\n\n const res = await login(body);\n\n if ('error' in res) {\n const message = res.error.message ?? 'Something went wrong';\n\n if (camelCase(message).toLowerCase() === 'usernotactive') {\n navigate('/auth/oops');\n return;\n }\n\n setApiError(message);\n } else {\n const redirectTo = query.get('redirectTo');\n const redirectUrl = redirectTo ? decodeURIComponent(redirectTo) : '/';\n\n navigate(redirectUrl);\n }\n };\n\n return (\n <UnauthenticatedLayout>\n <Main>\n <LayoutContent>\n <Column>\n <Logo />\n <Box paddingTop={6} paddingBottom={1}>\n <Typography variant=\"alpha\" tag=\"h1\" textAlign=\"center\">\n {formatMessage({\n id: 'Auth.form.welcome.title',\n defaultMessage: 'Welcome!',\n })}\n </Typography>\n </Box>\n <Box paddingBottom={7}>\n <Typography\n variant=\"epsilon\"\n textColor=\"neutral600\"\n textAlign=\"center\"\n display=\"block\"\n >\n {formatMessage({\n id: 'Auth.form.welcome.subtitle',\n defaultMessage: 'Log in to your Strapi account',\n })}\n </Typography>\n </Box>\n {apiError ? (\n <Typography id=\"global-form-error\" role=\"alert\" tabIndex={-1} textColor=\"danger600\">\n {apiError}\n </Typography>\n ) : null}\n </Column>\n <Form\n method=\"PUT\"\n initialValues={{\n email: '',\n password: '',\n rememberMe: false,\n }}\n onSubmit={(values) => {\n handleLogin(values);\n }}\n validationSchema={LOGIN_SCHEMA}\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {[\n {\n label: formatMessage({ id: 'Auth.form.email.label', defaultMessage: 'Email' }),\n name: 'email',\n placeholder: formatMessage({\n id: 'Auth.form.email.placeholder',\n defaultMessage: 'kai@doe.com',\n }),\n required: true,\n type: 'email' as const,\n },\n {\n label: formatMessage({\n id: 'global.password',\n defaultMessage: 'Password',\n }),\n name: 'password',\n required: true,\n type: 'password' as const,\n },\n {\n label: formatMessage({\n id: 'Auth.form.rememberMe.label',\n defaultMessage: 'Remember me',\n }),\n name: 'rememberMe',\n type: 'checkbox' as const,\n },\n ].map((field) => (\n <InputRenderer key={field.name} {...field} />\n ))}\n <Button fullWidth type=\"submit\">\n {formatMessage({ id: 'Auth.form.button.login', defaultMessage: 'Login' })}\n </Button>\n </Flex>\n </Form>\n {children}\n </LayoutContent>\n <Flex justifyContent=\"center\">\n <Box paddingTop={4}>\n <Link isExternal={false} tag={NavLink} to=\"/auth/forgot-password\">\n {formatMessage({\n id: 'Auth.link.forgot-password',\n defaultMessage: 'Forgot your password?',\n })}\n </Link>\n </Box>\n </Flex>\n </Main>\n </UnauthenticatedLayout>\n );\n};\n\nexport { Login };\nexport type { LoginProps };\n"],"names":["LOGIN_SCHEMA","yup","object","shape","email","string","nullable","id","translatedErrors","defaultMessage","required","password","rememberMe","bool","Login","children","apiError","setApiError","React","useState","formatMessage","useIntl","search","searchString","useLocation","query","useMemo","URLSearchParams","navigate","useNavigate","login","useAuth","auth","handleLogin","body","undefined","res","message","error","camelCase","toLowerCase","redirectTo","get","redirectUrl","decodeURIComponent","_jsx","UnauthenticatedLayout","_jsxs","Main","LayoutContent","Column","Logo","Box","paddingTop","paddingBottom","Typography","variant","tag","textAlign","textColor","display","role","tabIndex","Form","method","initialValues","onSubmit","values","validationSchema","Flex","direction","alignItems","gap","label","name","placeholder","type","map","field","InputRenderer","Button","fullWidth","justifyContent","Link","isExternal","NavLink","to"],"mappings":";;;;;;;;;;;;;;AAyBA,MAAMA,YAAAA,GAAeC,GAAAA,CAAIC,MAAM,EAAA,CAAGC,KAAK,CAAC;AACtCC,IAAAA,KAAAA,EAAOH,IACJI,MAAM,EAAA,CACNC,QAAQ,EAAA,CACRF,KAAK,CAAC;QACLG,EAAAA,EAAIC,WAAAA,CAAiBJ,KAAK,CAACG,EAAE;QAC7BE,cAAAA,EAAgB;KAClB,CAAA,CACCC,QAAQ,CAACF,WAAAA,CAAiBE,QAAQ,CAAA;IACrCC,QAAAA,EAAUV,GAAAA,CAAII,MAAM,EAAA,CAAGK,QAAQ,CAACF,WAA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AAA,EAAAA;AAAgC,4CAAA,GAAGD;AAAhBA,yCAAAA,EAAAA,KAAAA,CAAMJ,IAAI,CAAA,CAAA;kDAEhC7B,GAAA,CAACmC,MAAAA,EAAAA;wCAAOC,SAAS,EAAA,IAAA;wCAACL,IAAAA,EAAK,QAAA;kDACpBxD,aAAAA,CAAc;4CAAEb,EAAAA,EAAI,wBAAA;4CAA0BE,cAAAA,EAAgB;AAAQ,yCAAA;;;;;AAI5EM,wBAAAA;;;8BAEH8B,GAAA,CAACwB,IAAAA,EAAAA;oBAAKa,cAAAA,EAAe,QAAA;AACnB,oBAAA,QAAA,gBAAArC,GAAA,CAACO,GAAAA,EAAAA;wBAAIC,UAAAA,EAAY,CAAA;AACf,wBAAA,QAAA,gBAAAR,GAAA,CAACsC,IAAAA,EAAAA;4BAAKC,UAAAA,EAAY,KAAA;4BAAO3B,GAAAA,EAAK4B,OAAAA;4BAASC,EAAAA,EAAG,uBAAA;sCACvClE,aAAAA,CAAc;gCACbb,EAAAA,EAAI,2BAAA;gCACJE,cAAAA,EAAgB;AAClB,6BAAA;;;;;;;AAOd;;;;"}
|
|
1
|
+
{"version":3,"file":"Login.mjs","sources":["../../../../../../../admin/src/pages/Auth/components/Login.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Box, Button, Flex, Main, Typography, Link } from '@strapi/design-system';\nimport camelCase from 'lodash/camelCase';\nimport { useIntl } from 'react-intl';\nimport { NavLink, useLocation, useNavigate } from 'react-router-dom';\nimport * as yup from 'yup';\n\nimport { Form } from '../../../components/Form';\nimport { InputRenderer } from '../../../components/FormInputs/Renderer';\nimport { Logo } from '../../../components/UnauthenticatedLogo';\nimport { useAuth } from '../../../features/Auth';\nimport {\n UnauthenticatedLayout,\n Column,\n LayoutContent,\n} from '../../../layouts/UnauthenticatedLayout';\nimport { translatedErrors } from '../../../utils/translatedErrors';\nimport { getRedirectTo } from '../utils';\n\nimport type { Login } from '../../../../../shared/contracts/authentication';\n\ninterface LoginProps {\n children?: React.ReactNode;\n}\n\nconst LOGIN_SCHEMA = yup.object().shape({\n email: yup\n .string()\n .nullable()\n .email({\n id: translatedErrors.email.id,\n defaultMessage: 'Not a valid email',\n })\n .required(translatedErrors.required),\n password: yup.string().required(translatedErrors.required).nullable(),\n rememberMe: yup.bool().nullable(),\n});\n\nconst Login = ({ children }: LoginProps) => {\n const [apiError, setApiError] = React.useState<string>();\n const { formatMessage } = useIntl();\n const { search: searchString } = useLocation();\n const navigate = useNavigate();\n\n const { login } = useAuth('Login', (auth) => auth);\n\n const handleLogin = async (body: Parameters<typeof login>[0]) => {\n setApiError(undefined);\n\n const res = await login(body);\n\n if ('error' in res) {\n const message = res.error.message ?? 'Something went wrong';\n\n if (camelCase(message).toLowerCase() === 'usernotactive') {\n navigate('/auth/oops');\n return;\n }\n\n setApiError(message);\n } else {\n navigate(getRedirectTo(searchString));\n }\n };\n\n return (\n <UnauthenticatedLayout>\n <Main>\n <LayoutContent>\n <Column>\n <Logo />\n <Box paddingTop={6} paddingBottom={1}>\n <Typography variant=\"alpha\" tag=\"h1\" textAlign=\"center\">\n {formatMessage({\n id: 'Auth.form.welcome.title',\n defaultMessage: 'Welcome!',\n })}\n </Typography>\n </Box>\n <Box paddingBottom={7}>\n <Typography\n variant=\"epsilon\"\n textColor=\"neutral600\"\n textAlign=\"center\"\n display=\"block\"\n >\n {formatMessage({\n id: 'Auth.form.welcome.subtitle',\n defaultMessage: 'Log in to your Strapi account',\n })}\n </Typography>\n </Box>\n {apiError ? (\n <Typography id=\"global-form-error\" role=\"alert\" tabIndex={-1} textColor=\"danger600\">\n {apiError}\n </Typography>\n ) : null}\n </Column>\n <Form\n method=\"PUT\"\n initialValues={{\n email: '',\n password: '',\n rememberMe: false,\n }}\n onSubmit={(values) => {\n handleLogin(values);\n }}\n validationSchema={LOGIN_SCHEMA}\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {[\n {\n label: formatMessage({ id: 'Auth.form.email.label', defaultMessage: 'Email' }),\n name: 'email',\n placeholder: formatMessage({\n id: 'Auth.form.email.placeholder',\n defaultMessage: 'kai@doe.com',\n }),\n required: true,\n type: 'email' as const,\n },\n {\n label: formatMessage({\n id: 'global.password',\n defaultMessage: 'Password',\n }),\n name: 'password',\n required: true,\n type: 'password' as const,\n },\n {\n label: formatMessage({\n id: 'Auth.form.rememberMe.label',\n defaultMessage: 'Remember me',\n }),\n name: 'rememberMe',\n type: 'checkbox' as const,\n },\n ].map((field) => (\n <InputRenderer key={field.name} {...field} />\n ))}\n <Button fullWidth type=\"submit\">\n {formatMessage({ id: 'Auth.form.button.login', defaultMessage: 'Login' })}\n </Button>\n </Flex>\n </Form>\n {children}\n </LayoutContent>\n <Flex justifyContent=\"center\">\n <Box paddingTop={4}>\n <Link isExternal={false} tag={NavLink} to=\"/auth/forgot-password\">\n {formatMessage({\n id: 'Auth.link.forgot-password',\n defaultMessage: 'Forgot your password?',\n })}\n </Link>\n </Box>\n </Flex>\n </Main>\n </UnauthenticatedLayout>\n );\n};\n\nexport { Login };\nexport type { LoginProps };\n"],"names":["LOGIN_SCHEMA","yup","object","shape","email","string","nullable","id","translatedErrors","defaultMessage","required","password","rememberMe","bool","Login","children","apiError","setApiError","React","useState","formatMessage","useIntl","search","searchString","useLocation","navigate","useNavigate","login","useAuth","auth","handleLogin","body","undefined","res","message","error","camelCase","toLowerCase","getRedirectTo","_jsx","UnauthenticatedLayout","_jsxs","Main","LayoutContent","Column","Logo","Box","paddingTop","paddingBottom","Typography","variant","tag","textAlign","textColor","display","role","tabIndex","Form","method","initialValues","onSubmit","values","validationSchema","Flex","direction","alignItems","gap","label","name","placeholder","type","map","field","InputRenderer","Button","fullWidth","justifyContent","Link","isExternal","NavLink","to"],"mappings":";;;;;;;;;;;;;;;AA0BA,MAAMA,YAAAA,GAAeC,GAAAA,CAAIC,MAAM,EAAA,CAAGC,KAAK,CAAC;AACtCC,IAAAA,KAAAA,EAAOH,IACJI,MAAM,EAAA,CACNC,QAAQ,EAAA,CACRF,K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AhBA,yCAAAA,EAAAA,KAAAA,CAAMJ,IAAI,CAAA,CAAA;kDAEhC7B,GAAA,CAACmC,MAAAA,EAAAA;wCAAOC,SAAS,EAAA,IAAA;wCAACL,IAAAA,EAAK,QAAA;kDACpBlD,aAAAA,CAAc;4CAAEb,EAAAA,EAAI,wBAAA;4CAA0BE,cAAAA,EAAgB;AAAQ,yCAAA;;;;;AAI5EM,wBAAAA;;;8BAEHwB,GAAA,CAACwB,IAAAA,EAAAA;oBAAKa,cAAAA,EAAe,QAAA;AACnB,oBAAA,QAAA,gBAAArC,GAAA,CAACO,GAAAA,EAAAA;wBAAIC,UAAAA,EAAY,CAAA;AACf,wBAAA,QAAA,gBAAAR,GAAA,CAACsC,IAAAA,EAAAA;4BAAKC,UAAAA,EAAY,KAAA;4BAAO3B,GAAAA,EAAK4B,OAAAA;4BAASC,EAAAA,EAAG,uBAAA;sCACvC5D,aAAAA,CAAc;gCACbb,EAAAA,EAAI,2BAAA;gCACJE,cAAAA,EAAgB;AAClB,6BAAA;;;;;;;AAOd;;;;"}
|
|
@@ -6,18 +6,34 @@ var Oops = require('./components/Oops.js');
|
|
|
6
6
|
var Register = require('./components/Register.js');
|
|
7
7
|
var ResetPassword = require('./components/ResetPassword.js');
|
|
8
8
|
|
|
9
|
+
const AUTH_TYPES = {
|
|
10
|
+
LOGIN: 'login',
|
|
11
|
+
REGISTER: 'register',
|
|
12
|
+
REGISTER_ADMIN: 'register-admin',
|
|
13
|
+
FORGOT_PASSWORD: 'forgot-password',
|
|
14
|
+
RESET_PASSWORD: 'reset-password',
|
|
15
|
+
FORGOT_PASSWORD_SUCCESS: 'forgot-password-success',
|
|
16
|
+
OOPS: 'oops',
|
|
17
|
+
PROVIDERS: 'providers'
|
|
18
|
+
};
|
|
19
|
+
const AUTH_TYPE_VALUES = Object.values(AUTH_TYPES);
|
|
20
|
+
/**
|
|
21
|
+
* Narrows the `:authType` route param, which is an arbitrary string, to a known auth type.
|
|
22
|
+
*/ const isAuthType = (value)=>value !== undefined && AUTH_TYPE_VALUES.includes(value);
|
|
9
23
|
const FORMS = {
|
|
10
|
-
|
|
11
|
-
|
|
24
|
+
[AUTH_TYPES.FORGOT_PASSWORD]: ForgotPassword.ForgotPassword,
|
|
25
|
+
[AUTH_TYPES.FORGOT_PASSWORD_SUCCESS]: ForgotPasswordSuccess.ForgotPasswordSuccess,
|
|
12
26
|
// the `Component` attribute is set after all forms and CE/EE components are loaded, but since we
|
|
13
27
|
// are here outside of a React component we can not use the hook directly
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
[AUTH_TYPES.LOGIN]: ()=>null,
|
|
29
|
+
[AUTH_TYPES.OOPS]: Oops.Oops,
|
|
30
|
+
[AUTH_TYPES.REGISTER]: Register.Register,
|
|
31
|
+
[AUTH_TYPES.REGISTER_ADMIN]: Register.Register,
|
|
32
|
+
[AUTH_TYPES.RESET_PASSWORD]: ResetPassword.ResetPassword,
|
|
33
|
+
[AUTH_TYPES.PROVIDERS]: ()=>null
|
|
20
34
|
};
|
|
21
35
|
|
|
36
|
+
exports.AUTH_TYPES = AUTH_TYPES;
|
|
22
37
|
exports.FORMS = FORMS;
|
|
38
|
+
exports.isAuthType = isAuthType;
|
|
23
39
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../../../admin/src/pages/Auth/constants.ts"],"sourcesContent":["import type { ComponentType } from 'react';\n\nimport { ForgotPassword } from './components/ForgotPassword';\nimport { ForgotPasswordSuccess } from './components/ForgotPasswordSuccess';\nimport { Oops } from './components/Oops';\nimport { Register, RegisterProps } from './components/Register';\nimport { ResetPassword } from './components/ResetPassword';\n\nexport
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../../admin/src/pages/Auth/constants.ts"],"sourcesContent":["import type { ComponentType } from 'react';\n\nimport { ForgotPassword } from './components/ForgotPassword';\nimport { ForgotPasswordSuccess } from './components/ForgotPasswordSuccess';\nimport { Oops } from './components/Oops';\nimport { Register, RegisterProps } from './components/Register';\nimport { ResetPassword } from './components/ResetPassword';\n\nexport const AUTH_TYPES = {\n LOGIN: 'login',\n REGISTER: 'register',\n REGISTER_ADMIN: 'register-admin',\n FORGOT_PASSWORD: 'forgot-password',\n RESET_PASSWORD: 'reset-password',\n FORGOT_PASSWORD_SUCCESS: 'forgot-password-success',\n OOPS: 'oops',\n PROVIDERS: 'providers',\n} as const;\n\nexport type AuthType = (typeof AUTH_TYPES)[keyof typeof AUTH_TYPES];\n\nconst AUTH_TYPE_VALUES: readonly string[] = Object.values(AUTH_TYPES);\n\n/**\n * Narrows the `:authType` route param, which is an arbitrary string, to a known auth type.\n */\nexport const isAuthType = (value: string | undefined): value is AuthType =>\n value !== undefined && AUTH_TYPE_VALUES.includes(value);\n\nexport type FormDictionary = Record<AuthType, ComponentType | ComponentType<RegisterProps>>;\n\nexport const FORMS = {\n [AUTH_TYPES.FORGOT_PASSWORD]: ForgotPassword,\n [AUTH_TYPES.FORGOT_PASSWORD_SUCCESS]: ForgotPasswordSuccess,\n // the `Component` attribute is set after all forms and CE/EE components are loaded, but since we\n // are here outside of a React component we can not use the hook directly\n [AUTH_TYPES.LOGIN]: () => null,\n [AUTH_TYPES.OOPS]: Oops,\n [AUTH_TYPES.REGISTER]: Register,\n [AUTH_TYPES.REGISTER_ADMIN]: Register,\n [AUTH_TYPES.RESET_PASSWORD]: ResetPassword,\n [AUTH_TYPES.PROVIDERS]: () => null,\n} satisfies FormDictionary;\n"],"names":["AUTH_TYPES","LOGIN","REGISTER","REGISTER_ADMIN","FORGOT_PASSWORD","RESET_PASSWORD","FORGOT_PASSWORD_SUCCESS","OOPS","PROVIDERS","AUTH_TYPE_VALUES","Object","values","isAuthType","value","undefined","includes","FORMS","ForgotPassword","ForgotPasswordSuccess","Oops","Register","ResetPassword"],"mappings":";;;;;;;;MAQaA,UAAAA,GAAa;IACxBC,KAAAA,EAAO,OAAA;IACPC,QAAAA,EAAU,UAAA;IACVC,cAAAA,EAAgB,gBAAA;IAChBC,eAAAA,EAAiB,iBAAA;IACjBC,cAAAA,EAAgB,gBAAA;IAChBC,uBAAAA,EAAyB,yBAAA;IACzBC,IAAAA,EAAM,MAAA;IACNC,SAAAA,EAAW;AACb;AAIA,MAAMC,gBAAAA,GAAsCC,MAAAA,CAAOC,MAAM,CAACX,UAAAA,CAAAA;AAE1D;;IAGO,MAAMY,UAAAA,GAAa,CAACC,KAAAA,GACzBA,UAAUC,SAAAA,IAAaL,gBAAAA,CAAiBM,QAAQ,CAACF,KAAAA;MAItCG,KAAAA,GAAQ;IACnB,CAAChB,UAAAA,CAAWI,eAAe,GAAGa,6BAAAA;IAC9B,CAACjB,UAAAA,CAAWM,uBAAuB,GAAGY,2CAAAA;;;AAGtC,IAAA,CAAClB,UAAAA,CAAWC,KAAK,GAAG,IAAM,IAAA;IAC1B,CAACD,UAAAA,CAAWO,IAAI,GAAGY,SAAAA;IACnB,CAACnB,UAAAA,CAAWE,QAAQ,GAAGkB,iBAAAA;IACvB,CAACpB,UAAAA,CAAWG,cAAc,GAAGiB,iBAAAA;IAC7B,CAACpB,UAAAA,CAAWK,cAAc,GAAGgB,2BAAAA;AAC7B,IAAA,CAACrB,UAAAA,CAAWQ,SAAS,GAAG,IAAM;AAChC;;;;;;"}
|
|
@@ -4,18 +4,32 @@ import { Oops } from './components/Oops.mjs';
|
|
|
4
4
|
import { Register } from './components/Register.mjs';
|
|
5
5
|
import { ResetPassword } from './components/ResetPassword.mjs';
|
|
6
6
|
|
|
7
|
+
const AUTH_TYPES = {
|
|
8
|
+
LOGIN: 'login',
|
|
9
|
+
REGISTER: 'register',
|
|
10
|
+
REGISTER_ADMIN: 'register-admin',
|
|
11
|
+
FORGOT_PASSWORD: 'forgot-password',
|
|
12
|
+
RESET_PASSWORD: 'reset-password',
|
|
13
|
+
FORGOT_PASSWORD_SUCCESS: 'forgot-password-success',
|
|
14
|
+
OOPS: 'oops',
|
|
15
|
+
PROVIDERS: 'providers'
|
|
16
|
+
};
|
|
17
|
+
const AUTH_TYPE_VALUES = Object.values(AUTH_TYPES);
|
|
18
|
+
/**
|
|
19
|
+
* Narrows the `:authType` route param, which is an arbitrary string, to a known auth type.
|
|
20
|
+
*/ const isAuthType = (value)=>value !== undefined && AUTH_TYPE_VALUES.includes(value);
|
|
7
21
|
const FORMS = {
|
|
8
|
-
|
|
9
|
-
|
|
22
|
+
[AUTH_TYPES.FORGOT_PASSWORD]: ForgotPassword,
|
|
23
|
+
[AUTH_TYPES.FORGOT_PASSWORD_SUCCESS]: ForgotPasswordSuccess,
|
|
10
24
|
// the `Component` attribute is set after all forms and CE/EE components are loaded, but since we
|
|
11
25
|
// are here outside of a React component we can not use the hook directly
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
26
|
+
[AUTH_TYPES.LOGIN]: ()=>null,
|
|
27
|
+
[AUTH_TYPES.OOPS]: Oops,
|
|
28
|
+
[AUTH_TYPES.REGISTER]: Register,
|
|
29
|
+
[AUTH_TYPES.REGISTER_ADMIN]: Register,
|
|
30
|
+
[AUTH_TYPES.RESET_PASSWORD]: ResetPassword,
|
|
31
|
+
[AUTH_TYPES.PROVIDERS]: ()=>null
|
|
18
32
|
};
|
|
19
33
|
|
|
20
|
-
export { FORMS };
|
|
34
|
+
export { AUTH_TYPES, FORMS, isAuthType };
|
|
21
35
|
//# sourceMappingURL=constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","sources":["../../../../../../admin/src/pages/Auth/constants.ts"],"sourcesContent":["import type { ComponentType } from 'react';\n\nimport { ForgotPassword } from './components/ForgotPassword';\nimport { ForgotPasswordSuccess } from './components/ForgotPasswordSuccess';\nimport { Oops } from './components/Oops';\nimport { Register, RegisterProps } from './components/Register';\nimport { ResetPassword } from './components/ResetPassword';\n\nexport
|
|
1
|
+
{"version":3,"file":"constants.mjs","sources":["../../../../../../admin/src/pages/Auth/constants.ts"],"sourcesContent":["import type { ComponentType } from 'react';\n\nimport { ForgotPassword } from './components/ForgotPassword';\nimport { ForgotPasswordSuccess } from './components/ForgotPasswordSuccess';\nimport { Oops } from './components/Oops';\nimport { Register, RegisterProps } from './components/Register';\nimport { ResetPassword } from './components/ResetPassword';\n\nexport const AUTH_TYPES = {\n LOGIN: 'login',\n REGISTER: 'register',\n REGISTER_ADMIN: 'register-admin',\n FORGOT_PASSWORD: 'forgot-password',\n RESET_PASSWORD: 'reset-password',\n FORGOT_PASSWORD_SUCCESS: 'forgot-password-success',\n OOPS: 'oops',\n PROVIDERS: 'providers',\n} as const;\n\nexport type AuthType = (typeof AUTH_TYPES)[keyof typeof AUTH_TYPES];\n\nconst AUTH_TYPE_VALUES: readonly string[] = Object.values(AUTH_TYPES);\n\n/**\n * Narrows the `:authType` route param, which is an arbitrary string, to a known auth type.\n */\nexport const isAuthType = (value: string | undefined): value is AuthType =>\n value !== undefined && AUTH_TYPE_VALUES.includes(value);\n\nexport type FormDictionary = Record<AuthType, ComponentType | ComponentType<RegisterProps>>;\n\nexport const FORMS = {\n [AUTH_TYPES.FORGOT_PASSWORD]: ForgotPassword,\n [AUTH_TYPES.FORGOT_PASSWORD_SUCCESS]: ForgotPasswordSuccess,\n // the `Component` attribute is set after all forms and CE/EE components are loaded, but since we\n // are here outside of a React component we can not use the hook directly\n [AUTH_TYPES.LOGIN]: () => null,\n [AUTH_TYPES.OOPS]: Oops,\n [AUTH_TYPES.REGISTER]: Register,\n [AUTH_TYPES.REGISTER_ADMIN]: Register,\n [AUTH_TYPES.RESET_PASSWORD]: ResetPassword,\n [AUTH_TYPES.PROVIDERS]: () => null,\n} satisfies FormDictionary;\n"],"names":["AUTH_TYPES","LOGIN","REGISTER","REGISTER_ADMIN","FORGOT_PASSWORD","RESET_PASSWORD","FORGOT_PASSWORD_SUCCESS","OOPS","PROVIDERS","AUTH_TYPE_VALUES","Object","values","isAuthType","value","undefined","includes","FORMS","ForgotPassword","ForgotPasswordSuccess","Oops","Register","ResetPassword"],"mappings":";;;;;;MAQaA,UAAAA,GAAa;IACxBC,KAAAA,EAAO,OAAA;IACPC,QAAAA,EAAU,UAAA;IACVC,cAAAA,EAAgB,gBAAA;IAChBC,eAAAA,EAAiB,iBAAA;IACjBC,cAAAA,EAAgB,gBAAA;IAChBC,uBAAAA,EAAyB,yBAAA;IACzBC,IAAAA,EAAM,MAAA;IACNC,SAAAA,EAAW;AACb;AAIA,MAAMC,gBAAAA,GAAsCC,MAAAA,CAAOC,MAAM,CAACX,UAAAA,CAAAA;AAE1D;;IAGO,MAAMY,UAAAA,GAAa,CAACC,KAAAA,GACzBA,UAAUC,SAAAA,IAAaL,gBAAAA,CAAiBM,QAAQ,CAACF,KAAAA;MAItCG,KAAAA,GAAQ;IACnB,CAAChB,UAAAA,CAAWI,eAAe,GAAGa,cAAAA;IAC9B,CAACjB,UAAAA,CAAWM,uBAAuB,GAAGY,qBAAAA;;;AAGtC,IAAA,CAAClB,UAAAA,CAAWC,KAAK,GAAG,IAAM,IAAA;IAC1B,CAACD,UAAAA,CAAWO,IAAI,GAAGY,IAAAA;IACnB,CAACnB,UAAAA,CAAWE,QAAQ,GAAGkB,QAAAA;IACvB,CAACpB,UAAAA,CAAWG,cAAc,GAAGiB,QAAAA;IAC7B,CAACpB,UAAAA,CAAWK,cAAc,GAAGgB,aAAAA;AAC7B,IAAA,CAACrB,UAAAA,CAAWQ,SAAS,GAAG,IAAM;AAChC;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_REDIRECT_TO = '/';
|
|
4
|
+
/**
|
|
5
|
+
* A redirect target is only safe if it resolves inside the admin app.
|
|
6
|
+
*
|
|
7
|
+
* Anything else must be rejected: react-router's browser history calls
|
|
8
|
+
* `window.location.assign(href)` when `pushState` throws, and `pushState` throws a
|
|
9
|
+
* `SecurityError` on a cross-origin href, so an off-app value becomes a real navigation
|
|
10
|
+
* away from the admin origin.
|
|
11
|
+
*
|
|
12
|
+
* Requiring a single leading `/` is what does the work. It rejects protocol-relative
|
|
13
|
+
* references (`//evil.com`), their backslash variant (`/\evil.com`, which browsers
|
|
14
|
+
* normalise to `//`), and every scheme-bearing value (`https://evil.com`,
|
|
15
|
+
* `javascript:alert(1)`), none of which start with a slash.
|
|
16
|
+
*/ const isSameAppPath = (value)=>value.startsWith('/') && !value.startsWith('//') && !value.startsWith('/\\');
|
|
17
|
+
/**
|
|
18
|
+
* Reads the `?redirectTo` the user was sent to the auth pages with, so that logging in from a
|
|
19
|
+
* deep link returns them to where they started instead of the home page.
|
|
20
|
+
*
|
|
21
|
+
* Falls back to the home page when the param is absent, empty, or not a same-app path.
|
|
22
|
+
*/ const getRedirectTo = (search)=>{
|
|
23
|
+
// `URLSearchParams` already percent-decodes the value. Decoding it a second time would
|
|
24
|
+
// corrupt targets holding encoded delimiters: `/foo?value=a%26b` would become
|
|
25
|
+
// `/foo?value=a&b`, splitting one query value into two.
|
|
26
|
+
const redirectTo = new URLSearchParams(search).get('redirectTo');
|
|
27
|
+
if (!redirectTo || !isSameAppPath(redirectTo)) {
|
|
28
|
+
return DEFAULT_REDIRECT_TO;
|
|
29
|
+
}
|
|
30
|
+
return redirectTo;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.getRedirectTo = getRedirectTo;
|
|
34
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../admin/src/pages/Auth/utils.ts"],"sourcesContent":["const DEFAULT_REDIRECT_TO = '/';\n\n/**\n * A redirect target is only safe if it resolves inside the admin app.\n *\n * Anything else must be rejected: react-router's browser history calls\n * `window.location.assign(href)` when `pushState` throws, and `pushState` throws a\n * `SecurityError` on a cross-origin href, so an off-app value becomes a real navigation\n * away from the admin origin.\n *\n * Requiring a single leading `/` is what does the work. It rejects protocol-relative\n * references (`//evil.com`), their backslash variant (`/\\evil.com`, which browsers\n * normalise to `//`), and every scheme-bearing value (`https://evil.com`,\n * `javascript:alert(1)`), none of which start with a slash.\n */\nconst isSameAppPath = (value: string): boolean =>\n value.startsWith('/') && !value.startsWith('//') && !value.startsWith('/\\\\');\n\n/**\n * Reads the `?redirectTo` the user was sent to the auth pages with, so that logging in from a\n * deep link returns them to where they started instead of the home page.\n *\n * Falls back to the home page when the param is absent, empty, or not a same-app path.\n */\nexport const getRedirectTo = (search: string): string => {\n // `URLSearchParams` already percent-decodes the value. Decoding it a second time would\n // corrupt targets holding encoded delimiters: `/foo?value=a%26b` would become\n // `/foo?value=a&b`, splitting one query value into two.\n const redirectTo = new URLSearchParams(search).get('redirectTo');\n\n if (!redirectTo || !isSameAppPath(redirectTo)) {\n return DEFAULT_REDIRECT_TO;\n }\n\n return redirectTo;\n};\n"],"names":["DEFAULT_REDIRECT_TO","isSameAppPath","value","startsWith","getRedirectTo","search","redirectTo","URLSearchParams","get"],"mappings":";;AAAA,MAAMA,mBAAAA,GAAsB,GAAA;AAE5B;;;;;;;;;;;;AAYC,IACD,MAAMC,aAAAA,GAAgB,CAACC,KAAAA,GACrBA,KAAAA,CAAMC,UAAU,CAAC,GAAA,CAAA,IAAQ,CAACD,KAAAA,CAAMC,UAAU,CAAC,IAAA,CAAA,IAAS,CAACD,KAAAA,CAAMC,UAAU,CAAC,KAAA,CAAA;AAExE;;;;;IAMO,MAAMC,aAAAA,GAAgB,CAACC,MAAAA,GAAAA;;;;AAI5B,IAAA,MAAMC,UAAAA,GAAa,IAAIC,eAAAA,CAAgBF,MAAAA,CAAAA,CAAQG,GAAG,CAAC,YAAA,CAAA;AAEnD,IAAA,IAAI,CAACF,UAAAA,IAAc,CAACL,aAAAA,CAAcK,UAAAA,CAAAA,EAAa;QAC7C,OAAON,mBAAAA;AACT,IAAA;IAEA,OAAOM,UAAAA;AACT;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const DEFAULT_REDIRECT_TO = '/';
|
|
2
|
+
/**
|
|
3
|
+
* A redirect target is only safe if it resolves inside the admin app.
|
|
4
|
+
*
|
|
5
|
+
* Anything else must be rejected: react-router's browser history calls
|
|
6
|
+
* `window.location.assign(href)` when `pushState` throws, and `pushState` throws a
|
|
7
|
+
* `SecurityError` on a cross-origin href, so an off-app value becomes a real navigation
|
|
8
|
+
* away from the admin origin.
|
|
9
|
+
*
|
|
10
|
+
* Requiring a single leading `/` is what does the work. It rejects protocol-relative
|
|
11
|
+
* references (`//evil.com`), their backslash variant (`/\evil.com`, which browsers
|
|
12
|
+
* normalise to `//`), and every scheme-bearing value (`https://evil.com`,
|
|
13
|
+
* `javascript:alert(1)`), none of which start with a slash.
|
|
14
|
+
*/ const isSameAppPath = (value)=>value.startsWith('/') && !value.startsWith('//') && !value.startsWith('/\\');
|
|
15
|
+
/**
|
|
16
|
+
* Reads the `?redirectTo` the user was sent to the auth pages with, so that logging in from a
|
|
17
|
+
* deep link returns them to where they started instead of the home page.
|
|
18
|
+
*
|
|
19
|
+
* Falls back to the home page when the param is absent, empty, or not a same-app path.
|
|
20
|
+
*/ const getRedirectTo = (search)=>{
|
|
21
|
+
// `URLSearchParams` already percent-decodes the value. Decoding it a second time would
|
|
22
|
+
// corrupt targets holding encoded delimiters: `/foo?value=a%26b` would become
|
|
23
|
+
// `/foo?value=a&b`, splitting one query value into two.
|
|
24
|
+
const redirectTo = new URLSearchParams(search).get('redirectTo');
|
|
25
|
+
if (!redirectTo || !isSameAppPath(redirectTo)) {
|
|
26
|
+
return DEFAULT_REDIRECT_TO;
|
|
27
|
+
}
|
|
28
|
+
return redirectTo;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { getRedirectTo };
|
|
32
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../../../../../admin/src/pages/Auth/utils.ts"],"sourcesContent":["const DEFAULT_REDIRECT_TO = '/';\n\n/**\n * A redirect target is only safe if it resolves inside the admin app.\n *\n * Anything else must be rejected: react-router's browser history calls\n * `window.location.assign(href)` when `pushState` throws, and `pushState` throws a\n * `SecurityError` on a cross-origin href, so an off-app value becomes a real navigation\n * away from the admin origin.\n *\n * Requiring a single leading `/` is what does the work. It rejects protocol-relative\n * references (`//evil.com`), their backslash variant (`/\\evil.com`, which browsers\n * normalise to `//`), and every scheme-bearing value (`https://evil.com`,\n * `javascript:alert(1)`), none of which start with a slash.\n */\nconst isSameAppPath = (value: string): boolean =>\n value.startsWith('/') && !value.startsWith('//') && !value.startsWith('/\\\\');\n\n/**\n * Reads the `?redirectTo` the user was sent to the auth pages with, so that logging in from a\n * deep link returns them to where they started instead of the home page.\n *\n * Falls back to the home page when the param is absent, empty, or not a same-app path.\n */\nexport const getRedirectTo = (search: string): string => {\n // `URLSearchParams` already percent-decodes the value. Decoding it a second time would\n // corrupt targets holding encoded delimiters: `/foo?value=a%26b` would become\n // `/foo?value=a&b`, splitting one query value into two.\n const redirectTo = new URLSearchParams(search).get('redirectTo');\n\n if (!redirectTo || !isSameAppPath(redirectTo)) {\n return DEFAULT_REDIRECT_TO;\n }\n\n return redirectTo;\n};\n"],"names":["DEFAULT_REDIRECT_TO","isSameAppPath","value","startsWith","getRedirectTo","search","redirectTo","URLSearchParams","get"],"mappings":"AAAA,MAAMA,mBAAAA,GAAsB,GAAA;AAE5B;;;;;;;;;;;;AAYC,IACD,MAAMC,aAAAA,GAAgB,CAACC,KAAAA,GACrBA,KAAAA,CAAMC,UAAU,CAAC,GAAA,CAAA,IAAQ,CAACD,KAAAA,CAAMC,UAAU,CAAC,IAAA,CAAA,IAAS,CAACD,KAAAA,CAAMC,UAAU,CAAC,KAAA,CAAA;AAExE;;;;;IAMO,MAAMC,aAAAA,GAAgB,CAACC,MAAAA,GAAAA;;;;AAI5B,IAAA,MAAMC,UAAAA,GAAa,IAAIC,eAAAA,CAAgBF,MAAAA,CAAAA,CAAQG,GAAG,CAAC,YAAA,CAAA;AAEnD,IAAA,IAAI,CAACF,UAAAA,IAAc,CAACL,aAAAA,CAAcK,UAAAA,CAAAA,EAAa;QAC7C,OAAON,mBAAAA;AACT,IAAA;IAEA,OAAOM,UAAAA;AACT;;;;"}
|
|
@@ -174,7 +174,7 @@ var ptBR = {
|
|
|
174
174
|
"Settings.profile.form.section.experience.here": "aqui",
|
|
175
175
|
"Settings.profile.form.section.experience.interfaceLanguage": "Linguagem da interface",
|
|
176
176
|
"Settings.profile.form.section.experience.interfaceLanguage.hint": "Somente sua interface será exibida com a linguagem selecionada.",
|
|
177
|
-
"Settings.profile.form.section.experience.interfaceLanguageHelp": "
|
|
177
|
+
"Settings.profile.form.section.experience.interfaceLanguageHelp": "As alterações de preferência se aplicam apenas a você. Mais informações disponíveis {here}.",
|
|
178
178
|
"Settings.profile.form.section.experience.mode.label": "Modo de interface",
|
|
179
179
|
"Settings.profile.form.section.experience.mode.hint": "Selecione o modo de interface que você deseja usar",
|
|
180
180
|
"Settings.profile.form.section.experience.mode.option-label": "modo {name}",
|