demo account

master
alex 2024-02-18 19:43:55 +01:00
parent 43b29282de
commit c7f08d9733
4 changed files with 52 additions and 1 deletions

View File

@ -26,6 +26,7 @@ const StoreCalendarAuth = lazy(() => import("../../Pages/Store/Calendar/Auth"));
//const Support = lazy(() => import("../../Pages/Support")); //const Support = lazy(() => import("../../Pages/Support"));
//const Feedback = lazy(() => import("../../Pages/Feedback")); //const Feedback = lazy(() => import("../../Pages/Feedback"));
const UserProfile = lazy(() => import("../../Pages/UserProfile")); const UserProfile = lazy(() => import("../../Pages/UserProfile"));
const RedirectToDemo = lazy(() => import("../../Pages/RedirectToDemo"));
export function AuthenticationRoutes() { export function AuthenticationRoutes() {
return ( return (
@ -84,6 +85,15 @@ export function AuthenticationRoutes() {
} }
/> />
<Route
path={Constants.ROUTE_PATHS.DEMO}
element={
<MySupsenseFallback>
<RedirectToDemo />
</MySupsenseFallback>
}
/>
<Route <Route
path="*" path="*"
element={<Navigate to={Constants.ROUTE_PATHS.AUTHENTICATION.LOGIN} />} element={<Navigate to={Constants.ROUTE_PATHS.AUTHENTICATION.LOGIN} />}

View File

@ -0,0 +1,34 @@
import { useEffect } from "react";
import MyCenteredSpin from "../../Components/MyCenteredSpin";
import {
myFetch,
setUserSessionToLocalStorage,
showUnkownErrorNotification,
} from "../../utils";
import { useTranslation } from "react-i18next";
import { notification } from "antd";
export default function RedirectToDemo() {
const { t } = useTranslation();
const [notificationApi, notificationContextHolder] =
notification.useNotification();
useEffect(() => {
myFetch({
url: "/user/demo",
method: "GET",
})
.then((response) => {
setUserSessionToLocalStorage(response.XAuthorization);
window.location.href = "/";
})
.catch(() => showUnkownErrorNotification(notificationApi, t));
}, []);
return (
<>
{notificationContextHolder}
<MyCenteredSpin fullHeight />
</>
);
}

View File

@ -406,6 +406,7 @@ function YourProfileChangeEmailModal() {
method: "POST", method: "POST",
body: { body: {
email: values.email, email: values.email,
password: EncodeStringToBase64(values.password),
}, },
}) })
.then(() => { .then(() => {
@ -421,7 +422,10 @@ function YourProfileChangeEmailModal() {
), ),
}); });
}) })
.catch(() => setIsRequesting(false)); .catch(() => {
setIsRequesting(false);
showPasswordIncorrectNotification(notificationApi, t);
});
}) })
.catch(() => setIsRequesting(false)); .catch(() => setIsRequesting(false));
}} }}
@ -434,6 +438,8 @@ function YourProfileChangeEmailModal() {
</Typography.Paragraph> </Typography.Paragraph>
<MyEmailFormInput hasFeedback newEmail /> <MyEmailFormInput hasFeedback newEmail />
<MyPasswordFormInput />
</Form> </Form>
</MyModal> </MyModal>
</> </>

View File

@ -66,6 +66,7 @@ export const Constants = {
FEEDBACK: "/feedback", FEEDBACK: "/feedback",
SUPPORT: "/support", SUPPORT: "/support",
USER_PROFILE: "/user-profile", USER_PROFILE: "/user-profile",
DEMO: "/demo",
}, },
GLOBALS: { GLOBALS: {
MIN_USERNAME_LENGTH: 3, MIN_USERNAME_LENGTH: 3,