From b4f7c427f9f2151f44e90e5432794d96f78968fc Mon Sep 17 00:00:00 2001 From: Viktor Fomin Date: Sat, 2 Apr 2022 21:10:58 +0300 Subject: [PATCH 01/30] Web: Client: add settings translates --- web/ASC.Web.Client/public/locales/en/Settings.json | 3 +++ web/ASC.Web.Client/public/locales/ru/Settings.json | 3 +++ 2 files changed, 6 insertions(+) diff --git a/web/ASC.Web.Client/public/locales/en/Settings.json b/web/ASC.Web.Client/public/locales/en/Settings.json index c2f3cd3740..b6e36d36df 100644 --- a/web/ASC.Web.Client/public/locales/en/Settings.json +++ b/web/ASC.Web.Client/public/locales/en/Settings.json @@ -127,6 +127,9 @@ "ThirdPartyStorage": "Third-party storage", "ThirdPartyStorageDescription": "Backup can be saved to a third-party storage. Before, you need to connect the corresponding service in the 'Integration' section. Otherwise, the following settings will be inactive.", "TimeZone": "Time Zone", + "TrustedMail": "Trusted mail domain settings", + "TrustedMailDescription": "Trusted Mail Domain Settings is a way to specify the mail servers used for user self-registration.", + "TrustedMailHelper": "You can either check the Custom domains option and enter the trusted mail server in the field below so that a person who has an account at it will be able to register him(her)self by clicking the Join link on the Sign In page or disable this option.", "TwoFactorAuth": "Two-factor authentication", "TwoFactorAuthDescription": "Two-factor authentication provides a more secure way to log in. After entering the credentials, the user will have to enter a code from an SMS or the authentication app. ", "TwoFactorAuthHelper": "Note: SMS messages can be sent if you have a positive balance only. You can always check your current balance in your SMS provider account. Do not forget to replenish your balance in good time. ", diff --git a/web/ASC.Web.Client/public/locales/ru/Settings.json b/web/ASC.Web.Client/public/locales/ru/Settings.json index 142c910e7f..b078bda17c 100644 --- a/web/ASC.Web.Client/public/locales/ru/Settings.json +++ b/web/ASC.Web.Client/public/locales/ru/Settings.json @@ -128,6 +128,9 @@ "ThirdPartyResource": "Сторонний ресурс", "ThirdPartyResourceDescription": "Резервная копия может быть сохранена на вашем стороннем ресурсе (Dropbox, Box.com, OneDrive или Google Drive). Прежде чем Вы сможете сохранять резервные копии в стороннем аккаунте (Dropbox, Box.com, OneDrive или Google Drive), потребуется подключить его к папке 'Общие'", "TimeZone": "Часовой пояс", + "TrustedMail": "Настройки доверенных почтовых доменов", + "TrustedMailDescription": "Настройки доверенных почтовых доменов позволяют указать почтовые серверы, которые могут использовать пользователи при самостоятельной регистрации в ONLYOFFICE.", + "TrustedMailHelper": "Можно отметить опцию Пользовательские домены и ввести доверенный почтовый сервер в поле ниже, чтобы любой сотрудник вашей компании, имеющий учетную запись на указанном почтовом сервере, смог зарегистрироваться самостоятельно, нажав ссылку Присоединиться на странице входа и введя адрес электронной почты с именем доверенного домена, который Вы добавили.", "TwoFactorAuth": "Двухфакторная аутентификация", "TwoFactorAuthDescription": "Двухфакторная аутентификация обеспечивает более безопасный способ входа на портал. После ввода учетных данных пользователь должен будет ввести код из SMS или приложения для аутентификации.", "TwoFactorAuthHelper": "Обратите внимание: отправка SMS-сообщений осуществляется только при положительном балансе. Вы всегда можете проверить текущий баланс в учетной записи вашего SMS-провайдера. Не забывайте своевременно пополнять баланс. ", From 22493d1c3d5e2379d4728cb446250a8d9f9c5316 Mon Sep 17 00:00:00 2001 From: Viktor Fomin Date: Sat, 2 Apr 2022 22:19:58 +0300 Subject: [PATCH 02/30] Web: Client: Settings: add user fields component --- .../security/sub-components/svg/index.js | 2 + .../sub-components/svg/plus.react.svg | 10 +++ .../sub-components/svg/trash.react.svg | 10 +++ .../security/sub-components/user-fields.js | 87 +++++++++++++++++++ 4 files changed, 109 insertions(+) create mode 100644 web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/svg/index.js create mode 100644 web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/svg/plus.react.svg create mode 100644 web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/svg/trash.react.svg create mode 100644 web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/user-fields.js diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/svg/index.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/svg/index.js new file mode 100644 index 0000000000..af0f357f5f --- /dev/null +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/svg/index.js @@ -0,0 +1,2 @@ +export { default as PlusIcon } from "./plus.react.svg"; +export { default as TrashIcon } from "./trash.react.svg"; diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/svg/plus.react.svg b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/svg/plus.react.svg new file mode 100644 index 0000000000..70de5971f9 --- /dev/null +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/svg/plus.react.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/svg/trash.react.svg b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/svg/trash.react.svg new file mode 100644 index 0000000000..e90cc12756 --- /dev/null +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/svg/trash.react.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/user-fields.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/user-fields.js new file mode 100644 index 0000000000..616558b1cd --- /dev/null +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/sub-components/user-fields.js @@ -0,0 +1,87 @@ +import React, { useState } from "react"; +import styled from "styled-components"; +import commonIconsStyles from "@appserver/components/utils/common-icons-style"; +import { PlusIcon, TrashIcon } from "./svg"; +import Link from "@appserver/components/link"; +import TextInput from "@appserver/components/text-input"; + +const StyledPlusIcon = styled(PlusIcon)` + ${commonIconsStyles} +`; + +const StyledTrashIcon = styled(TrashIcon)` + ${commonIconsStyles} + cursor: pointer; +`; + +const StyledInputWrapper = styled.div` + display: flex; + flex-direction: row; + gap: 10px; + align-items: center; + margin-bottom: 8px; + width: 370px; +`; + +const StyledAddWrapper = styled.div` + display: flex; + flex-direction: row; + gap: 6px; + align-items: center; + cursor: pointer; +`; + +const UserFields = () => { + const [inputs, setInputs] = useState([]); + + const onClickAdd = () => { + setInputs([...inputs, { key: inputs.length.toString(), value: "" }]); + }; + + const onChangeInput = (e) => { + const index = inputs.findIndex((el) => el.key === e.target.id); + let newInputs = Array.from(inputs); + newInputs[index].value = e.target.value; + setInputs(newInputs); + }; + + const onDeleteInput = (key) => { + const index = inputs.findIndex((el) => el.key === key); + let newInputs = Array.from(inputs); + newInputs.splice(index, 1); + setInputs(newInputs); + }; + + return ( + <> + {inputs ? ( + inputs.map((input) => { + return ( + + + onDeleteInput(input.key)} + /> + + ); + }) + ) : ( + <> + )} + + + + + Add trusted domain + + + + ); +}; + +export default UserFields; From 327df7e3f1b6d6c9ee1788ccd7a2df928ab8c4fb Mon Sep 17 00:00:00 2001 From: Viktor Fomin Date: Sat, 2 Apr 2022 22:23:20 +0300 Subject: [PATCH 03/30] Web: Client: Settings: add trusted mail --- .../security/access-portal/index.js | 7 ++ .../security/access-portal/mobileView.js | 6 ++ .../security/access-portal/trustedMail.js | 85 +++++++++++++++++++ .../src/components/pages/Settings/index.js | 12 +++ .../pages/Settings/utils/settingsTree.js | 6 ++ 5 files changed, 116 insertions(+) create mode 100644 web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/trustedMail.js diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/index.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/index.js index 63e94f07b7..a7ada6b326 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/index.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/index.js @@ -6,6 +6,7 @@ import { setDocumentTitle } from "../../../../../../helpers/utils"; import { MainContainer } from "../StyledSecurity"; import TfaSection from "./tfa"; import PasswordStrengthSection from "./passwordStrength"; +import TrustedMailSection from "./trustedMail"; import MobileView from "./mobileView"; import CategoryWrapper from "../sub-components/category-wrapper"; @@ -39,6 +40,12 @@ const AccessPortal = (props) => { tooltipContent={t("TwoFactorAuthDescription")} /> +
+ + ); }; diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/mobileView.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/mobileView.js index d847e83772..24881450d5 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/mobileView.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/mobileView.js @@ -31,6 +31,12 @@ const MobileView = (props) => { url="/settings/security/access-portal/tfa" onClickLink={onClickLink} /> + ); }; diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/trustedMail.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/trustedMail.js new file mode 100644 index 0000000000..2fb888cd27 --- /dev/null +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/trustedMail.js @@ -0,0 +1,85 @@ +import React, { useState } from "react"; +import styled from "styled-components"; +import { withRouter } from "react-router"; +import { withTranslation } from "react-i18next"; +import { inject, observer } from "mobx-react"; +import Text from "@appserver/components/text"; +import Link from "@appserver/components/link"; +import Button from "@appserver/components/button"; +import { isMobile } from "react-device-detect"; +import { getLanguage } from "@appserver/common/utils"; +import { ButtonsWrapper } from "../StyledSecurity"; +import UserFields from "../sub-components/user-fields"; + +const MainContainer = styled.div` + width: 100%; + + .page-subtitle { + margin-bottom: 10px; + } + + .user-fields { + margin-bottom: 24px; + } +`; + +const TrustedMail = (props) => { + const { t } = props; + const [showReminder, setShowReminder] = useState(false); + + const lng = getLanguage(localStorage.getItem("language") || "en"); + return ( + + {isMobile && ( + <> + {t("TrustedMailHelper")} + + {t("Common:LearnMore")} + + + )} + + + + +