Merge branch 'release/v1.2' of github.com:ONLYOFFICE/AppServer into feature/security-settings

# Conflicts:
#	web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/passwordStrength.js
#	web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/tfa.js
#	web/ASC.Web.Client/src/components/pages/Settings/categories/security/access-portal/trustedMail.js
This commit is contained in:
Viktor Fomin 2022-06-08 17:53:49 +03:00
commit d77b0b6b32
15 changed files with 126 additions and 47 deletions

View File

@ -118,6 +118,7 @@ class SettingsStore {
folderFormValidation = new RegExp('[*+:"<>?|\\\\/]', "gim");
tenantStatus = null;
helpLink = null;
constructor() {
makeAutoObservable(this);
@ -128,9 +129,7 @@ class SettingsStore {
};
get urlAuthKeys() {
const splitted = this.culture.split("-");
const lang = splitted.length > 0 ? splitted[0] : "en";
return `https://helpcenter.onlyoffice.com/${lang}/installation/groups-authorization-keys.aspx`;
return `${this.helpLink}/installation/groups-authorization-keys.aspx`;
}
get wizardCompleted() {
@ -138,16 +137,11 @@ class SettingsStore {
}
get helpUrlCommonSettings() {
const substring = this.culture.substring(0, this.culture.indexOf("-"));
const lang = substring.length > 0 ? substring : "en";
return `https://helpcenter.onlyoffice.com/${lang}/administration/configuration.aspx#CustomizingPortal_block`;
return `${this.helpLink}/administration/configuration.aspx#CustomizingPortal_block`;
}
get helpUrlCreatingBackup() {
const splitted = this.culture.split("-");
const lang = splitted.length > 0 ? splitted[0] : "en";
return `https://helpcenter.onlyoffice.com/${lang}/administration/configuration.aspx#CreatingBackup_block`;
return `${this.helpLink}/administration/configuration.aspx#CreatingBackup_block`;
}
setValue = (key, value) => {
@ -337,8 +331,6 @@ class SettingsStore {
: `${homepage}/`
: "/";
console.log("SET base URL", baseUrl);
baseElm[0].setAttribute("href", baseUrl);
}
};

View File

@ -21,6 +21,7 @@ If you want to create an avatar with initials, only _first letter of first two w
| `size` | `oneOf` | - | `max`, `big`, `medium`, `small`, `min` | `medium` | Size of avatar |
| `role` | `oneOf` | - | `owner`, `admin`, `guest`, `user` | `user` | Adds a user role table |
| `source` | `string` | - | - | - | The address of the image for an image avatar |
| `isIcon` | `bool` | - | - | `false` | Set `true` if `.svg` is provided as `source` prop |
| `userName` | `string` | - | - | - | Need to create an avatar with initials |
| `editing` | `bool` | - | - | `false` | Displays avatar edit layer |
| `editLabel` | `string` | - | - | `Edit photo` | Label for editing layer |

View File

@ -19,12 +19,46 @@ export default {
};
const Template = (args) => <Avatar {...args} />;
export const Default = Template.bind({});
const PictureTemplate = (args) => <Avatar {...args} />;
export const Picture = PictureTemplate.bind({});
const InitialsTemplate = (args) => <Avatar {...args} />;
export const Initials = InitialsTemplate.bind({});
const IconTemplate = (args) => <Avatar {...args} />;
export const Icon = IconTemplate.bind({});
Default.args = {
size: "max",
role: "admin",
role: "owner",
source: "",
userName: "",
editing: false,
};
Picture.args = {
size: "max",
role: "admin",
source:
"https://images.unsplash.com/photo-1623949444573-4811dfc64771?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80",
userName: "",
editing: false,
};
Initials.args = {
size: "max",
role: "guest",
source: "",
userName: "John Doe",
editing: false,
};
Icon.args = {
size: "max",
role: "user",
source: "/static/images/@.react.svg",
userName: "",
editing: false,
};

View File

@ -11,6 +11,7 @@ import {
NamedAvatar,
StyledImage,
StyledAvatar,
StyledIconWrapper,
} from "./styled-avatar";
import IconButton from "../icon-button";
import commonIconsStyles from "../utils/common-icons-style";
@ -55,12 +56,20 @@ Initials.propTypes = {
const Avatar = (props) => {
//console.log("Avatar render");
const { size, source, userName, role, editing, editAction } = props;
let isDefault = false;
let isDefault = false,
isIcon = false;
if (source?.includes("default_user_photo")) isDefault = true;
else if (source?.includes(".svg")) isIcon = true;
const avatarContent = source ? (
isIcon ? (
<StyledIconWrapper>
<IconButton iconName={source} className="icon" isDisabled={true} />
</StyledIconWrapper>
) : (
<StyledImage src={source} isDefault={isDefault} />
)
) : userName ? (
<Initials userName={userName} size={size} />
) : (
@ -94,8 +103,9 @@ Avatar.propTypes = {
size: PropTypes.oneOf(["max", "big", "medium", "small", "min"]),
/** Adds a user role table */
role: PropTypes.oneOf(["owner", "admin", "guest", "user"]),
/** The address of the image for an image avatar */
/** Provide either a url to display as `Picture` or path to **.svg** file to display as `Icon` */
source: PropTypes.string,
/** Provide this and leave `source` empty to display as initials */
userName: PropTypes.string,
editing: PropTypes.bool,
/** Function called when the avatar change button is pressed */

View File

@ -37,11 +37,13 @@ EditContainer.defaultProps = { theme: Base };
const AvatarWrapper = styled.div`
border-radius: ${(props) => props.theme.avatar.imageContainer.borderRadius};
height: ${(props) => props.theme.avatar.imageContainer.height};
background-color: ${(props) =>
(props.source === "" &&
props.userName !== "" &&
props.theme.avatar.imageContainer.backgroundImage) ||
props.theme.avatar.imageContainer.background};
props.source
? props.theme.avatar.icon.background
: props.userName
? props.theme.avatar.imageContainer.backgroundImage
: props.theme.avatar.imageContainer.background};
& > svg {
display: ${(props) => props.theme.avatar.imageContainer.svg.display};
@ -106,6 +108,24 @@ const StyledImage = styled.img`
`;
StyledImage.defaultProps = { theme: Base };
const StyledIconWrapper = styled.div`
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
.icon,
.icon:hover {
width: 50%;
height: 50%;
path {
fill: ${(props) => props.theme.avatar.icon.color};
}
}
`;
StyledIconWrapper.defaultProps = { theme: Base };
const widthStyle = (props) => props.theme.avatar.width[props.size];
const heightStyle = (props) => props.theme.avatar.height[props.size];
@ -161,5 +181,6 @@ export {
RoleWrapper,
NamedAvatar,
StyledImage,
StyledIconWrapper,
StyledAvatar,
};

View File

@ -42,6 +42,7 @@ const {
hoverWarning,
darkBlack,
silver,
lightHover,
strongBlue,
lightGrayishStrongBlue,
darkRed,
@ -1074,6 +1075,11 @@ const Base = {
borderRadius: "50%",
},
icon: {
background: lightHover,
color: grayMain,
},
width: {
min: "32px",
small: "36px",

View File

@ -216,6 +216,7 @@ class ProfileInfo extends React.PureComponent {
culture,
personal,
theme,
helpLink,
} = this.props;
const {
@ -275,7 +276,7 @@ class ProfileInfo extends React.PureComponent {
<Link
color={theme.profileInfo.tooltipLinkColor}
isHovered={true}
href={`https://helpcenter.onlyoffice.com/${language}/guides/become-translator.aspx`}
href={`${helpLink}/guides/become-translator.aspx`}
target="_blank"
>
{t("Common:LearnMore")}
@ -424,7 +425,7 @@ class ProfileInfo extends React.PureComponent {
export default withRouter(
inject(({ auth, peopleStore }) => {
const { settingsStore } = auth;
const { culture, customNames, theme } = settingsStore;
const { culture, customNames, theme, helpLink } = settingsStore;
const {
groupCaption,
regDateCaption,
@ -456,6 +457,7 @@ export default withRouter(
isLoading,
updateProfileCulture,
personal: auth.settingsStore.personal,
helpLink,
};
})(
observer(

View File

@ -599,6 +599,7 @@ class UpdateUserForm extends React.Component {
personal,
isTabletView,
theme,
helpLink,
} = this.props;
const {
guestCaption,
@ -690,7 +691,7 @@ class UpdateUserForm extends React.Component {
<Link
color="#316DAA"
isHovered={true}
href={`https://helpcenter.onlyoffice.com/${language}/gettingstarted/people.aspx#ManagingAccessRights_block`}
href={`${helpLink}/gettingstarted/people.aspx#ManagingAccessRights_block`}
target="_blank"
style={{ marginTop: 23 }}
>
@ -1065,6 +1066,7 @@ export default withRouter(
setUserIsUpdate: auth.userStore.setUserIsUpdate,
userFormValidation: auth.settingsStore.userFormValidation,
isTabletView: auth.settingsStore.isTabletView,
helpLink: auth.settingsStore.helpLink,
}))(
observer(
withTranslation(["ProfileAction", "Common", "Translations"])(

View File

@ -0,0 +1,3 @@
<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.12622 0.0623095C6.52259 0.0529189 3.84959 1.16251 2.32398 3.25184C0.736323 5.39443 0.336116 8.22297 0.861673 10.7781C1.23082 12.4836 2.25589 14.0953 3.82515 14.9865C5.61514 16.0398 7.79774 16.1975 9.83777 15.9703C10.8616 15.8495 11.8696 15.5833 12.806 15.1664C12.806 14.5367 12.806 13.907 12.806 13.2773C10.7015 14.1265 8.29542 14.5402 6.05867 13.9306C4.48717 13.4996 3.20984 12.1815 2.86419 10.6287C2.45157 9.04801 2.55181 7.34822 3.07473 5.80605C3.63474 4.26487 4.849 2.93158 6.44338 2.37082C8.03429 1.76484 9.86191 1.70933 11.4856 2.23251C12.9327 2.74901 14.112 3.96461 14.4731 5.42171C14.8484 6.75538 14.8052 8.22873 14.275 9.51254C14.0412 10.0535 13.5129 10.6052 12.854 10.4814C12.4894 10.4243 12.2048 10.1235 12.1692 9.76841C11.9747 8.8739 12.2135 7.95948 12.1981 7.05533C12.2482 6.14079 12.2982 5.22624 12.3499 4.31179C10.8664 3.87955 9.26388 3.60154 7.73322 3.95049C6.18348 4.36389 4.99476 5.72089 4.7354 7.25821C4.50893 8.40277 4.60731 9.63904 5.15132 10.68C5.65435 11.5723 6.62808 12.2075 7.6839 12.2469C8.8488 12.3533 10.0897 11.8801 10.7516 10.9229C11.1825 11.88 12.3358 12.4244 13.3839 12.2305C14.6343 12.0636 15.6432 11.1114 16.0838 9.99452C16.8123 8.33866 16.7794 6.43221 16.2744 4.72095C15.6722 2.8322 14.1737 1.21605 12.2394 0.558331C11.2486 0.195612 10.1849 0.042059 9.12622 0.0623095ZM9.00327 5.55242C9.41499 5.55114 9.82836 5.5837 10.2278 5.66847C10.1108 6.97335 10.2543 8.33962 9.73879 9.57566C9.49209 10.0977 8.95286 10.5035 8.35165 10.4958C7.72235 10.5558 7.0233 10.196 6.8763 9.56454C6.59511 8.72671 6.67809 7.79938 6.93529 6.96772C7.22353 6.20371 7.95707 5.57045 8.82131 5.56199C8.88181 5.55689 8.94255 5.55366 9.00327 5.55242Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -395,6 +395,7 @@ class LanguageAndTimeZone extends React.Component {
cultures,
i18n,
isLoadedPage,
helpLink,
} = this.props;
const {
@ -409,7 +410,7 @@ class LanguageAndTimeZone extends React.Component {
const cultureNames = mapCulturesToArray(cultures, i18n);
const tooltipLanguageTimeSettings = (
<LanguageTimeSettingsTooltip theme={theme} t={t} />
<LanguageTimeSettingsTooltip theme={theme} t={t} helpLink={helpLink} />
);
const settingsBlock = (
@ -504,6 +505,7 @@ export default inject(({ auth, setup, common }) => {
getPortalTimezones,
getCurrentCustomSchema,
cultures,
helpLink,
} = auth.settingsStore;
const { user } = auth.userStore;
@ -526,6 +528,7 @@ export default inject(({ auth, setup, common }) => {
isLoaded,
setIsLoadedLngTZSettings,
cultures,
helpLink,
};
})(
withLoading(

View File

@ -19,7 +19,7 @@ const StyledTooltip = styled.div`
}
`;
export const LanguageTimeSettingsTooltip = ({ t, theme }) => {
export const LanguageTimeSettingsTooltip = ({ t, theme, helpLink }) => {
const learnMore = t("Common:LearnMore");
const text = t("Settings:StudioTimeLanguageSettings");
const save = t("Common:SaveButton");
@ -47,7 +47,7 @@ export const LanguageTimeSettingsTooltip = ({ t, theme }) => {
color={theme.studio.settings.common.linkColorHelp}
className="display-block font-size"
isHovered={true}
href="https://helpcenter.onlyoffice.com/administration/configuration.aspx#CustomizingPortal_block"
href={`${helpLink}/administration/configuration.aspx#CustomizingPortal_block`}
>
{{ learnMore }}
</Link>

View File

@ -13,10 +13,10 @@ import SessionLifetimeSection from "./sessionLifetime";
import MobileView from "./mobileView";
import CategoryWrapper from "../sub-components/category-wrapper";
import { size } from "@appserver/components/utils/device";
import { getLanguage } from "@appserver/common/utils";
import { inject, observer } from "mobx-react";
const AccessPortal = (props) => {
const { t } = props;
const { t, helpLink } = props;
const [isMobileView, setIsMobileView] = useState(false);
useEffect(() => {
@ -32,8 +32,6 @@ const AccessPortal = (props) => {
: setIsMobileView(false);
};
const lng = getLanguage(localStorage.getItem("language") || "en");
if (isMobileView) return <MobileView />;
return (
<MainContainer className="desktop-view">
@ -42,7 +40,7 @@ const AccessPortal = (props) => {
t={t}
title={t("SettingPasswordStrength")}
tooltipTitle={t("SettingPasswordStrengthDescription")}
tooltipUrl={`https://helpcenter.onlyoffice.com/${lng}/administration/configuration.aspx#ChangingSecuritySettings_block`}
tooltipUrl={`${helpLink}/administration/configuration.aspx#ChangingSecuritySettings_block`}
/>
<PasswordStrengthSection />
<hr />
@ -50,7 +48,7 @@ const AccessPortal = (props) => {
t={t}
title={t("TwoFactorAuth")}
tooltipTitle={t("TwoFactorAuthDescription")}
tooltipUrl={`https://helpcenter.onlyoffice.com/${lng}/administration/two-factor-authentication.aspx`}
tooltipUrl={`${helpLink}/administration/two-factor-authentication.aspx`}
/>
<TfaSection />
<hr />
@ -58,7 +56,7 @@ const AccessPortal = (props) => {
t={t}
title={t("TrustedMail")}
tooltipTitle={t("TrustedMailDescription")}
tooltipUrl={`https://helpcenter.onlyoffice.com/${lng}/administration/configuration.aspx#ChangingSecuritySettings_block`}
tooltipUrl={`${helpLink}/administration/configuration.aspx#ChangingSecuritySettings_block`}
/>
<TrustedMailSection />
<hr />
@ -89,4 +87,7 @@ const AccessPortal = (props) => {
);
};
export default withTranslation("Settings")(withRouter(AccessPortal));
export default inject(({ auth }) => {
const { helpLink } = auth.settingsStore;
return { helpLink };
})(withTranslation("Settings")(withRouter(observer(AccessPortal))));

View File

@ -8,7 +8,6 @@ import Text from "@appserver/components/text";
import Link from "@appserver/components/link";
import Slider from "@appserver/components/slider";
import Checkbox from "@appserver/components/checkbox";
import { getLanguage } from "@appserver/common/utils";
import { LearnMoreWrapper } from "../StyledSecurity";
import toastr from "@appserver/components/toast/toastr";
import { size } from "@appserver/components/utils/device";
@ -46,6 +45,7 @@ const PasswordStrength = (props) => {
passwordSettings,
initSettings,
isInit,
helpLink,
} = props;
const [passwordLen, setPasswordLen] = useState(8);
@ -177,8 +177,6 @@ const PasswordStrength = (props) => {
setShowReminder(false);
};
const lng = getLanguage(localStorage.getItem("language") || "en");
if (isMobile && !isInit && !isLoading) {
return <PasswordLoader />;
}
@ -193,7 +191,7 @@ const PasswordStrength = (props) => {
color="#316DAA"
target="_blank"
isHovered
href={`https://helpcenter.onlyoffice.com/${lng}/administration/configuration.aspx#ChangingSecuritySettings_block`}
href={`${helpLink}/administration/configuration.aspx#ChangingSecuritySettings_block`}
>
{t("Common:LearnMore")}
</Link>
@ -259,7 +257,11 @@ const PasswordStrength = (props) => {
};
export default inject(({ auth, setup }) => {
const { setPortalPasswordSettings, passwordSettings } = auth.settingsStore;
const {
setPortalPasswordSettings,
passwordSettings,
helpLink,
} = auth.settingsStore;
const { initSettings, isInit } = setup;
return {
@ -267,6 +269,7 @@ export default inject(({ auth, setup }) => {
passwordSettings,
initSettings,
isInit,
helpLink,
};
})(
withTranslation(["Settings", "Common"])(

View File

@ -7,7 +7,6 @@ import RadioButtonGroup from "@appserver/components/radio-button-group";
import Text from "@appserver/components/text";
import Link from "@appserver/components/link";
import toastr from "@appserver/components/toast/toastr";
import { getLanguage } from "@appserver/common/utils";
import { LearnMoreWrapper } from "../StyledSecurity";
import { size } from "@appserver/components/utils/device";
import { saveToSessionStorage, getFromSessionStorage } from "../../../utils";
@ -24,7 +23,7 @@ const MainContainer = styled.div`
`;
const TwoFactorAuth = (props) => {
const { t, history, initSettings, isInit, setIsInit } = props;
const { t, history, initSettings, isInit, setIsInit, helpLink } = props;
const [type, setType] = useState("none");
const [smsDisabled, setSmsDisabled] = useState(false);
@ -118,7 +117,6 @@ const TwoFactorAuth = (props) => {
setShowReminder(false);
};
const lng = getLanguage(localStorage.getItem("language") || "en");
if (isMobile && !isInit && !isLoading) {
return <TfaLoader />;
@ -132,7 +130,7 @@ const TwoFactorAuth = (props) => {
color="#316DAA"
target="_blank"
isHovered
href={`https://helpcenter.onlyoffice.com/${lng}/administration/two-factor-authentication.aspx`}
href={`${helpLink}/administration/two-factor-authentication.aspx`}
>
{t("Common:LearnMore")}
</Link>
@ -191,6 +189,7 @@ export default inject(({ auth, setup }) => {
} = auth.tfaStore;
const { isInit, initSettings, setIsInit } = setup;
const { helpLink } = auth.settingsStore;
return {
setTfaSettings,
@ -201,6 +200,7 @@ export default inject(({ auth, setup }) => {
isInit,
initSettings,
setIsInit,
helpLink,
};
})(
withTranslation(["Settings", "Common"])(withRouter(observer(TwoFactorAuth)))

View File

@ -7,7 +7,6 @@ import Text from "@appserver/components/text";
import Link from "@appserver/components/link";
import RadioButtonGroup from "@appserver/components/radio-button-group";
import { LearnMoreWrapper } from "../StyledSecurity";
import { getLanguage } from "@appserver/common/utils";
import toastr from "@appserver/components/toast/toastr";
import UserFields from "../sub-components/user-fields";
import { size } from "@appserver/components/utils/device";
@ -36,6 +35,7 @@ const TrustedMail = (props) => {
trustedDomainsType,
trustedDomains,
setMailDomainSettings,
helpLink,
} = props;
const regexp = /^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9](?:\.[a-zA-Z]{1,})+/; //check domain name valid
@ -152,7 +152,6 @@ const TrustedMail = (props) => {
setShowReminder(false);
};
const lng = getLanguage(localStorage.getItem("language") || "en");
if (isMobile && !isLoading) {
return <TrustedMailLoader />;
@ -166,7 +165,7 @@ const TrustedMail = (props) => {
color="#316DAA"
target="_blank"
isHovered
href={`https://helpcenter.onlyoffice.com/${lng}/administration/configuration.aspx#ChangingSecuritySettings_block`}
href={`${helpLink}/administration/configuration.aspx#ChangingSecuritySettings_block`}
>
{t("Common:LearnMore")}
</Link>
@ -229,11 +228,13 @@ export default inject(({ auth }) => {
trustedDomainsType,
trustedDomains,
setMailDomainSettings,
helpLink,
} = auth.settingsStore;
return {
trustedDomainsType,
trustedDomains,
setMailDomainSettings,
helpLink,
};
})(withTranslation(["Settings", "Common"])(withRouter(observer(TrustedMail))));