@openedx/frontend-app-authn 2.0.0-alpha.1 → 2.0.0-alpha.3
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/README.rst +68 -26
- package/dist/app.js +1 -27
- package/dist/app.js.map +1 -1
- package/dist/base-container/components/BrandLogo.d.ts +24 -0
- package/dist/base-container/components/BrandLogo.js +28 -0
- package/dist/base-container/components/BrandLogo.js.map +1 -0
- package/dist/base-container/components/default-layout/LargeLayout.js +3 -3
- package/dist/base-container/components/default-layout/LargeLayout.js.map +1 -1
- package/dist/base-container/components/default-layout/MediumLayout.js +3 -3
- package/dist/base-container/components/default-layout/MediumLayout.js.map +1 -1
- package/dist/base-container/components/default-layout/SmallLayout.js +3 -3
- package/dist/base-container/components/default-layout/SmallLayout.js.map +1 -1
- package/dist/base-container/components/image-layout/ExtraSmallLayout.js +4 -3
- package/dist/base-container/components/image-layout/ExtraSmallLayout.js.map +1 -1
- package/dist/base-container/components/image-layout/LargeLayout.js +4 -3
- package/dist/base-container/components/image-layout/LargeLayout.js.map +1 -1
- package/dist/base-container/components/image-layout/MediumLayout.js +4 -3
- package/dist/base-container/components/image-layout/MediumLayout.js.map +1 -1
- package/dist/base-container/components/image-layout/SmallLayout.js +4 -3
- package/dist/base-container/components/image-layout/SmallLayout.js.map +1 -1
- package/dist/base-container/components/welcome-page-layout/LargeLayout.js +3 -3
- package/dist/base-container/components/welcome-page-layout/LargeLayout.js.map +1 -1
- package/dist/base-container/components/welcome-page-layout/MediumLayout.js +3 -3
- package/dist/base-container/components/welcome-page-layout/MediumLayout.js.map +1 -1
- package/dist/base-container/components/welcome-page-layout/SmallLayout.js +3 -3
- package/dist/base-container/components/welcome-page-layout/SmallLayout.js.map +1 -1
- package/dist/common-components/RedirectLogistration.js +2 -2
- package/dist/common-components/RedirectLogistration.js.map +1 -1
- package/dist/common-components/UnAuthOnlyRoute.js +8 -3
- package/dist/common-components/UnAuthOnlyRoute.js.map +1 -1
- package/dist/common-components/components/ThirdPartyAuthContext.js.map +1 -1
- package/dist/data/utils/dataUtils.d.ts +1 -0
- package/dist/data/utils/dataUtils.js +7 -2
- package/dist/data/utils/dataUtils.js.map +1 -1
- package/dist/data/utils/index.d.ts +1 -1
- package/dist/data/utils/index.js +1 -1
- package/dist/data/utils/index.js.map +1 -1
- package/dist/forgot-password/ForgotPasswordAlert.js +5 -1
- package/dist/forgot-password/ForgotPasswordAlert.js.map +1 -1
- package/dist/forgot-password/ForgotPasswordPage.js +1 -1
- package/dist/forgot-password/ForgotPasswordPage.js.map +1 -1
- package/dist/forgot-password/data/apiHook.js.map +1 -1
- package/dist/login/AccountActivationMessage.js +5 -1
- package/dist/login/AccountActivationMessage.js.map +1 -1
- package/dist/login/ChangePasswordPrompt.js +5 -5
- package/dist/login/ChangePasswordPrompt.js.map +1 -1
- package/dist/login/LoginPage.js +4 -4
- package/dist/login/LoginPage.js.map +1 -1
- package/dist/login/components/LoginContext.js.map +1 -1
- package/dist/login/data/apiHook.js.map +1 -1
- package/dist/progressive-profiling/ProgressiveProfiling.js +8 -8
- package/dist/progressive-profiling/ProgressiveProfiling.js.map +1 -1
- package/dist/progressive-profiling/ProgressiveProfilingPageModal.d.ts +3 -1
- package/dist/progressive-profiling/ProgressiveProfilingPageModal.js +8 -5
- package/dist/progressive-profiling/ProgressiveProfilingPageModal.js.map +1 -1
- package/dist/progressive-profiling/components/ProgressiveProfilingContext.js.map +1 -1
- package/dist/progressive-profiling/data/apiHook.js.map +1 -1
- package/dist/register/RegistrationPage.js +3 -4
- package/dist/register/RegistrationPage.js.map +1 -1
- package/dist/register/components/RegisterContext.js.map +1 -1
- package/dist/register/data/apiHook.js.map +1 -1
- package/dist/register/types.js.map +1 -1
- package/dist/reset-password/data/apiHook.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Hyperlink, Image } from '@openedx/paragon';
|
|
2
|
+
import { getSiteConfig, useIntl } from '@openedx/frontend-base';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import BrandLogo from '../BrandLogo';
|
|
5
5
|
import messages from './messages';
|
|
6
6
|
const SmallLayout = ({ fullName }) => {
|
|
7
7
|
const { formatMessage } = useIntl();
|
|
8
|
-
return (_jsxs("div", { className: "min-vw-100 bg-light-200", children: [_jsx("div", { className: "col-md-12 small-screen-top-stripe" }), _jsx(
|
|
8
|
+
return (_jsxs("div", { className: "min-vw-100 bg-light-200", children: [_jsx("div", { className: "col-md-12 small-screen-top-stripe" }), _jsx(BrandLogo, { className: "logo-small", variant: "default" }), _jsxs("div", { className: "d-flex align-items-center m-3.5", children: [_jsx("div", { className: "small-yellow-line mt-4.5" }), _jsxs("div", { children: [_jsx("h1", { className: "h5 data-hj-suppress", children: formatMessage(messages['welcome.to.platform'], { siteName: getSiteConfig().siteName, fullName }) }), _jsxs("h2", { className: "h1", children: [formatMessage(messages['complete.your.profile.1']), _jsx("div", { className: "text-accent-a", children: formatMessage(messages['complete.your.profile.2']) })] })] })] })] }));
|
|
9
9
|
};
|
|
10
10
|
SmallLayout.propTypes = {
|
|
11
11
|
fullName: PropTypes.string.isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmallLayout.js","sourceRoot":"","sources":["../../../../src/base-container/components/welcome-page-layout/SmallLayout.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"SmallLayout.js","sourceRoot":"","sources":["../../../../src/base-container/components/welcome-page-layout/SmallLayout.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,WAAW,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACnC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,OAAO,CACL,eAAK,SAAS,EAAC,yBAAyB,aACtC,cAAK,SAAS,EAAC,mCAAmC,GAAG,EACrD,KAAC,SAAS,IAAC,SAAS,EAAC,YAAY,EAAC,OAAO,EAAC,SAAS,GAAG,EACtD,eAAK,SAAS,EAAC,iCAAiC,aAC9C,cAAK,SAAS,EAAC,0BAA0B,GAAG,EAC5C,0BACE,aAAI,SAAS,EAAC,qBAAqB,YAChC,aAAa,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,GAC9F,EACL,cAAI,SAAS,EAAC,IAAI,aACf,aAAa,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC,EACnD,cAAK,SAAS,EAAC,eAAe,YAC3B,aAAa,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC,GAC/C,IACH,IACD,IACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,WAAW,CAAC,SAAS,GAAG;IACtB,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;CACtC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { getSiteConfig, useIntl } from '@openedx/frontend-base';\nimport PropTypes from 'prop-types';\n\nimport BrandLogo from '../BrandLogo';\nimport messages from './messages';\n\nconst SmallLayout = ({ fullName }) => {\n const { formatMessage } = useIntl();\n\n return (\n <div className=\"min-vw-100 bg-light-200\">\n <div className=\"col-md-12 small-screen-top-stripe\" />\n <BrandLogo className=\"logo-small\" variant=\"default\" />\n <div className=\"d-flex align-items-center m-3.5\">\n <div className=\"small-yellow-line mt-4.5\" />\n <div>\n <h1 className=\"h5 data-hj-suppress\">\n {formatMessage(messages['welcome.to.platform'], { siteName: getSiteConfig().siteName, fullName })}\n </h1>\n <h2 className=\"h1\">\n {formatMessage(messages['complete.your.profile.1'])}\n <div className=\"text-accent-a\">\n {formatMessage(messages['complete.your.profile.2'])}\n </div>\n </h2>\n </div>\n </div>\n </div>\n );\n};\n\nSmallLayout.propTypes = {\n fullName: PropTypes.string.isRequired,\n};\n\nexport default SmallLayout;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useAppConfig, getSiteConfig, getUrlByRouteRole } from '@openedx/frontend-base';
|
|
2
|
+
import { useAppConfig, getSiteConfig, getUrlByRouteRole, isInternalUrl } from '@openedx/frontend-base';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { Navigate } from 'react-router-dom';
|
|
5
5
|
import { welcomeRole } from '../constants';
|
|
@@ -37,7 +37,7 @@ const RedirectLogistration = (props) => {
|
|
|
37
37
|
authenticatedUser,
|
|
38
38
|
}, replace: true }));
|
|
39
39
|
}
|
|
40
|
-
if (finalRedirectUrl
|
|
40
|
+
if (isInternalUrl(finalRedirectUrl)) {
|
|
41
41
|
return _jsx(Navigate, { to: finalRedirectUrl, replace: true });
|
|
42
42
|
}
|
|
43
43
|
window.location.href = finalRedirectUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectLogistration.js","sourceRoot":"","sources":["../../src/common-components/RedirectLogistration.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"RedirectLogistration.js","sourceRoot":"","sources":["../../src/common-components/RedirectLogistration.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvG,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,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oBAClB,cAAc;oBACd,iBAAiB;iBAClB,EACD,OAAO,SACP,CACH,CAAC;QACJ,CAAC;QAED,IAAI,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACpC,OAAO,KAAC,QAAQ,IAAC,EAAE,EAAE,gBAAgB,EAAE,OAAO,SAAG,CAAC;QACpD,CAAC;QACD,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC1C,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,oBAAoB,CAAC,YAAY,GAAG;IAClC,iBAAiB,EAAE,EAAE;IACrB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,EAAE;IACf,kCAAkC,EAAE,KAAK;IACzC,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,IAAI;IACZ,oBAAoB,EAAE,KAAK;IAC3B,IAAI,EAAE,EAAE;CACT,CAAC;AAEF,oBAAoB,CAAC,SAAS,GAAG;IAC/B,iBAAiB,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;IACtC,cAAc,EAAE,SAAS,CAAC,MAAM;IAChC,aAAa,EAAE,SAAS,CAAC,MAAM;IAC/B,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,WAAW,EAAE,SAAS,CAAC,MAAM;IAC7B,kCAAkC,EAAE,SAAS,CAAC,IAAI;IAClD,cAAc,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;IACnC,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,oBAAoB,EAAE,SAAS,CAAC,IAAI;IACpC,IAAI,EAAE,SAAS,CAAC,MAAM;CACvB,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import { useAppConfig, getSiteConfig, getUrlByRouteRole, isInternalUrl } from '@openedx/frontend-base';\nimport PropTypes from 'prop-types';\nimport { Navigate } from 'react-router-dom';\n\nimport { welcomeRole } from '../constants';\nimport { REDIRECT } from '../data/constants';\nimport { setCookie } from '../data/utils';\n\nconst RedirectLogistration = (props) => {\n const {\n authenticatedUser,\n finishAuthUrl,\n redirectUrl,\n redirectToProgressiveProfilingPage,\n success,\n optionalFields,\n educationLevel,\n userId,\n registrationEmbedded,\n host,\n } = props;\n let finalRedirectUrl = '';\n\n if (success) {\n // If we're in a third party auth pipeline, we must complete the pipeline\n // once user has successfully logged in. Otherwise, redirect to the specified redirect url.\n // Note: For multiple enterprise use case, we need to make sure that user first visits the\n // enterprise selection page and then complete the auth workflow\n if (finishAuthUrl && !redirectUrl.includes(finishAuthUrl)) {\n finalRedirectUrl = getSiteConfig().lmsBaseUrl + finishAuthUrl;\n } else {\n finalRedirectUrl = redirectUrl;\n }\n\n // Redirect to Progressive Profiling after successful registration\n if (redirectToProgressiveProfilingPage) {\n // TODO: Do we still need this cookie?\n setCookie('van-504-returning-user', true, useAppConfig().SESSION_COOKIE_DOMAIN);\n\n if (registrationEmbedded) {\n window.parent.postMessage({\n action: REDIRECT,\n redirectUrl: useAppConfig().POST_REGISTRATION_REDIRECT_URL,\n }, host);\n return null;\n }\n const registrationResult = { redirectUrl: finalRedirectUrl, success };\n return (\n <Navigate\n to={getUrlByRouteRole(welcomeRole)}\n state={{\n registrationResult,\n optionalFields,\n authenticatedUser,\n }}\n replace\n />\n );\n }\n\n if (isInternalUrl(finalRedirectUrl)) {\n return <Navigate to={finalRedirectUrl} replace />;\n }\n window.location.href = finalRedirectUrl;\n }\n\n return null;\n};\n\nRedirectLogistration.defaultProps = {\n authenticatedUser: {},\n educationLevel: null,\n finishAuthUrl: null,\n success: false,\n redirectUrl: '',\n redirectToProgressiveProfilingPage: false,\n optionalFields: {},\n userId: null,\n registrationEmbedded: false,\n host: '',\n};\n\nRedirectLogistration.propTypes = {\n authenticatedUser: PropTypes.shape({}),\n educationLevel: PropTypes.string,\n finishAuthUrl: PropTypes.string,\n success: PropTypes.bool,\n redirectUrl: PropTypes.string,\n redirectToProgressiveProfilingPage: PropTypes.bool,\n optionalFields: PropTypes.shape({}),\n userId: PropTypes.number,\n registrationEmbedded: PropTypes.bool,\n host: PropTypes.string,\n};\n\nexport default RedirectLogistration;\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
-
import { fetchAuthenticatedUser, getAuthenticatedUser
|
|
3
|
+
import { fetchAuthenticatedUser, getAuthenticatedUser } from '@openedx/frontend-base';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { Navigate } from 'react-router-dom';
|
|
6
|
-
import {
|
|
6
|
+
import { getDashboardRoute } from '../data/utils';
|
|
7
7
|
/**
|
|
8
8
|
* This wrapper redirects the requester to our default redirect url if they are
|
|
9
9
|
* already authenticated.
|
|
@@ -19,7 +19,12 @@ const UnAuthOnlyRoute = ({ children }) => {
|
|
|
19
19
|
}, []);
|
|
20
20
|
if (isReady) {
|
|
21
21
|
if (authUser && authUser.username) {
|
|
22
|
-
|
|
22
|
+
const dashboard = getDashboardRoute();
|
|
23
|
+
if (dashboard.isInternal) {
|
|
24
|
+
return _jsx(Navigate, { to: dashboard.url, replace: true });
|
|
25
|
+
}
|
|
26
|
+
window.location.href = dashboard.url;
|
|
27
|
+
return null;
|
|
23
28
|
}
|
|
24
29
|
return children;
|
|
25
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnAuthOnlyRoute.js","sourceRoot":"","sources":["../../src/common-components/UnAuthOnlyRoute.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"UnAuthOnlyRoute.js","sourceRoot":"","sources":["../../src/common-components/UnAuthOnlyRoute.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ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AAG;IAC1B,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;CACpC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { fetchAuthenticatedUser, getAuthenticatedUser } from '@openedx/frontend-base';\nimport PropTypes from 'prop-types';\nimport { Navigate } from 'react-router-dom';\n\nimport { getDashboardRoute } from '../data/utils';\n\n/**\n * This wrapper redirects the requester to our default redirect url if they are\n * already authenticated.\n */\nconst UnAuthOnlyRoute = ({ children }) => {\n const [authUser, setAuthUser] = useState({});\n const [isReady, setIsReady] = useState(false);\n\n useEffect(() => {\n fetchAuthenticatedUser({ forceRefresh: !!getAuthenticatedUser() }).then((authenticatedUser) => {\n setAuthUser(authenticatedUser);\n setIsReady(true);\n });\n }, []);\n\n if (isReady) {\n if (authUser && authUser.username) {\n const dashboard = getDashboardRoute();\n if (dashboard.isInternal) {\n return <Navigate to={dashboard.url} replace />;\n }\n window.location.href = dashboard.url;\n return null;\n }\n\n return children;\n }\n\n return null;\n};\n\nUnAuthOnlyRoute.propTypes = {\n children: PropTypes.node.isRequired,\n};\n\nexport default UnAuthOnlyRoute;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThirdPartyAuthContext.js","sourceRoot":"","sources":["../../../src/common-components/components/ThirdPartyAuthContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAAiB,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,GACzE,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AA2BpF,MAAM,qBAAqB,GAAG,aAAa,CAAwC,SAAS,CAAC,CAAC;AAM9F,MAAM,CAAC,MAAM,sBAAsB,GAAoC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACtF,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,EA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C1B,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {\n createContext, FC, ReactNode, useCallback, useContext, useMemo, useState,\n} from 'react';\n\nimport { COMPLETE_STATE, FAILURE_STATE, PENDING_STATE } from '../../data/constants';\n\ninterface ThirdPartyAuthContextType {\n fieldDescriptions: any
|
|
1
|
+
{"version":3,"file":"ThirdPartyAuthContext.js","sourceRoot":"","sources":["../../../src/common-components/components/ThirdPartyAuthContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAAiB,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,GACzE,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AA2BpF,MAAM,qBAAqB,GAAG,aAAa,CAAwC,SAAS,CAAC,CAAC;AAM9F,MAAM,CAAC,MAAM,sBAAsB,GAAoC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACtF,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC;QACnD,MAAM,EAAE,EAAE;QACV,gBAAgB,EAAE,EAAE;KACrB,CAAC,CAAC;IACH,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAC5F,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,QAAQ,CAAC;QACjE,YAAY,EAAE,IAAI;QAClB,iBAAiB,EAAE,KAAK;QACxB,eAAe,EAAE,IAAI;QACrB,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,IAAI;QACjB,SAAS,EAAE,EAAE;QACb,kBAAkB,EAAE,EAAE;QACtB,mBAAmB,E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AAC,CAAC;QAC1C,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC,iCAC5B,IAAI,KACP,YAAY,EAAE,IAAI,IAClB,CAAC,CAAC;IACN,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC3B,iBAAiB;QACjB,cAAc;QACd,uBAAuB;QACvB,qBAAqB;QACrB,6BAA6B;QAC7B,+BAA+B;QAC/B,+BAA+B;QAC/B,+BAA+B;KAChC,CAAC,EAAE;QACF,iBAAiB;QACjB,cAAc;QACd,uBAAuB;QACvB,qBAAqB;QACrB,6BAA6B;QAC7B,+BAA+B;QAC/B,+BAA+B;QAC/B,+BAA+B;KAChC,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACzC,QAAQ,GACsB,CAClC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAA8B,EAAE;IACtE,MAAM,OAAO,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAClD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {\n createContext, FC, ReactNode, useCallback, useContext, useMemo, useState,\n} from 'react';\n\nimport { COMPLETE_STATE, FAILURE_STATE, PENDING_STATE } from '../../data/constants';\n\ninterface ThirdPartyAuthContextType {\n fieldDescriptions: any;\n optionalFields: {\n fields: any;\n extended_profile: any[];\n };\n thirdPartyAuthApiStatus: string | null;\n thirdPartyAuthContext: {\n platformName: string | null;\n autoSubmitRegForm: boolean;\n currentProvider: string | null;\n finishAuthUrl: string | null;\n countryCode: string | null;\n providers: any[];\n secondaryProviders: any[];\n pipelineUserDetails: any | null;\n errorMessage: string | null;\n welcomePageRedirectUrl: string | null;\n };\n setThirdPartyAuthContextBegin: () => void;\n setThirdPartyAuthContextSuccess: (fieldDescData: any, optionalFieldsData: any, contextData: any) => void;\n setThirdPartyAuthContextFailure: () => void;\n clearThirdPartyAuthErrorMessage: () => void;\n}\n\nconst ThirdPartyAuthContext = createContext<ThirdPartyAuthContextType | undefined>(undefined);\n\ninterface ThirdPartyAuthProviderProps {\n children: ReactNode;\n}\n\nexport const ThirdPartyAuthProvider: FC<ThirdPartyAuthProviderProps> = ({ children }) => {\n const [fieldDescriptions, setFieldDescriptions] = useState({});\n const [optionalFields, setOptionalFields] = useState({\n fields: {},\n extended_profile: [],\n });\n const [thirdPartyAuthApiStatus, setThirdPartyAuthApiStatus] = useState<string | null>(null);\n const [thirdPartyAuthContext, setThirdPartyAuthContext] = useState({\n platformName: null,\n autoSubmitRegForm: false,\n currentProvider: null,\n finishAuthUrl: null,\n countryCode: null,\n providers: [],\n secondaryProviders: [],\n pipelineUserDetails: null,\n errorMessage: null,\n welcomePageRedirectUrl: null,\n });\n\n // Function to handle begin state - mirrors THIRD_PARTY_AUTH_CONTEXT.BEGIN\n const setThirdPartyAuthContextBegin = useCallback(() => {\n setThirdPartyAuthApiStatus(PENDING_STATE);\n }, []);\n\n // Function to handle success - mirrors THIRD_PARTY_AUTH_CONTEXT.SUCCESS\n const setThirdPartyAuthContextSuccess = useCallback((fieldDescData, optionalFieldsData, contextData) => {\n setFieldDescriptions(fieldDescData?.fields || {});\n setOptionalFields(optionalFieldsData || { fields: {}, extended_profile: [] });\n setThirdPartyAuthContext(contextData || {\n platformName: null,\n autoSubmitRegForm: false,\n currentProvider: null,\n finishAuthUrl: null,\n countryCode: null,\n providers: [],\n secondaryProviders: [],\n pipelineUserDetails: null,\n errorMessage: null,\n welcomePageRedirectUrl: null,\n });\n setThirdPartyAuthApiStatus(COMPLETE_STATE);\n }, []);\n\n // Function to handle failure - mirrors THIRD_PARTY_AUTH_CONTEXT.FAILURE\n const setThirdPartyAuthContextFailure = useCallback(() => {\n setThirdPartyAuthApiStatus(FAILURE_STATE);\n setThirdPartyAuthContext(prev => ({\n ...prev,\n errorMessage: null,\n }));\n }, []);\n\n // Function to clear error message - mirrors THIRD_PARTY_AUTH_CONTEXT_CLEAR_ERROR_MSG\n const clearThirdPartyAuthErrorMessage = useCallback(() => {\n setThirdPartyAuthApiStatus(PENDING_STATE);\n setThirdPartyAuthContext(prev => ({\n ...prev,\n errorMessage: null,\n }));\n }, []);\n\n const value = useMemo(() => ({\n fieldDescriptions,\n optionalFields,\n thirdPartyAuthApiStatus,\n thirdPartyAuthContext,\n setThirdPartyAuthContextBegin,\n setThirdPartyAuthContextSuccess,\n setThirdPartyAuthContextFailure,\n clearThirdPartyAuthErrorMessage,\n }), [\n fieldDescriptions,\n optionalFields,\n thirdPartyAuthApiStatus,\n thirdPartyAuthContext,\n setThirdPartyAuthContextBegin,\n setThirdPartyAuthContextSuccess,\n setThirdPartyAuthContextFailure,\n clearThirdPartyAuthErrorMessage,\n ]);\n\n return (\n <ThirdPartyAuthContext.Provider value={value}>\n {children}\n </ThirdPartyAuthContext.Provider>\n );\n};\n\nexport const useThirdPartyAuthContext = (): ThirdPartyAuthContextType => {\n const context = useContext(ThirdPartyAuthContext);\n if (context === undefined) {\n throw new Error('useThirdPartyAuthContext must be used within a ThirdPartyAuthProvider');\n }\n return context;\n};\n"]}
|
|
@@ -8,5 +8,6 @@ export function getAllPossibleQueryParams(locationURl?: null): {};
|
|
|
8
8
|
export function getActivationStatus(): string | (string | null)[] | null;
|
|
9
9
|
export function isScrollBehaviorSupported(): boolean;
|
|
10
10
|
export function windowScrollTo(options: any): void;
|
|
11
|
+
export function getDashboardRoute(): import("@openedx/frontend-base").ResolvedRoute;
|
|
11
12
|
export function normalizeRedirectUrl(backendUrl: any): any;
|
|
12
13
|
export function isHostAvailableInQueryParams(): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Utility functions
|
|
2
|
-
import { getSiteConfig,
|
|
2
|
+
import { getSiteConfig, resolveRouteByRole } from '@openedx/frontend-base';
|
|
3
3
|
import * as QueryString from 'query-string';
|
|
4
4
|
import { dashboardRole } from '../../constants';
|
|
5
5
|
import { AUTH_PARAMS } from '../constants';
|
|
@@ -62,13 +62,18 @@ export const windowScrollTo = (options) => {
|
|
|
62
62
|
}
|
|
63
63
|
return window.scrollTo(options.top, options.left);
|
|
64
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* The site's dashboard route, falling back to the shell root when no app or
|
|
67
|
+
* external route provides it.
|
|
68
|
+
*/
|
|
69
|
+
export const getDashboardRoute = () => { var _a; return (_a = resolveRouteByRole(dashboardRole)) !== null && _a !== void 0 ? _a : { url: '/', isInternal: true }; };
|
|
65
70
|
/**
|
|
66
71
|
* Normalize a backend redirect URL: if the backend returns the LMS dashboard
|
|
67
72
|
* URL (or nothing), replace it with the role-based dashboard URL so that SPA
|
|
68
73
|
* navigation can be used when the dashboard lives in the same shell.
|
|
69
74
|
*/
|
|
70
75
|
export const normalizeRedirectUrl = (backendUrl) => {
|
|
71
|
-
const dashboardUrl =
|
|
76
|
+
const dashboardUrl = getDashboardRoute().url;
|
|
72
77
|
const lmsDashboardUrl = `${getSiteConfig().lmsBaseUrl}/dashboard`;
|
|
73
78
|
return (!backendUrl || backendUrl.startsWith(lmsDashboardUrl))
|
|
74
79
|
? dashboardUrl
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataUtils.js","sourceRoot":"","sources":["../../../src/data/utils/dataUtils.js"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"dataUtils.js","sourceRoot":"","sources":["../../../src/data/utils/dataUtils.js"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,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ole } from '@openedx/frontend-base';\nimport * as QueryString from 'query-string';\n\nimport { dashboardRole } from '../../constants';\nimport { AUTH_PARAMS } from '../constants';\n\nexport const getTpaProvider = (tpaHintProvider, primaryProviders, secondaryProviders) => {\n let tpaProvider = null;\n let skipHintedLogin = false;\n [...primaryProviders, ...secondaryProviders].forEach((provider) => {\n if (provider.id === tpaHintProvider) {\n tpaProvider = provider;\n if (provider.skipHintedLogin) {\n skipHintedLogin = true;\n }\n }\n });\n return { provider: tpaProvider, skipHintedLogin };\n};\n\nexport const getTpaHint = () => {\n const params = QueryString.parse(window.location.search);\n let tpaHint = null;\n tpaHint = params.tpa_hint;\n if (!tpaHint) {\n const { next } = params;\n if (next) {\n const index = next.indexOf('tpa_hint=');\n if (index !== -1) {\n tpaHint = next.substring(index + 'tpa_hint='.length, next.length);\n }\n }\n }\n return tpaHint;\n};\n\nexport const updatePathWithQueryParams = (path) => {\n let queryParams = window.location.search;\n\n if (!queryParams) {\n return path;\n }\n\n if (queryParams.includes('track=pwreset')) {\n queryParams = queryParams.replace('?track=pwreset&', '?',).replace('?track=pwreset', '').replace('&track=pwreset', '').replace('?&', '?');\n }\n\n return `${path}${queryParams}`;\n};\n\nexport const getAllPossibleQueryParams = (locationURl = null) => {\n const urlParams = locationURl ? QueryString.parseUrl(locationURl).query : QueryString.parse(window.location.search);\n const params = {};\n Object.entries(urlParams).forEach(([key, value]) => {\n if (AUTH_PARAMS.includes(key)) {\n params[key] = value;\n }\n });\n\n return params;\n};\n\nexport const getActivationStatus = () => {\n const params = QueryString.parse(window.location.search);\n\n return params.account_activation_status;\n};\n\nexport const isScrollBehaviorSupported = () => 'scrollBehavior' in document.documentElement.style;\n\nexport const windowScrollTo = (options) => {\n if (isScrollBehaviorSupported()) {\n return window.scrollTo(options);\n }\n\n return window.scrollTo(options.top, options.left);\n};\n\n/**\n * The site's dashboard route, falling back to the shell root when no app or\n * external route provides it.\n */\nexport const getDashboardRoute = () => resolveRouteByRole(dashboardRole) ?? { url: '/', isInternal: true };\n\n/**\n * Normalize a backend redirect URL: if the backend returns the LMS dashboard\n * URL (or nothing), replace it with the role-based dashboard URL so that SPA\n * navigation can be used when the dashboard lives in the same shell.\n */\nexport const normalizeRedirectUrl = (backendUrl) => {\n const dashboardUrl = getDashboardRoute().url;\n const lmsDashboardUrl = `${getSiteConfig().lmsBaseUrl}/dashboard`;\n return (!backendUrl || backendUrl.startsWith(lmsDashboardUrl))\n ? dashboardUrl\n : backendUrl;\n};\n\nexport const isHostAvailableInQueryParams = () => {\n const queryParams = getAllPossibleQueryParams();\n return 'host' in queryParams;\n};\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as setCookie } from "./cookies";
|
|
2
|
-
export { getTpaProvider, getTpaHint, getAllPossibleQueryParams, getActivationStatus, isHostAvailableInQueryParams, updatePathWithQueryParams, normalizeRedirectUrl, windowScrollTo } from "./dataUtils";
|
|
2
|
+
export { getTpaProvider, getTpaHint, getAllPossibleQueryParams, getActivationStatus, getDashboardRoute, isHostAvailableInQueryParams, updatePathWithQueryParams, normalizeRedirectUrl, windowScrollTo } from "./dataUtils";
|
package/dist/data/utils/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { getTpaProvider, getTpaHint, getAllPossibleQueryParams, getActivationStatus, isHostAvailableInQueryParams, updatePathWithQueryParams, normalizeRedirectUrl, windowScrollTo, } from './dataUtils';
|
|
1
|
+
export { getTpaProvider, getTpaHint, getAllPossibleQueryParams, getActivationStatus, getDashboardRoute, isHostAvailableInQueryParams, updatePathWithQueryParams, normalizeRedirectUrl, windowScrollTo, } from './dataUtils';
|
|
2
2
|
export { default as setCookie } from './cookies';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/data/utils/index.js"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,UAAU,EACV,yBAAyB,EACzB,mBAAmB,EACnB,4BAA4B,EAC5B,yBAAyB,EACzB,oBAAoB,EACpB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export {\n getTpaProvider,\n getTpaHint,\n getAllPossibleQueryParams,\n getActivationStatus,\n isHostAvailableInQueryParams,\n updatePathWithQueryParams,\n normalizeRedirectUrl,\n windowScrollTo,\n} from './dataUtils';\nexport { default as setCookie } from './cookies';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/data/utils/index.js"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,UAAU,EACV,yBAAyB,EACzB,mBAAmB,EACnB,iBAAiB,EACjB,4BAA4B,EAC5B,yBAAyB,EACzB,oBAAoB,EACpB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export {\n getTpaProvider,\n getTpaHint,\n getAllPossibleQueryParams,\n getActivationStatus,\n getDashboardRoute,\n isHostAvailableInQueryParams,\n updatePathWithQueryParams,\n normalizeRedirectUrl,\n windowScrollTo,\n} from './dataUtils';\nexport { default as setCookie } from './cookies';\n"]}
|
|
@@ -9,6 +9,10 @@ import messages from './messages';
|
|
|
9
9
|
const ForgotPasswordAlert = (props) => {
|
|
10
10
|
const { formatMessage } = useIntl();
|
|
11
11
|
const { email, emailError } = props;
|
|
12
|
+
// Without a support link configured there is nowhere to point; the sentence still
|
|
13
|
+
// reads correctly with the phrase as plain text.
|
|
14
|
+
const passwordResetSupportLink = useAppConfig().PASSWORD_RESET_SUPPORT_LINK;
|
|
15
|
+
const supportLinkText = formatMessage(messages['confirmation.support.link']);
|
|
12
16
|
let message = '';
|
|
13
17
|
let heading = formatMessage(messages['forgot.password.error.alert.title']);
|
|
14
18
|
let { status } = props;
|
|
@@ -20,7 +24,7 @@ const ForgotPasswordAlert = (props) => {
|
|
|
20
24
|
heading = formatMessage(messages['confirmation.message.title']);
|
|
21
25
|
message = (_jsx(FormattedMessage, { id: "forgot.password.confirmation.message", defaultMessage: "We sent an email to {email} with instructions to reset your password.\n If you do not receive a password reset message after 1 minute, verify that you entered\n the correct email address, or check your spam folder. If you need further assistance, {supportLink}.", description: "Forgot password confirmation message", values: {
|
|
22
26
|
email: _jsx("span", { className: "data-hj-suppress", children: email }),
|
|
23
|
-
supportLink: (_jsx(Alert.Link, { href:
|
|
27
|
+
supportLink: passwordResetSupportLink ? (_jsx(Alert.Link, { href: passwordResetSupportLink, target: "_blank", children: supportLinkText })) : supportLinkText,
|
|
24
28
|
} }));
|
|
25
29
|
break;
|
|
26
30
|
case INTERNAL_SERVER_ERROR:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForgotPasswordAlert.js","sourceRoot":"","sources":["../../src/forgot-password/ForgotPasswordAlert.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EACL,cAAc,EAAE,eAAe,EAAE,qBAAqB,EAAE,qBAAqB,GAC9E,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,EAAE;IACpC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IACpC,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,OAAO,GAAG,aAAa,CAAC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SAAS,CAAC,MAAM;IACvB,UAAU,EAAE,SAAS,CAAC,MAAM;CAC7B,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { FormattedMessage, useAppConfig, useIntl } from '@openedx/frontend-base';\nimport { Alert } from '@openedx/paragon';\nimport { CheckCircle, Error } from '@openedx/paragon/icons';\nimport PropTypes from 'prop-types';\n\nimport {\n COMPLETE_STATE, FORBIDDEN_STATE, FORM_SUBMISSION_ERROR, INTERNAL_SERVER_ERROR,\n} from '../data/constants';\nimport { PASSWORD_RESET } from '../reset-password/data/constants';\nimport messages from './messages';\n\nconst ForgotPasswordAlert = (props) => {\n const { formatMessage } = useIntl();\n const { email, emailError } = props;\n // Without a support link configured there is nowhere to point; the sentence still\n // reads correctly with the phrase as plain text.\n const passwordResetSupportLink = useAppConfig().PASSWORD_RESET_SUPPORT_LINK;\n const supportLinkText = formatMessage(messages['confirmation.support.link']);\n let message = '';\n let heading = formatMessage(messages['forgot.password.error.alert.title']);\n let { status } = props;\n\n if (emailError) {\n status = FORM_SUBMISSION_ERROR;\n }\n\n switch (status) {\n case COMPLETE_STATE:\n heading = formatMessage(messages['confirmation.message.title']);\n message = (\n <FormattedMessage\n id=\"forgot.password.confirmation.message\"\n defaultMessage=\"We sent an email to {email} with instructions to reset your password.\n If you do not receive a password reset message after 1 minute, verify that you entered\n the correct email address, or check your spam folder. If you need further assistance, {supportLink}.\"\n description=\"Forgot password confirmation message\"\n values={{\n email: <span className=\"data-hj-suppress\">{email}</span>,\n supportLink: passwordResetSupportLink ? (\n <Alert.Link href={passwordResetSupportLink} target=\"_blank\">\n {supportLinkText}\n </Alert.Link>\n ) : supportLinkText,\n }}\n />\n );\n break;\n case INTERNAL_SERVER_ERROR:\n message = formatMessage(messages['internal.server.error']);\n break;\n case FORBIDDEN_STATE:\n heading = formatMessage(messages['forgot.password.error.message.title']);\n message = formatMessage(messages['forgot.password.request.in.progress.message']);\n break;\n case FORM_SUBMISSION_ERROR:\n message = formatMessage(messages['extend.field.errors'], { emailError });\n break;\n case PASSWORD_RESET.INVALID_TOKEN:\n heading = formatMessage(messages['invalid.token.heading']);\n message = formatMessage(messages['invalid.token.error.message']);\n break;\n case PASSWORD_RESET.FORBIDDEN_REQUEST:\n heading = formatMessage(messages['token.validation.rate.limit.error.heading']);\n message = formatMessage(messages['token.validation.rate.limit.error']);\n break;\n case PASSWORD_RESET.INTERNAL_SERVER_ERROR:\n heading = formatMessage(messages['token.validation.internal.sever.error.heading']);\n message = formatMessage(messages['token.validation.internal.sever.error']);\n break;\n default:\n break;\n }\n\n if (message) {\n return (\n <Alert\n id=\"validation-errors\"\n className=\"mb-4\"\n variant={`${status === 'complete' ? 'success' : 'danger'}`}\n icon={status === 'complete' ? CheckCircle : Error}\n >\n <Alert.Heading>{heading}</Alert.Heading>\n <p>{message}</p>\n </Alert>\n );\n }\n return null;\n};\n\nForgotPasswordAlert.defaultProps = {\n email: '',\n emailError: '',\n};\n\nForgotPasswordAlert.propTypes = {\n status: PropTypes.string.isRequired,\n email: PropTypes.string,\n emailError: PropTypes.string,\n};\n\nexport default ForgotPasswordAlert;\n"]}
|
|
@@ -86,7 +86,7 @@ const ForgotPasswordPage = () => {
|
|
|
86
86
|
return (_jsxs(BaseContainer, { children: [_jsx(Helmet, { children: _jsx("title", { children: formatMessage(messages['forgot.password.page.title'], { siteName: getSiteConfig().siteName }) }) }), _jsxs("div", { children: [_jsx(Tabs, { activeKey: "", id: "controlled-tab", onSelect: () => navigate(updatePathWithQueryParams(getUrlByRouteRole(loginRole))), children: _jsx(Tab, { title: tabTitle, eventKey: loginPath }) }), _jsx("div", { id: "main-content", className: "main-content", children: _jsxs(Form, { id: "forget-password-form", name: "forget-password-form", className: "mw-xs", children: [_jsx(ForgotPasswordAlert, { email: bannerEmail, emailError: formErrors, status: status }), _jsx("h2", { className: "h4", children: formatMessage(messages['forgot.password.page.heading']) }), _jsx("p", { className: "mb-4", children: formatMessage(messages['forgot.password.page.instructions']) }), _jsx(FormGroup, { floatingLabel: formatMessage(messages['forgot.password.page.email.field.label']), name: "email", value: email, autoComplete: "on", errorMessage: validationError, handleChange: (e) => setEmail(e.target.value), handleBlur: handleBlur, handleFocus: handleFocus, helpText: [formatMessage(messages['forgot.password.email.help.text'], { platformName })] }), _jsx(StatefulButton, { id: "submit-forget-password", name: "submit-forget-password", type: "submit", variant: "brand", className: "forgot-password--button", state: submitState, labels: {
|
|
87
87
|
default: formatMessage(messages['forgot.password.page.submit.button']),
|
|
88
88
|
pending: '',
|
|
89
|
-
}, onClick: handleSubmit, onMouseDown: (e) => e.preventDefault() }), (appConfig.LOGIN_ISSUE_SUPPORT_LINK) && (_jsx(Hyperlink, { id: "forgot-password", name: "forgot-password", className: "ml-4 font-weight-500 text-body", destination: appConfig.LOGIN_ISSUE_SUPPORT_LINK, target: "_blank", showLaunchIcon: false, children: formatMessage(messages['need.help.sign.in.text']) })), _jsxs("p", { className: "mt-5.5 small text-gray-700", children: [formatMessage(messages['additional.help.text'], { platformName }), _jsx("span", { className: "mx-1", children: _jsx(Hyperlink, { isInline: true, destination: `mailto:${appConfig.INFO_EMAIL}`, children: appConfig.INFO_EMAIL }) })] })] }) })] })] }));
|
|
89
|
+
}, onClick: handleSubmit, onMouseDown: (e) => e.preventDefault() }), (appConfig.LOGIN_ISSUE_SUPPORT_LINK) && (_jsx(Hyperlink, { id: "forgot-password", name: "forgot-password", className: "ml-4 font-weight-500 text-body", destination: appConfig.LOGIN_ISSUE_SUPPORT_LINK, target: "_blank", showLaunchIcon: false, children: formatMessage(messages['need.help.sign.in.text']) })), (appConfig.INFO_EMAIL) && (_jsxs("p", { className: "mt-5.5 small text-gray-700", children: [formatMessage(messages['additional.help.text'], { platformName }), _jsx("span", { className: "mx-1", children: _jsx(Hyperlink, { isInline: true, destination: `mailto:${appConfig.INFO_EMAIL}`, children: appConfig.INFO_EMAIL }) })] }))] }) })] })] }));
|
|
90
90
|
};
|
|
91
91
|
export default ForgotPasswordPage;
|
|
92
92
|
//# sourceMapping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,CAAC,sBAAsB,CAAC,EAAE,EAAE,YAAY,EAAE,CAAC,EAClE,eAAM,SAAS,EAAC,MAAM,YACpB,KAAC,SAAS,IAAC,QAAQ,QAAC,WAAW,EAAE,UAAU,SAAS,CAAC,UAAU,EAAE,YAAG,SAAS,CAAC,UAAU,GAAa,GAChG,IACL,IACC,GACH,IACF,IACQ,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport {\n getSiteConfig, getUrlByRouteRole, sendPageEvent, sendTrackEvent, useAppConfig, useIntl,\n} from '@openedx/frontend-base';\nimport {\n Form,\n Hyperlink,\n Icon,\n StatefulButton,\n Tab,\n Tabs,\n} from '@openedx/paragon';\nimport { ChevronLeft } from '@openedx/paragon/icons';\nimport { Helmet } from 'react-helmet';\nimport { useLocation, useNavigate } from 'react-router-dom';\n\nimport { useForgotPassword } from './data/apiHook';\nimport ForgotPasswordAlert from './ForgotPasswordAlert';\nimport messages from './messages';\nimport BaseContainer from '../base-container';\nimport { FormGroup } from '../common-components';\nimport { loginPath, loginRole } from '../constants';\nimport { VALID_EMAIL_REGEX } from '../data/constants';\nimport { updatePathWithQueryParams, windowScrollTo } from '../data/utils';\n\nconst ForgotPasswordPage = () => {\n const platformName = getSiteConfig().siteName;\n const emailRegex = new RegExp(VALID_EMAIL_REGEX, 'i');\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const location = useLocation();\n const appConfig = useAppConfig();\n const [email, setEmail] = useState('');\n const [bannerEmail, setBannerEmail] = useState('');\n const [formErrors, setFormErrors] = useState('');\n const [validationError, setValidationError] = useState('');\n const [status, setStatus] = useState(location.state?.status || null);\n\n // React Query hook for forgot password\n const { mutate: sendForgotPassword, isPending: isSending } = useForgotPassword();\n\n const submitState = isSending ? 'pending' : 'default';\n\n useEffect(() => {\n sendPageEvent('login_and_registration', 'reset');\n sendTrackEvent('edx.bi.password_reset_form.viewed', { category: 'user-engagement' });\n }, []);\n\n useEffect(() => {\n if (status === 'complete') {\n setEmail('');\n }\n }, [status]);\n\n const getValidationMessage = (value) => {\n let error = '';\n\n if (value === '') {\n error = formatMessage(messages['forgot.password.empty.email.field.error']);\n } else if (!emailRegex.test(value)) {\n error = formatMessage(messages['forgot.password.page.invalid.email.message']);\n }\n\n return error;\n };\n\n const handleBlur = () => {\n setValidationError(getValidationMessage(email));\n };\n\n const handleFocus = () => {\n setValidationError('');\n };\n\n const handleSubmit = (e) => {\n e.preventDefault();\n setBannerEmail(email);\n\n const validateError = getValidationMessage(email);\n if (validateError) {\n setFormErrors(validateError);\n setValidationError(validateError);\n windowScrollTo({ left: 0, top: 0, behavior: 'smooth' });\n } else {\n setFormErrors('');\n sendForgotPassword(email, {\n onSuccess: (data, emailUsed) => {\n setStatus('complete');\n setBannerEmail(emailUsed);\n setFormErrors('');\n },\n onError: (error) => {\n if (error.response && error.response.status === 403) {\n setStatus('forbidden');\n } else {\n setStatus('server-error');\n }\n },\n });\n }\n };\n\n const tabTitle = (\n <div className=\"d-inline-flex flex-wrap align-items-center\">\n <Icon src={ChevronLeft} />\n <span className=\"ml-2\">{formatMessage(messages['sign.in.text'])}</span>\n </div>\n );\n\n return (\n <BaseContainer>\n <Helmet>\n <title>{formatMessage(messages['forgot.password.page.title'],\n { siteName: getSiteConfig().siteName })}\n </title>\n </Helmet>\n <div>\n <Tabs activeKey=\"\" id=\"controlled-tab\" onSelect={() => navigate(updatePathWithQueryParams(getUrlByRouteRole(loginRole)))}>\n <Tab title={tabTitle} eventKey={loginPath} />\n </Tabs>\n <div id=\"main-content\" className=\"main-content\">\n <Form id=\"forget-password-form\" name=\"forget-password-form\" className=\"mw-xs\">\n <ForgotPasswordAlert email={bannerEmail} emailError={formErrors} status={status} />\n <h2 className=\"h4\">\n {formatMessage(messages['forgot.password.page.heading'])}\n </h2>\n <p className=\"mb-4\">\n {formatMessage(messages['forgot.password.page.instructions'])}\n </p>\n <FormGroup\n floatingLabel={formatMessage(messages['forgot.password.page.email.field.label'])}\n name=\"email\"\n value={email}\n autoComplete=\"on\"\n errorMessage={validationError}\n handleChange={(e) => setEmail(e.target.value)}\n handleBlur={handleBlur}\n handleFocus={handleFocus}\n helpText={[formatMessage(messages['forgot.password.email.help.text'], { platformName })]}\n />\n <StatefulButton\n id=\"submit-forget-password\"\n name=\"submit-forget-password\"\n type=\"submit\"\n variant=\"brand\"\n className=\"forgot-password--button\"\n state={submitState}\n labels={{\n default: formatMessage(messages['forgot.password.page.submit.button']),\n pending: '',\n }}\n onClick={handleSubmit}\n onMouseDown={(e) => e.preventDefault()}\n />\n {(appConfig.LOGIN_ISSUE_SUPPORT_LINK) && (\n <Hyperlink\n id=\"forgot-password\"\n name=\"forgot-password\"\n className=\"ml-4 font-weight-500 text-body\"\n destination={appConfig.LOGIN_ISSUE_SUPPORT_LINK}\n target=\"_blank\"\n showLaunchIcon={false}\n >\n {formatMessage(messages['need.help.sign.in.text'])}\n </Hyperlink>\n )}\n <p className=\"mt-5.5 small text-gray-700\">\n {formatMessage(messages['additional.help.text'], { platformName })}\n <span className=\"mx-1\">\n <Hyperlink isInline destination={`mailto:${appConfig.INFO_EMAIL}`}>{appConfig.INFO_EMAIL}</Hyperlink>\n </span>\n </p>\n </Form>\n </div>\n </div>\n </BaseContainer>\n );\n};\n\nexport default ForgotPasswordPage;\n"]}
|
|
1
|
+
{"version":3,"file":"ForgotPasswordPage.js","sourceRoot":"","sources":["../../src/forgot-password/ForgotPasswordPage.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EACL,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,GACvF,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,cAAc,EACd,GAAG,EACH,IAAI,GACL,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE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AAC,iCAAiC,CAAC,EAAE,EAAE,YAAY,EAAE,CAAC,CAAC,GACxF,EACF,KAAC,cAAc,IACb,EAAE,EAAC,wBAAwB,EAC3B,IAAI,EAAC,wBAAwB,EAC7B,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,OAAO,EACf,SAAS,EAAC,yBAAyB,EACnC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE;wCACN,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,oCAAoC,CAAC,CAAC;wCACtE,OAAO,EAAE,EAAE;qCACZ,EACD,OAAO,EAAE,YAAY,EACrB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,GACtC,EACD,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CACvC,KAAC,SAAS,IACR,EAAE,EAAC,iBAAiB,EACpB,IAAI,EAAC,iBAAiB,EACtB,SAAS,EAAC,gCAAgC,EAC1C,WAAW,EAAE,SAAS,CAAC,wBAAwB,EAC/C,MAAM,EAAC,QAAQ,EACf,cAAc,EAAE,KAAK,YAEpB,aAAa,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC,GACxC,CACb,EACA,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CACzB,aAAG,SAAS,EAAC,4BAA4B,aACtC,aAAa,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,EAAE,YAAY,EAAE,CAAC,EAClE,eAAM,SAAS,EAAC,MAAM,YACpB,KAAC,SAAS,IAAC,QAAQ,QAAC,WAAW,EAAE,UAAU,SAAS,CAAC,UAAU,EAAE,YAAG,SAAS,CAAC,UAAU,GAAa,GAChG,IACL,CACL,IACI,GACH,IACF,IACQ,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport {\n getSiteConfig, getUrlByRouteRole, sendPageEvent, sendTrackEvent, useAppConfig, useIntl,\n} from '@openedx/frontend-base';\nimport {\n Form,\n Hyperlink,\n Icon,\n StatefulButton,\n Tab,\n Tabs,\n} from '@openedx/paragon';\nimport { ChevronLeft } from '@openedx/paragon/icons';\nimport { Helmet } from 'react-helmet';\nimport { useLocation, useNavigate } from 'react-router-dom';\n\nimport { useForgotPassword } from './data/apiHook';\nimport ForgotPasswordAlert from './ForgotPasswordAlert';\nimport messages from './messages';\nimport BaseContainer from '../base-container';\nimport { FormGroup } from '../common-components';\nimport { loginPath, loginRole } from '../constants';\nimport { VALID_EMAIL_REGEX } from '../data/constants';\nimport { updatePathWithQueryParams, windowScrollTo } from '../data/utils';\n\nconst ForgotPasswordPage = () => {\n const platformName = getSiteConfig().siteName;\n const emailRegex = new RegExp(VALID_EMAIL_REGEX, 'i');\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const location = useLocation();\n const appConfig = useAppConfig();\n const [email, setEmail] = useState('');\n const [bannerEmail, setBannerEmail] = useState('');\n const [formErrors, setFormErrors] = useState('');\n const [validationError, setValidationError] = useState('');\n const [status, setStatus] = useState(location.state?.status || null);\n\n // React Query hook for forgot password\n const { mutate: sendForgotPassword, isPending: isSending } = useForgotPassword();\n\n const submitState = isSending ? 'pending' : 'default';\n\n useEffect(() => {\n sendPageEvent('login_and_registration', 'reset');\n sendTrackEvent('edx.bi.password_reset_form.viewed', { category: 'user-engagement' });\n }, []);\n\n useEffect(() => {\n if (status === 'complete') {\n setEmail('');\n }\n }, [status]);\n\n const getValidationMessage = (value) => {\n let error = '';\n\n if (value === '') {\n error = formatMessage(messages['forgot.password.empty.email.field.error']);\n } else if (!emailRegex.test(value)) {\n error = formatMessage(messages['forgot.password.page.invalid.email.message']);\n }\n\n return error;\n };\n\n const handleBlur = () => {\n setValidationError(getValidationMessage(email));\n };\n\n const handleFocus = () => {\n setValidationError('');\n };\n\n const handleSubmit = (e) => {\n e.preventDefault();\n setBannerEmail(email);\n\n const validateError = getValidationMessage(email);\n if (validateError) {\n setFormErrors(validateError);\n setValidationError(validateError);\n windowScrollTo({ left: 0, top: 0, behavior: 'smooth' });\n } else {\n setFormErrors('');\n sendForgotPassword(email, {\n onSuccess: (data, emailUsed) => {\n setStatus('complete');\n setBannerEmail(emailUsed);\n setFormErrors('');\n },\n onError: (error) => {\n if (error.response && error.response.status === 403) {\n setStatus('forbidden');\n } else {\n setStatus('server-error');\n }\n },\n });\n }\n };\n\n const tabTitle = (\n <div className=\"d-inline-flex flex-wrap align-items-center\">\n <Icon src={ChevronLeft} />\n <span className=\"ml-2\">{formatMessage(messages['sign.in.text'])}</span>\n </div>\n );\n\n return (\n <BaseContainer>\n <Helmet>\n <title>{formatMessage(messages['forgot.password.page.title'],\n { siteName: getSiteConfig().siteName })}\n </title>\n </Helmet>\n <div>\n <Tabs activeKey=\"\" id=\"controlled-tab\" onSelect={() => navigate(updatePathWithQueryParams(getUrlByRouteRole(loginRole)))}>\n <Tab title={tabTitle} eventKey={loginPath} />\n </Tabs>\n <div id=\"main-content\" className=\"main-content\">\n <Form id=\"forget-password-form\" name=\"forget-password-form\" className=\"mw-xs\">\n <ForgotPasswordAlert email={bannerEmail} emailError={formErrors} status={status} />\n <h2 className=\"h4\">\n {formatMessage(messages['forgot.password.page.heading'])}\n </h2>\n <p className=\"mb-4\">\n {formatMessage(messages['forgot.password.page.instructions'])}\n </p>\n <FormGroup\n floatingLabel={formatMessage(messages['forgot.password.page.email.field.label'])}\n name=\"email\"\n value={email}\n autoComplete=\"on\"\n errorMessage={validationError}\n handleChange={(e) => setEmail(e.target.value)}\n handleBlur={handleBlur}\n handleFocus={handleFocus}\n helpText={[formatMessage(messages['forgot.password.email.help.text'], { platformName })]}\n />\n <StatefulButton\n id=\"submit-forget-password\"\n name=\"submit-forget-password\"\n type=\"submit\"\n variant=\"brand\"\n className=\"forgot-password--button\"\n state={submitState}\n labels={{\n default: formatMessage(messages['forgot.password.page.submit.button']),\n pending: '',\n }}\n onClick={handleSubmit}\n onMouseDown={(e) => e.preventDefault()}\n />\n {(appConfig.LOGIN_ISSUE_SUPPORT_LINK) && (\n <Hyperlink\n id=\"forgot-password\"\n name=\"forgot-password\"\n className=\"ml-4 font-weight-500 text-body\"\n destination={appConfig.LOGIN_ISSUE_SUPPORT_LINK}\n target=\"_blank\"\n showLaunchIcon={false}\n >\n {formatMessage(messages['need.help.sign.in.text'])}\n </Hyperlink>\n )}\n {(appConfig.INFO_EMAIL) && (\n <p className=\"mt-5.5 small text-gray-700\">\n {formatMessage(messages['additional.help.text'], { platformName })}\n <span className=\"mx-1\">\n <Hyperlink isInline destination={`mailto:${appConfig.INFO_EMAIL}`}>{appConfig.INFO_EMAIL}</Hyperlink>\n </span>\n </p>\n )}\n </Form>\n </div>\n </div>\n </BaseContainer>\n );\n};\n\nexport default ForgotPasswordPage;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiHook.js","sourceRoot":"","sources":["../../../src/forgot-password/data/apiHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAmBvC,MAAM,iBAAiB,GAAG,CAAC,UAAoC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC;IAChF,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,CAC7B,cAAc,CAAC,KAAK,CAAC,CACtB;IACD,SAAS,EAAE,CAAC,IAA0B,EAAE,KAAa,EAAE,EAAE;QACvD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC,KAAe,EAAE,EAAE;;QAC3B,iDAAiD;QACjD,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;YACnC,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,OAAO,EACL,iBAAiB,GAClB,CAAC","sourcesContent":["import { logError, logInfo } from '@openedx/frontend-base';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { forgotPassword } from './api';\n\ninterface ForgotPasswordResult {\n success: boolean
|
|
1
|
+
{"version":3,"file":"apiHook.js","sourceRoot":"","sources":["../../../src/forgot-password/data/apiHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAmBvC,MAAM,iBAAiB,GAAG,CAAC,UAAoC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC;IAChF,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,CAC7B,cAAc,CAAC,KAAK,CAAC,CACtB;IACD,SAAS,EAAE,CAAC,IAA0B,EAAE,KAAa,EAAE,EAAE;QACvD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC,KAAe,EAAE,EAAE;;QAC3B,iDAAiD;QACjD,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;YACnC,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,OAAO,EACL,iBAAiB,GAClB,CAAC","sourcesContent":["import { logError, logInfo } from '@openedx/frontend-base';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { forgotPassword } from './api';\n\ninterface ForgotPasswordResult {\n success: boolean;\n message?: string;\n}\n\ninterface UseForgotPasswordOptions {\n onSuccess?: (data: ForgotPasswordResult, email: string) => void;\n onError?: (error: Error) => void;\n}\n\ninterface ApiError extends Error {\n response?: {\n status: number;\n data: Record<string, unknown>;\n };\n}\n\nconst useForgotPassword = (options: UseForgotPasswordOptions = {}) => useMutation({\n mutationFn: (email: string) => (\n forgotPassword(email)\n ),\n onSuccess: (data: ForgotPasswordResult, email: string) => {\n if (options.onSuccess) {\n options.onSuccess(data, email);\n }\n },\n onError: (error: ApiError) => {\n // Handle different error types like the saga did\n if (error.response?.status === 403) {\n logInfo(error);\n } else {\n logError(error);\n }\n if (options.onError) {\n options.onError(error);\n }\n },\n});\n\nexport {\n useForgotPassword,\n};\n"]}
|
|
@@ -29,7 +29,11 @@ const AccountActivationMessage = ({ messageType }) => {
|
|
|
29
29
|
break;
|
|
30
30
|
}
|
|
31
31
|
case ACCOUNT_ACTIVATION_MESSAGE.ERROR: {
|
|
32
|
-
|
|
32
|
+
// Without a support link configured there is nowhere to point; the sentence
|
|
33
|
+
// still reads correctly with the phrase as plain text.
|
|
34
|
+
const activationEmailSupportLink = useAppConfig().ACTIVATION_EMAIL_SUPPORT_LINK;
|
|
35
|
+
const supportLinkText = formatMessage(messages['account.activation.support.link']);
|
|
36
|
+
const supportLink = activationEmailSupportLink ? (_jsx(Alert.Link, { href: activationEmailSupportLink, children: supportLinkText })) : supportLinkText;
|
|
33
37
|
heading = formatMessage(messages[`account.${activationOrConfirmation}.error.message.title`]);
|
|
34
38
|
activationMessage = (_jsx(FormattedMessage, { id: "account.activation.error.message", defaultMessage: "Something went wrong, please {supportLink} to resolve this issue.", description: "Account activation error message", values: { supportLink } }));
|
|
35
39
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountActivationMessage.js","sourceRoot":"","sources":["../../src/login/AccountActivationMessage.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,wBAAwB,GAAG,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE;IACnD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,WAAW,KAAK,0BAA0B,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC;IAC1F,MAAM,wBAAwB,GAAG,YAAY,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC;IACxG,MAAM,WAAW,GAAG;QAClB,CAAC,0BAA0B,CAAC,OAAO,CAAC,EAAE,WAAW;QACjD,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,KAAK;KAC1C,CAAC;IAEF,IAAI,iBAAiB,CAAC;IACtB,IAAI,OAAO,CAAC;IACZ,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,0BAA0B,CAAC,OAAO,CAAC,CAAC,CAAC;YACxC,OAAO,GA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EAAE,EAAE,WAAW,EAAE,GACvB,CACH,CAAC;YACF,MAAM;QACR,CAAC;QACD;YACE,MAAM;IACV,CAAC;IAED,OAAO,iBAAiB,CAAC,CAAC,CAAC,CACzB,MAAC,KAAK,IACJ,EAAE,EAAC,4BAA4B,EAC/B,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,WAAW,CAAC,WAAW,CAAC,aAE7B,OAAO,IAAI,KAAC,KAAK,CAAC,OAAO,cAAE,OAAO,GAAiB,EACnD,iBAAiB,IACZ,CACT,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF,wBAAwB,CAAC,SAAS,GAAG;IACnC,WAAW,EAAE,SAAS,CAAC,MAAM;CAC9B,CAAC;AAEF,wBAAwB,CAAC,YAAY,GAAG;IACtC,WAAW,EAAE,IAAI;CAClB,CAAC;AAEF,eAAe,wBAAwB,CAAC","sourcesContent":["import { FormattedMessage, useAppConfig, useIntl } from '@openedx/frontend-base';\nimport { Alert } from '@openedx/paragon';\nimport { CheckCircle, Error } from '@openedx/paragon/icons';\nimport PropTypes from 'prop-types';\n\nimport { ACCOUNT_ACTIVATION_MESSAGE } from './data/constants';\nimport messages from './messages';\n\nconst AccountActivationMessage = ({ messageType }) => {\n const { formatMessage } = useIntl();\n\n if (!messageType) {\n return null;\n }\n\n const variant = messageType === ACCOUNT_ACTIVATION_MESSAGE.ERROR ? 'danger' : messageType;\n const activationOrConfirmation = useAppConfig().MARKETING_EMAILS_OPT_IN ? 'confirmation' : 'activation';\n const iconMapping = {\n [ACCOUNT_ACTIVATION_MESSAGE.SUCCESS]: CheckCircle,\n [ACCOUNT_ACTIVATION_MESSAGE.ERROR]: Error,\n };\n\n let activationMessage;\n let heading;\n switch (messageType) {\n case ACCOUNT_ACTIVATION_MESSAGE.SUCCESS: {\n heading = formatMessage(messages[`account.${activationOrConfirmation}.success.message.title`]);\n activationMessage = <span>{formatMessage(messages[`account.${activationOrConfirmation}.success.message`])}</span>;\n break;\n }\n case ACCOUNT_ACTIVATION_MESSAGE.INFO: {\n activationMessage = formatMessage(messages[`account.${activationOrConfirmation}.info.message`]);\n break;\n }\n case ACCOUNT_ACTIVATION_MESSAGE.ERROR: {\n // Without a support link configured there is nowhere to point; the sentence\n // still reads correctly with the phrase as plain text.\n const activationEmailSupportLink = useAppConfig().ACTIVATION_EMAIL_SUPPORT_LINK;\n const supportLinkText = formatMessage(messages['account.activation.support.link']);\n const supportLink = activationEmailSupportLink ? (\n <Alert.Link href={activationEmailSupportLink}>\n {supportLinkText}\n </Alert.Link>\n ) : supportLinkText;\n\n heading = formatMessage(messages[`account.${activationOrConfirmation}.error.message.title`]);\n activationMessage = (\n <FormattedMessage\n id=\"account.activation.error.message\"\n defaultMessage=\"Something went wrong, please {supportLink} to resolve this issue.\"\n description=\"Account activation error message\"\n values={{ supportLink }}\n />\n );\n break;\n }\n default:\n break;\n }\n\n return activationMessage ? (\n <Alert\n id=\"account-activation-message\"\n className=\"mb-5\"\n variant={variant}\n icon={iconMapping[messageType]}\n >\n {heading && <Alert.Heading>{heading}</Alert.Heading>}\n {activationMessage}\n </Alert>\n ) : null;\n};\n\nAccountActivationMessage.propTypes = {\n messageType: PropTypes.string,\n};\n\nAccountActivationMessage.defaultProps = {\n messageType: null,\n};\n\nexport default AccountActivationMessage;\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
|
-
import { getUrlByRouteRole, useIntl } from '@openedx/frontend-base';
|
|
3
|
+
import { getUrlByRouteRole, isInternalUrl, useIntl } from '@openedx/frontend-base';
|
|
4
4
|
import { ActionRow, ModalDialog, useToggle, } from '@openedx/paragon';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { Link, useNavigate } from 'react-router-dom';
|
|
8
|
-
import {
|
|
9
|
-
import { updatePathWithQueryParams } from '../data/utils';
|
|
8
|
+
import { resetPasswordRole } from '../constants';
|
|
9
|
+
import { getDashboardRoute, updatePathWithQueryParams } from '../data/utils';
|
|
10
10
|
import useMobileResponsive from '../data/utils/useMobileResponsive';
|
|
11
11
|
import messages from './messages';
|
|
12
12
|
const ChangePasswordPrompt = ({ variant, redirectUrl }) => {
|
|
@@ -18,8 +18,8 @@ const ChangePasswordPrompt = ({ variant, redirectUrl }) => {
|
|
|
18
18
|
setRedirectToResetPasswordPage(true);
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
|
-
const url = redirectUrl ||
|
|
22
|
-
if (url
|
|
21
|
+
const url = redirectUrl || getDashboardRoute().url;
|
|
22
|
+
if (isInternalUrl(url)) {
|
|
23
23
|
navigate(url);
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangePasswordPrompt.js","sourceRoot":"","sources":["../../src/login/ChangePasswordPrompt.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ChangePasswordPrompt.js","sourceRoot":"","sources":["../../src/login/ChangePasswordPrompt.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EACL,SAAS,EAAE,WAAW,EAAE,SAAS,GAClC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,iB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,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5C,WAAW,EAAE,SAAS,CAAC,MAAM;CAC9B,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { getUrlByRouteRole, isInternalUrl, useIntl } from '@openedx/frontend-base';\nimport {\n ActionRow, ModalDialog, useToggle,\n} from '@openedx/paragon';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport { Link, useNavigate } from 'react-router-dom';\n\nimport { resetPasswordRole } from '../constants';\nimport { getDashboardRoute, updatePathWithQueryParams } from '../data/utils';\nimport useMobileResponsive from '../data/utils/useMobileResponsive';\nimport messages from './messages';\n\nconst ChangePasswordPrompt = ({ variant, redirectUrl }) => {\n const isMobileView = useMobileResponsive();\n const [redirectToResetPasswordPage, setRedirectToResetPasswordPage] = useState(false);\n const handlers = {\n handleToggleOff: () => {\n if (variant === 'block') {\n setRedirectToResetPasswordPage(true);\n } else {\n const url = redirectUrl || getDashboardRoute().url;\n if (isInternalUrl(url)) {\n navigate(url);\n } else {\n window.location.href = url;\n }\n }\n },\n };\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [isOpen, open, close] = useToggle(true, handlers);\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n\n useEffect(() => {\n if (redirectToResetPasswordPage) {\n navigate(updatePathWithQueryParams(getUrlByRouteRole(resetPasswordRole)));\n }\n }, [redirectToResetPasswordPage, navigate]);\n\n return (\n <ModalDialog\n title=\"Password security\"\n isOpen={isOpen}\n onClose={close}\n size={isMobileView ? 'sm' : 'md'}\n hasCloseButton={false}\n >\n <ModalDialog.Header>\n <ModalDialog.Title>\n {formatMessage(messages[`password.security.${variant}.title`])}\n </ModalDialog.Title>\n </ModalDialog.Header>\n <ModalDialog.Body>\n {formatMessage(messages[`password.security.${variant}.body`])}\n </ModalDialog.Body>\n <ModalDialog.Footer>\n <ActionRow className={classNames(\n { 'd-flex flex-column': isMobileView },\n )}\n >\n {variant === 'nudge' ? (\n <ModalDialog.CloseButton id=\"password-security-close\" variant=\"tertiary\">\n {formatMessage(messages['password.security.close.button'])}\n </ModalDialog.CloseButton>\n ) : null}\n <Link\n id=\"password-security-reset-password\"\n className={classNames(\n 'btn btn-primary',\n { 'w-100': isMobileView },\n )}\n to={updatePathWithQueryParams(getUrlByRouteRole(resetPasswordRole))}\n >\n {formatMessage(messages['password.security.redirect.to.reset.password.button'])}\n </Link>\n </ActionRow>\n </ModalDialog.Footer>\n </ModalDialog>\n );\n};\n\nChangePasswordPrompt.defaultProps = {\n variant: 'block',\n redirectUrl: null,\n};\n\nChangePasswordPrompt.propTypes = {\n variant: PropTypes.oneOf(['nudge', 'block']),\n redirectUrl: PropTypes.string,\n};\n\nexport default ChangePasswordPrompt;\n"]}
|
package/dist/login/LoginPage.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
11
|
import { useEffect, useMemo, useState } from 'react';
|
|
12
|
-
import { fetchAuthenticatedUser, hydrateAuthenticatedUser, getSiteConfig, getUrlByRouteRole, sendPageEvent, sendTrackEvent, useIntl, } from '@openedx/frontend-base';
|
|
12
|
+
import { fetchAuthenticatedUser, hydrateAuthenticatedUser, getSiteConfig, getUrlByRouteRole, isInternalUrl, sendPageEvent, sendTrackEvent, useIntl, } from '@openedx/frontend-base';
|
|
13
13
|
import { Form, StatefulButton } from '@openedx/paragon';
|
|
14
14
|
import PropTypes from 'prop-types';
|
|
15
15
|
import { Helmet } from 'react-helmet';
|
|
@@ -31,7 +31,7 @@ import { INVALID_FORM, TPA_AUTHENTICATION_FAILURE } from './data/constants';
|
|
|
31
31
|
import LoginFailureMessage from './LoginFailure';
|
|
32
32
|
import messages from './messages';
|
|
33
33
|
const LoginPage = ({ institutionLogin, handleInstitutionLogin, }) => {
|
|
34
|
-
var _a
|
|
34
|
+
var _a;
|
|
35
35
|
// Context for third-party auth
|
|
36
36
|
const { thirdPartyAuthApiStatus, thirdPartyAuthContext, setThirdPartyAuthContextBegin, setThirdPartyAuthContextSuccess, setThirdPartyAuthContextFailure, } = useThirdPartyAuthContext();
|
|
37
37
|
const location = useLocation();
|
|
@@ -46,7 +46,7 @@ const LoginPage = ({ institutionLogin, handleInstitutionLogin, }) => {
|
|
|
46
46
|
const { mutate: loginUser, isPending: isLoggingIn } = useLogin({
|
|
47
47
|
onSuccess: (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
48
|
const redirectUrl = localNextPath || data.redirectUrl || '';
|
|
49
|
-
if (redirectUrl
|
|
49
|
+
if (isInternalUrl(redirectUrl)) {
|
|
50
50
|
yield fetchAuthenticatedUser({ forceRefresh: true });
|
|
51
51
|
// Hydrate in the background — publishes AUTHENTICATED_USER_CHANGED after
|
|
52
52
|
// SPA navigation, so the header picks up the full user profile (avatar, etc.)
|
|
@@ -67,7 +67,7 @@ const LoginPage = ({ institutionLogin, handleInstitutionLogin, }) => {
|
|
|
67
67
|
const { formatMessage } = useIntl();
|
|
68
68
|
const activationMsgType = getActivationStatus();
|
|
69
69
|
const queryParams = useMemo(() => getAllPossibleQueryParams(), []);
|
|
70
|
-
const localNextPath =
|
|
70
|
+
const localNextPath = queryParams.next && isInternalUrl(queryParams.next) ? queryParams.next : null;
|
|
71
71
|
const tpaHint = useMemo(() => getTpaHint(), []);
|
|
72
72
|
const params = Object.assign({}, queryParams);
|
|
73
73
|
if (tpaHint) {
|