From 9159fd3801f0faa432e17fc16391de8265c2fb1f Mon Sep 17 00:00:00 2001 From: Darya Umrikhina Date: Fri, 9 Aug 2024 18:24:32 +0400 Subject: [PATCH] Client:Pages:Confirm: remove old confirm pages --- .../src/pages/Confirm/ConfirmWrapper.js | 96 --- packages/client/src/pages/Confirm/index.js | 39 - .../sub-components/GreetingUserContainer.js | 83 -- .../sub-components/LanguageCombobox.tsx | 69 -- .../Confirm/sub-components/StyledConfirm.js | 170 ---- .../sub-components/StyledCreateUser.js | 177 ---- .../Confirm/sub-components/activateEmail.js | 107 --- .../Confirm/sub-components/activateUser.js | 312 ------- .../src/pages/Confirm/sub-components/auth.js | 110 --- .../Confirm/sub-components/changeEmail.js | 126 --- .../Confirm/sub-components/changeOwner.js | 145 ---- .../Confirm/sub-components/changePassword.js | 244 ------ .../Confirm/sub-components/changePhone.js | 104 --- .../Confirm/sub-components/continuePortal.js | 136 ---- .../Confirm/sub-components/createUser.js | 770 ------------------ .../sub-components/deactivatePortal.js | 143 ---- .../Confirm/sub-components/profileRemove.js | 168 ---- .../Confirm/sub-components/removePortal.js | 139 ---- .../Confirm/sub-components/tfaActivation.js | 361 -------- .../pages/Confirm/sub-components/tfaAuth.js | 222 ----- .../client/src/pages/Confirm/withLoader.js | 196 ----- 21 files changed, 3917 deletions(-) delete mode 100644 packages/client/src/pages/Confirm/ConfirmWrapper.js delete mode 100644 packages/client/src/pages/Confirm/index.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/GreetingUserContainer.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/LanguageCombobox.tsx delete mode 100644 packages/client/src/pages/Confirm/sub-components/StyledConfirm.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/StyledCreateUser.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/activateEmail.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/activateUser.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/auth.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/changeEmail.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/changeOwner.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/changePassword.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/changePhone.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/continuePortal.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/createUser.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/deactivatePortal.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/profileRemove.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/removePortal.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/tfaActivation.js delete mode 100644 packages/client/src/pages/Confirm/sub-components/tfaAuth.js delete mode 100644 packages/client/src/pages/Confirm/withLoader.js diff --git a/packages/client/src/pages/Confirm/ConfirmWrapper.js b/packages/client/src/pages/Confirm/ConfirmWrapper.js deleted file mode 100644 index bfcd20c74d..0000000000 --- a/packages/client/src/pages/Confirm/ConfirmWrapper.js +++ /dev/null @@ -1,96 +0,0 @@ -// (c) Copyright Ascensio System SIA 2009-2024 -// -// This program is a free software product. -// You can redistribute it and/or modify it under the terms -// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software -// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended -// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of -// any third-party rights. -// -// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see -// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html -// -// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. -// -// The interactive user interfaces in modified source and object code versions of the Program must -// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. -// -// Pursuant to Section 7(b) of the License you must retain the original Product logo when -// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under -// trademark law for use of our trademarks. -// -// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing -// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 -// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - -import React from "react"; -import styled, { css } from "styled-components"; -import { isIOS, isFirefox, isMobileOnly } from "react-device-detect"; -import { inject, observer } from "mobx-react"; -import { getBgPattern } from "@docspace/shared/utils/common"; -import { mobile } from "@docspace/shared/utils"; -import { Scrollbar } from "@docspace/shared/components/scrollbar"; - -const StyledWrapper = styled.div` - height: ${(props) => - props.height - ? props.height - : isIOS && !isFirefox - ? "calc(var(--vh, 1vh) * 100)" - : "100vh"}; - width: 100vw; - z-index: 0; - display: flex; - flex-direction: row; - box-sizing: border-box; - - @media ${mobile} { - height: auto; - min-height: 100%; - width: 100%; - min-width: 100%; - } -`; - -const BgBlock = styled.div` - background-image: ${(props) => props.bgPattern}; - background-repeat: no-repeat; - background-attachment: fixed; - background-size: cover; - position: fixed; - top: 0; - right: 0; - left: 0; - bottom: 0; - z-index: -1; - - @media ${mobile} { - background-image: none; - } -`; - -const ConfirmWrapper = (props) => { - const { children, currentColorScheme, height } = props; - const bgPattern = getBgPattern(currentColorScheme?.id); - const content = ( - <> - - {children} - - ); - - return ( - - {!!height ? content : {content}} - - ); -}; - -export default inject(({ settingsStore }) => { - const { currentColorScheme } = settingsStore; - - return { - currentColorScheme, - }; -})(observer(ConfirmWrapper)); diff --git a/packages/client/src/pages/Confirm/index.js b/packages/client/src/pages/Confirm/index.js deleted file mode 100644 index b4e4eb6c84..0000000000 --- a/packages/client/src/pages/Confirm/index.js +++ /dev/null @@ -1,39 +0,0 @@ -// (c) Copyright Ascensio System SIA 2009-2024 -// -// This program is a free software product. -// You can redistribute it and/or modify it under the terms -// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software -// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended -// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of -// any third-party rights. -// -// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see -// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html -// -// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. -// -// The interactive user interfaces in modified source and object code versions of the Program must -// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. -// -// Pursuant to Section 7(b) of the License you must retain the original Product logo when -// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under -// trademark law for use of our trademarks. -// -// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing -// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 -// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - -import { Outlet } from "react-router-dom"; - -import ErrorBoundaryWrapper from "SRC_DIR/components/ErrorBoundaryWrapper"; - -export const Component = () => { - //console.log("Confirm render"); - - return ( - - - - ); -}; diff --git a/packages/client/src/pages/Confirm/sub-components/GreetingUserContainer.js b/packages/client/src/pages/Confirm/sub-components/GreetingUserContainer.js deleted file mode 100644 index 65ce1d5c82..0000000000 --- a/packages/client/src/pages/Confirm/sub-components/GreetingUserContainer.js +++ /dev/null @@ -1,83 +0,0 @@ -// (c) Copyright Ascensio System SIA 2009-2024 -// -// This program is a free software product. -// You can redistribute it and/or modify it under the terms -// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software -// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended -// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of -// any third-party rights. -// -// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see -// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html -// -// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. -// -// The interactive user interfaces in modified source and object code versions of the Program must -// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. -// -// Pursuant to Section 7(b) of the License you must retain the original Product logo when -// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under -// trademark law for use of our trademarks. -// -// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing -// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 -// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - -import { useTranslation, Trans } from "react-i18next"; - -import { ColorTheme, ThemeId } from "@docspace/shared/components/color-theme"; -import { IconButton } from "@docspace/shared/components/icon-button"; -import { Text } from "@docspace/shared/components/text"; - -import ArrowIcon from "PUBLIC_DIR/images/arrow.left.react.svg?url"; -import { PRODUCT_NAME } from "@docspace/shared/constants"; - -const DEFAULT_CREATION_TEXT = - "A {{productName}} account will be created for {{email}}. Please, complete your registration:"; - -const GreetingUserContainer = ({ - email, - onClickBack, - emailFromLink, - type, - defaultText, -}) => { - const { t } = useTranslation(["Confirm", "Common"]); - - return ( -
-
- {type === "LinkInvite" && !emailFromLink && ( -
- - - {t("Common:Back")} - -
- )} - - - {t("SignUp")} - -
- - , - }} - /> - -
- ); -}; - -export default GreetingUserContainer; diff --git a/packages/client/src/pages/Confirm/sub-components/LanguageCombobox.tsx b/packages/client/src/pages/Confirm/sub-components/LanguageCombobox.tsx deleted file mode 100644 index 0379f3104c..0000000000 --- a/packages/client/src/pages/Confirm/sub-components/LanguageCombobox.tsx +++ /dev/null @@ -1,69 +0,0 @@ -// (c) Copyright Ascensio System SIA 2009-2024 -// -// This program is a free software product. -// You can redistribute it and/or modify it under the terms -// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software -// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended -// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of -// any third-party rights. -// -// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see -// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html -// -// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. -// -// The interactive user interfaces in modified source and object code versions of the Program must -// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. -// -// Pursuant to Section 7(b) of the License you must retain the original Product logo when -// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under -// trademark law for use of our trademarks. -// -// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing -// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 -// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - -import { inject, observer } from "mobx-react"; -import { setLanguageForUnauthorized } from "@docspace/shared/utils/common"; -import { LanguageCombobox } from "@docspace/shared/components/language-combobox"; -import { TPortalCultures } from "@docspace/shared/api/settings/types"; -import { DeviceType } from "@docspace/shared/enums"; - -export interface TLanguageCombobox { - cultures: TPortalCultures; - currentDeviceType: string; - currentCultureName: string; -} - -const LanguageComboboxWrapper = (props: TLanguageCombobox) => { - const { cultures, currentCultureName, currentDeviceType } = props; - - const onLanguageSelect = (culture: { key: string }) => { - const { key } = culture; - - setLanguageForUnauthorized(key); - }; - - const isMobileView = currentDeviceType === DeviceType.mobile; - - if (isMobileView) return <>; - - return ( - - ); -}; - -export default inject(({ settingsStore }) => { - const { currentDeviceType } = settingsStore; - - return { - currentDeviceType, - }; -})(observer(LanguageComboboxWrapper)); diff --git a/packages/client/src/pages/Confirm/sub-components/StyledConfirm.js b/packages/client/src/pages/Confirm/sub-components/StyledConfirm.js deleted file mode 100644 index 9783cd124f..0000000000 --- a/packages/client/src/pages/Confirm/sub-components/StyledConfirm.js +++ /dev/null @@ -1,170 +0,0 @@ -// (c) Copyright Ascensio System SIA 2009-2024 -// -// This program is a free software product. -// You can redistribute it and/or modify it under the terms -// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software -// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended -// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of -// any third-party rights. -// -// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see -// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html -// -// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. -// -// The interactive user interfaces in modified source and object code versions of the Program must -// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. -// -// Pursuant to Section 7(b) of the License you must retain the original Product logo when -// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under -// trademark law for use of our trademarks. -// -// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing -// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 -// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - -import styled from "styled-components"; -import { - mobile, - tablet, - getCorrectFourValuesStyle, -} from "@docspace/shared/utils"; - -export const StyledPage = styled.div` - display: flex; - flex-direction: column; - align-items: center; - margin: 0 auto; - max-width: 960px; - box-sizing: border-box; - - @media ${tablet} { - padding: 0 16px; - } - - @media ${mobile} { - width: 100%; - padding: ${({ theme }) => - getCorrectFourValuesStyle("32px 8px 0 16px", theme.interfaceDirection)}; - - .language-combo-box { - display: none; - } - } - - .subtitle { - margin-bottom: 32px; - } - - .password-form { - width: 100%; - margin-bottom: 8px; - } - - .subtitle { - margin-bottom: 32px; - } - - .language-combo-box { - position: absolute; - right: 28px; - top: 28px; - } -`; - -export const StyledContent = styled.div` - min-height: 100vh; - flex: 1 0 auto; - flex-direction: column; - display: flex; - align-items: center; - justify-content: center; - margin: 0 auto; - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - - @media ${mobile} { - width: 100%; - justify-content: start; - min-height: 100%; - } -`; - -export const StyledHeader = styled.div` - .title { - margin-bottom: 32px; - text-align: center; - } - - .subtitle { - margin-bottom: 32px; - } - - .portal-logo { - display: flex; - align-items: center; - justify-content: center; - padding-bottom: 40px; - } - - @media ${mobile} { - margin-top: 0; - } -`; - -export const StyledBody = styled.div` - display: flex; - flex-direction: column; - align-items: center; - margin: 56px auto; - - @media ${mobile} { - width: 100%; - margin: 0 auto; - } - - .title { - margin-bottom: 32px; - text-align: center; - } - - .subtitle { - margin-bottom: 32px; - } - - .portal-logo { - display: flex; - align-items: center; - justify-content: center; - padding-bottom: 40px; - } - - .password-field-wrapper { - width: 100%; - } - - .password-change-form { - margin-top: 32px; - margin-bottom: 16px; - } - - .phone-input { - margin-bottom: 24px; - } - - .delete-profile-confirm { - margin-bottom: 8px; - } - - .phone-title { - margin-bottom: 8px; - } -`; - -export const ButtonsWrapper = styled.div` - display: flex; - flex-direction: row; - gap: 16px; - width: 100%; -`; diff --git a/packages/client/src/pages/Confirm/sub-components/StyledCreateUser.js b/packages/client/src/pages/Confirm/sub-components/StyledCreateUser.js deleted file mode 100644 index 7d9f8d9247..0000000000 --- a/packages/client/src/pages/Confirm/sub-components/StyledCreateUser.js +++ /dev/null @@ -1,177 +0,0 @@ -// (c) Copyright Ascensio System SIA 2009-2024 -// -// This program is a free software product. -// You can redistribute it and/or modify it under the terms -// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software -// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended -// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of -// any third-party rights. -// -// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see -// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html -// -// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. -// -// The interactive user interfaces in modified source and object code versions of the Program must -// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. -// -// Pursuant to Section 7(b) of the License you must retain the original Product logo when -// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under -// trademark law for use of our trademarks. -// -// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing -// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 -// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - -import styled, { css } from "styled-components"; -import { Box } from "@docspace/shared/components/box"; -import { mobile, tablet } from "@docspace/shared/utils"; - -const DESKTOP_WIDTH = 384; -const TABLET_WIDTH = 480; - -export const StyledCreateUserContent = styled.div` - margin: 88px auto; - - @media ${mobile} { - margin-top: 0px; - } -`; - -export const GreetingContainer = styled.div` - display: flex; - flex-direction: column; - align-items: left; - height: 100%; - width: ${DESKTOP_WIDTH}px; - - margin-bottom: 32px; - - @media ${tablet} { - width: 100%; - max-width: ${TABLET_WIDTH}px; - } - - .tooltip { - p { - text-align: center; - } - - @media ${mobile} { - padding: 0 25px; - } - } - - .portal-logo { - width: 100%; - padding-bottom: 16px; - height: 26.56px; - display: flex; - align-items: center; - justify-content: center; - - .injected-svg { - height: 26.56px; - } - } -`; - -export const RegisterContainer = styled.div` - - height: 100%; - width: 100%; - - .or-label { - color: ${(props) => props.theme.invitePage.textColor}; - margin: 0 8px; - } - - - .line { - display: flex; - width: 100%; - align-items: center; - color: ${(props) => props.theme.invitePage.borderColor}; - padding-top: 35px; - margin-bottom: 32px; - } - - .line:before, - .line:after { - content: ""; - flex-grow: 1; - background: ${(props) => props.theme.invitePage.borderColor}; - height: 1px; - font-size: 0px; - line-height: 0px; - margin: 0px; - } - - .auth-form-fields { - width: 100%; - - .password-field{ - margin-bottom: 24px; - } - - .email-container{ - ${(props) => props.registrationForm && "display:none"}; - } - @media ${tablet} { - width: 100%; - } - @media ${mobile} { - width: 100%; - } - } - - .password-field-wrapper { - width: 100%; - } - - .greeting-container{ - margin-bottom: 32px; - p{ - text-align: center; - } - .back-sign-in-container { - display: flex; - align-items: center; - justify-content: center; - position: relative; - - margin-bottom: 16px; - .back-button { - position: absolute; - max-width: 60px; - text-overflow: ellipsis; - overflow: hidden; - ${(props) => - props.theme.interfaceDirection === "rtl" - ? css` - right: 0; - ` - : css` - left: 0; - `}; - display: flex; - gap: 4px; - - svg { - ${(props) => - props.theme.interfaceDirection === "rtl" && - " transform: rotate(180deg)"}; - } - - p { - color: ${(props) => props.theme.login.backTitle.color}; - } - - p:hover { - cursor: pointer; - } - } - } - } -}`; diff --git a/packages/client/src/pages/Confirm/sub-components/activateEmail.js b/packages/client/src/pages/Confirm/sub-components/activateEmail.js deleted file mode 100644 index 3d37ba3a42..0000000000 --- a/packages/client/src/pages/Confirm/sub-components/activateEmail.js +++ /dev/null @@ -1,107 +0,0 @@ -// (c) Copyright Ascensio System SIA 2009-2024 -// -// This program is a free software product. -// You can redistribute it and/or modify it under the terms -// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software -// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended -// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of -// any third-party rights. -// -// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see -// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html -// -// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. -// -// The interactive user interfaces in modified source and object code versions of the Program must -// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. -// -// Pursuant to Section 7(b) of the License you must retain the original Product logo when -// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under -// trademark law for use of our trademarks. -// -// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing -// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 -// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - -import React, { useEffect } from "react"; -import PropTypes from "prop-types"; -import { inject, observer } from "mobx-react"; - -import { Loader } from "@docspace/shared/components/loader"; -import Section from "@docspace/shared/components/section"; -import { combineUrl } from "@docspace/shared/utils/combineUrl"; -import tryRedirectTo from "@docspace/shared/utils/tryRedirectTo"; -import { EmployeeActivationStatus } from "@docspace/shared/enums"; -import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; -import SectionWrapper from "SRC_DIR/components/Section"; - -const ActivateEmail = ({ updateEmailActivationStatus, linkData }) => { - const [email, uid, key] = [ - linkData.email, - linkData.uid, - linkData.confirmHeader, - ]; - - useEffect(() => { - updateEmailActivationStatus(EmployeeActivationStatus.Activated, uid, key) - .then((res) => { - tryRedirectTo( - combineUrl( - window.ClientConfig?.proxy?.url, - `/login?confirmedEmail=${email}`, - ), - ); - }) - .catch((error) => { - // console.log('activate email error', e); - let errorMessage = ""; - if (typeof error === "object") { - errorMessage = - error?.response?.data?.error?.message || - error?.statusText || - error?.message || - ""; - } else { - errorMessage = error; - } - - tryRedirectTo( - combineUrl( - window.ClientConfig?.proxy?.url, - `/login/error?message=${errorMessage}`, - ), - ); - }); - }, [email, key, updateEmailActivationStatus, uid]); - - // console.log('Activate email render'); - return ; -}; - -ActivateEmail.propTypes = { - location: PropTypes.object.isRequired, -}; - -const ActivateEmailForm = (props) => ( - - - - - -); - -const ComponentWrapper = inject(({ userStore }) => { - const { updateEmailActivationStatus } = userStore; - return { - updateEmailActivationStatus, - }; -})(observer(ActivateEmailForm)); - -export const Component = () => { - return ( - - - - ); -}; diff --git a/packages/client/src/pages/Confirm/sub-components/activateUser.js b/packages/client/src/pages/Confirm/sub-components/activateUser.js deleted file mode 100644 index 4c4703bcb1..0000000000 --- a/packages/client/src/pages/Confirm/sub-components/activateUser.js +++ /dev/null @@ -1,312 +0,0 @@ -// (c) Copyright Ascensio System SIA 2009-2024 -// -// This program is a free software product. -// You can redistribute it and/or modify it under the terms -// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software -// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended -// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of -// any third-party rights. -// -// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty -// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see -// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html -// -// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. -// -// The interactive user interfaces in modified source and object code versions of the Program must -// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. -// -// Pursuant to Section 7(b) of the License you must retain the original Product logo when -// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under -// trademark law for use of our trademarks. -// -// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing -// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 -// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - -import React, { useState } from "react"; -import { withTranslation } from "react-i18next"; -import { TextInput } from "@docspace/shared/components/text-input"; -import { PasswordInput } from "@docspace/shared/components/password-input"; -import { Button } from "@docspace/shared/components/button"; -import { FieldContainer } from "@docspace/shared/components/field-container"; -import { inject, observer } from "mobx-react"; -import { EmployeeActivationStatus } from "@docspace/shared/enums"; -import { - changePassword, - updateActivationStatus, - updateUser, -} from "@docspace/shared/api/people"; -import { createPasswordHash } from "@docspace/shared/utils/common"; -import { toastr } from "@docspace/shared/components/toast"; -import { getPasswordErrorMessage } from "@docspace/shared/utils/getPasswordErrorMessage"; -import { FormWrapper } from "@docspace/shared/components/form-wrapper"; - -import { StyledPage, StyledHeader } from "./StyledConfirm"; -import withLoader from "../withLoader"; - -import { - GreetingContainer, - RegisterContainer, - StyledCreateUserContent, -} from "./StyledCreateUser"; -import PortalLogo from "@docspace/shared/components/portal-logo/PortalLogo"; -import GreetingUserContainer from "./GreetingUserContainer"; -import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; -import { AuthenticatedAction } from "SRC_DIR/helpers/enums"; -import { ALLOWED_PASSWORD_CHARACTERS } from "@docspace/shared/constants"; - -const ActivateUserForm = (props) => { - const { t, settings, linkData, hashSettings, defaultPage, login } = props; - - const emailFromLink = linkData?.email ? linkData.email : ""; - const [name, setName] = useState(linkData.firstname); - const [nameValid, setNameValid] = useState(true); - const [surName, setSurName] = useState(linkData.lastname); - const [surNameValid, setSurNameValid] = useState(true); - const [password, setPassword] = useState(""); - const [passwordValid, setPasswordValid] = useState(true); - const [isPasswordErrorShow, setIsPasswordErrorShow] = useState(false); - const [isLoading, setIsLoading] = useState(false); - - const onChangeName = (e) => { - setName(e.target.value); - setNameValid(true); - }; - - const onChangeSurName = (e) => { - setSurName(e.target.value); - setSurNameValid(true); - }; - - const onChangePassword = (e) => { - setPassword(e.target.value); - }; - - const onValidatePassword = (res) => { - setPasswordValid(res); - }; - - const onBlurPassword = () => { - setIsPasswordErrorShow(true); - }; - - const onSubmit = async () => { - setIsLoading(true); - if (!name.trim()) setNameValid(false); - if (!surName.trim()) setSurNameValid(false); - if (!password.trim()) { - setPasswordValid(false); - setIsPasswordErrorShow(true); - } - - if (!nameValid || !surNameValid || !password.trim() || !passwordValid) { - setIsLoading(false); - return; - } - - const hash = createPasswordHash(password, hashSettings); - - const loginData = { - userName: linkData.email, - passwordHash: hash, - }; - - const personalData = { - firstname: name, - lastname: surName, - }; - - try { - await activateConfirmUser( - personalData, - loginData, - linkData.confirmHeader, - linkData.uid, - EmployeeActivationStatus.Activated, - ); - - setIsLoading(false); - - window.location.replace(defaultPage); - } catch (error) { - //console.error(error); - setIsLoading(false); - toastr.error(error); - } - }; - - const activateConfirmUser = async ( - personalData, - loginData, - key, - userId, - activationStatus, - ) => { - const changedData = { - id: userId, - FirstName: personalData.firstname, - LastName: personalData.lastname, - }; - - const { userName, passwordHash } = loginData; - - const res1 = await changePassword(userId, loginData.passwordHash, key); - const res2 = await updateActivationStatus(activationStatus, userId, key); - const res3 = await login(userName, passwordHash); - const res4 = await updateUser(changedData); - }; - - const onKeyPress = (event) => { - if (event.key === "Enter") { - onSubmit(); - } - }; - - return ( - - - - - - - - - - -
- - - - - - - - - - - - - - -