fix Bug 63907 | first name and last name validation was added
This commit is contained in:
parent
aac8d68dcf
commit
8abea90a92
@ -0,0 +1,13 @@
|
||||
import React from "react";
|
||||
import ModalDialogContainer from "../ModalDialogContainer";
|
||||
import styled from "styled-components";
|
||||
|
||||
export const ChangeNameContainer = styled(ModalDialogContainer)`
|
||||
#modal-dialog {
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
.error-label {
|
||||
position: relative;
|
||||
}
|
||||
`;
|
@ -8,14 +8,10 @@ import TextInput from "@docspace/components/text-input";
|
||||
import Button from "@docspace/components/button";
|
||||
import toastr from "@docspace/components/toast/toastr";
|
||||
|
||||
import ModalDialogContainer from "../ModalDialogContainer";
|
||||
import { ChangeNameContainer } from "./StyledChangeName";
|
||||
|
||||
const ChangeNameDialog = (props) => {
|
||||
const { t, ready } = useTranslation([
|
||||
"ProfileAction",
|
||||
"PeopleTranslations",
|
||||
"Common",
|
||||
]);
|
||||
const { t, ready } = useTranslation(["ProfileAction", "PeopleTranslations", "Common"]);
|
||||
const {
|
||||
visible,
|
||||
onClose,
|
||||
@ -23,11 +19,26 @@ const ChangeNameDialog = (props) => {
|
||||
updateProfile,
|
||||
updateProfileInUsers,
|
||||
fromList,
|
||||
userNameRegex,
|
||||
} = props;
|
||||
const [firstName, setFirstName] = useState(profile.firstName);
|
||||
const [lastName, setLastName] = useState(profile.lastName);
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
|
||||
const nameRegex = new RegExp(userNameRegex, "gu");
|
||||
|
||||
const [isNameValid, setIsNameValid] = useState(true);
|
||||
const [isSurnameValid, setIsSurnameValid] = useState(true);
|
||||
|
||||
const handleNameChange = (e) => {
|
||||
setFirstName(e.target.value);
|
||||
setIsNameValid(nameRegex.test(e.target.value.trim()));
|
||||
};
|
||||
const handleSurnameChange = (e) => {
|
||||
setLastName(e.target.value);
|
||||
setIsSurnameValid(nameRegex.test(e.target.value.trim()));
|
||||
};
|
||||
|
||||
const onCloseAction = () => {
|
||||
if (!isSaving) {
|
||||
onClose();
|
||||
@ -39,6 +50,14 @@ const ChangeNameDialog = (props) => {
|
||||
};
|
||||
|
||||
const onSaveClick = async () => {
|
||||
if (
|
||||
!isNameValid ||
|
||||
!isSurnameValid ||
|
||||
firstName.trim().length === 0 ||
|
||||
lastName.trim().length === 0
|
||||
)
|
||||
return;
|
||||
|
||||
const newProfile = profile;
|
||||
newProfile.firstName = firstName;
|
||||
newProfile.lastName = lastName;
|
||||
@ -58,31 +77,34 @@ const ChangeNameDialog = (props) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<ModalDialogContainer
|
||||
<ChangeNameContainer
|
||||
isLoading={!ready}
|
||||
visible={visible}
|
||||
onClose={onCloseAction}
|
||||
displayType="modal"
|
||||
>
|
||||
<ModalDialog.Header>
|
||||
{t("PeopleTranslations:NameChangeButton")}
|
||||
</ModalDialog.Header>
|
||||
displayType="modal">
|
||||
<ModalDialog.Header>{t("PeopleTranslations:NameChangeButton")}</ModalDialog.Header>
|
||||
<ModalDialog.Body className="change-name-dialog-body">
|
||||
<FieldContainer
|
||||
isVertical
|
||||
labelText={t("Common:FirstName")}
|
||||
className="field"
|
||||
>
|
||||
hasError={!isNameValid}
|
||||
errorMessage={
|
||||
firstName.trim().length === 0
|
||||
? t("Common:RequiredField")
|
||||
: t("Common:IncorrectFirstName")
|
||||
}>
|
||||
<TextInput
|
||||
className="first-name"
|
||||
scale={true}
|
||||
isAutoFocussed={true}
|
||||
value={firstName}
|
||||
onChange={(e) => setFirstName(e.target.value)}
|
||||
onChange={handleNameChange}
|
||||
placeholder={t("Common:FirstName")}
|
||||
isDisabled={isSaving}
|
||||
onKeyDown={onKeyDown}
|
||||
tabIndex={1}
|
||||
hasError={!isNameValid}
|
||||
/>
|
||||
</FieldContainer>
|
||||
|
||||
@ -90,16 +112,20 @@ const ChangeNameDialog = (props) => {
|
||||
isVertical
|
||||
labelText={t("Common:LastName")}
|
||||
className="field"
|
||||
>
|
||||
hasError={!isSurnameValid}
|
||||
errorMessage={
|
||||
lastName.trim().length === 0 ? t("Common:RequiredField") : t("Common:IncorrectLastName")
|
||||
}>
|
||||
<TextInput
|
||||
className="last-name"
|
||||
scale={true}
|
||||
value={lastName}
|
||||
onChange={(e) => setLastName(e.target.value)}
|
||||
onChange={handleSurnameChange}
|
||||
placeholder={t("Common:LastName")}
|
||||
isDisabled={isSaving}
|
||||
onKeyDown={onKeyDown}
|
||||
tabIndex={2}
|
||||
hasError={!isSurnameValid}
|
||||
/>
|
||||
</FieldContainer>
|
||||
</ModalDialog.Body>
|
||||
@ -114,6 +140,12 @@ const ChangeNameDialog = (props) => {
|
||||
onClick={onSaveClick}
|
||||
isLoading={isSaving}
|
||||
tabIndex={3}
|
||||
isDisabled={
|
||||
!isNameValid ||
|
||||
!isSurnameValid ||
|
||||
firstName.trim().length === 0 ||
|
||||
lastName.trim().length === 0
|
||||
}
|
||||
/>
|
||||
<Button
|
||||
className="cancel-button"
|
||||
@ -126,14 +158,16 @@ const ChangeNameDialog = (props) => {
|
||||
tabIndex={4}
|
||||
/>
|
||||
</ModalDialog.Footer>
|
||||
</ModalDialogContainer>
|
||||
</ChangeNameContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ peopleStore }) => {
|
||||
export default inject(({ peopleStore, auth }) => {
|
||||
const { updateProfile } = peopleStore.targetUserStore;
|
||||
|
||||
const { updateProfileInUsers } = peopleStore.usersStore;
|
||||
|
||||
return { updateProfile, updateProfileInUsers };
|
||||
const { userNameRegex } = auth.settingsStore;
|
||||
|
||||
return { updateProfile, updateProfileInUsers, userNameRegex };
|
||||
})(observer(ChangeNameDialog));
|
||||
|
@ -49,6 +49,7 @@ const CreateUserForm = (props) => {
|
||||
roomData,
|
||||
capabilities,
|
||||
currentColorScheme,
|
||||
userNameRegex,
|
||||
} = props;
|
||||
const inputRef = React.useRef(null);
|
||||
|
||||
@ -96,6 +97,8 @@ const CreateUserForm = (props) => {
|
||||
setShowGreeting(false);
|
||||
};
|
||||
|
||||
const nameRegex = new RegExp(userNameRegex, "gu");
|
||||
|
||||
/*useEffect(() => {
|
||||
window.addEventListener("resize", onCheckGreeting);
|
||||
return () => window.removeEventListener("resize", onCheckGreeting);
|
||||
@ -136,12 +139,12 @@ const CreateUserForm = (props) => {
|
||||
|
||||
let hasError = false;
|
||||
|
||||
if (!fname.trim()) {
|
||||
if (!fname.trim() || !fnameValid) {
|
||||
hasError = true;
|
||||
setFnameValid(!hasError);
|
||||
}
|
||||
|
||||
if (!sname.trim()) {
|
||||
if (!sname.trim() || !snameValid) {
|
||||
hasError = true;
|
||||
setSnameValid(!hasError);
|
||||
}
|
||||
@ -173,8 +176,8 @@ const CreateUserForm = (props) => {
|
||||
};
|
||||
|
||||
const personalData = {
|
||||
firstname: fname,
|
||||
lastname: sname,
|
||||
firstname: fname.trim(),
|
||||
lastname: sname.trim(),
|
||||
email: email,
|
||||
};
|
||||
|
||||
@ -199,10 +202,7 @@ const CreateUserForm = (props) => {
|
||||
let errorMessage = "";
|
||||
if (typeof error === "object") {
|
||||
errorMessage =
|
||||
error?.response?.data?.error?.message ||
|
||||
error?.statusText ||
|
||||
error?.message ||
|
||||
"";
|
||||
error?.response?.data?.error?.message || error?.statusText || error?.message || "";
|
||||
} else {
|
||||
errorMessage = error;
|
||||
}
|
||||
@ -241,11 +241,7 @@ const CreateUserForm = (props) => {
|
||||
const { login } = props;
|
||||
const fromInviteLink = linkData.type === "LinkInvite" ? true : false;
|
||||
|
||||
const data = Object.assign(
|
||||
{ fromInviteLink: fromInviteLink },
|
||||
registerData,
|
||||
loginData
|
||||
);
|
||||
const data = Object.assign({ fromInviteLink: fromInviteLink }, registerData, loginData);
|
||||
|
||||
const user = await createUser(data, key);
|
||||
|
||||
@ -271,13 +267,13 @@ const CreateUserForm = (props) => {
|
||||
|
||||
const onChangeFname = (e) => {
|
||||
setFname(e.target.value);
|
||||
setFnameValid(true);
|
||||
setFnameValid(nameRegex.test(e.target.value.trim()));
|
||||
setErrorText("");
|
||||
};
|
||||
|
||||
const onChangeSname = (e) => {
|
||||
setSname(e.target.value);
|
||||
setSnameValid(true);
|
||||
setSnameValid(nameRegex.test(e.target.value.trim()));
|
||||
setErrorText("");
|
||||
};
|
||||
|
||||
@ -310,7 +306,7 @@ const CreateUserForm = (props) => {
|
||||
: window.open(
|
||||
url,
|
||||
"login",
|
||||
"width=800,height=500,status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=no"
|
||||
"width=800,height=500,status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=no",
|
||||
);
|
||||
|
||||
getOAuthToken(tokenGetterWin).then((code) => {
|
||||
@ -319,7 +315,7 @@ const CreateUserForm = (props) => {
|
||||
auth: providerName,
|
||||
mode: "popup",
|
||||
callback: "authCallback",
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
tokenGetterWin.location.href = getLoginLink(token, code);
|
||||
@ -336,8 +332,7 @@ const CreateUserForm = (props) => {
|
||||
if (!providersData[item.provider]) return;
|
||||
if (index > 1) return;
|
||||
|
||||
const { icon, label, iconOptions, className } =
|
||||
providersData[item.provider];
|
||||
const { icon, label, iconOptions, className } = providersData[item.provider];
|
||||
|
||||
return (
|
||||
<div className="buttonWrapper" key={`${item.provider}ProviderItem`}>
|
||||
@ -363,10 +358,7 @@ const CreateUserForm = (props) => {
|
||||
<SocialButton
|
||||
iconName={SsoReactSvgUrl}
|
||||
className="socialButton"
|
||||
label={
|
||||
capabilities?.ssoLabel ||
|
||||
getProviderTranslation("sso", t, false, true)
|
||||
}
|
||||
label={capabilities?.ssoLabel || getProviderTranslation("sso", t, false, true)}
|
||||
onClick={() => (window.location.href = capabilities?.ssoUrl)}
|
||||
/>
|
||||
</div>
|
||||
@ -416,12 +408,7 @@ const CreateUserForm = (props) => {
|
||||
<ConfirmContainer>
|
||||
<GreetingContainer>
|
||||
<DocspaceLogo className="docspace-logo" />
|
||||
<Text
|
||||
fontSize="23px"
|
||||
fontWeight={700}
|
||||
textAlign="left"
|
||||
className="greeting-title"
|
||||
>
|
||||
<Text fontSize="23px" fontWeight={700} textAlign="left" className="greeting-title">
|
||||
{greetingTitle}
|
||||
</Text>
|
||||
|
||||
@ -429,11 +416,7 @@ const CreateUserForm = (props) => {
|
||||
<>
|
||||
{user && (
|
||||
<div className="greeting-block">
|
||||
<Avatar
|
||||
className="avatar"
|
||||
role="user"
|
||||
source={userAvatar}
|
||||
/>
|
||||
<Avatar className="avatar" role="user" source={userAvatar} />
|
||||
<div className="user-info">
|
||||
<Text fontSize="15px" fontWeight={600}>
|
||||
{user.firstName} {user.lastName}
|
||||
@ -448,12 +431,7 @@ const CreateUserForm = (props) => {
|
||||
<div className="tooltip">
|
||||
<p className="tooltiptext">
|
||||
{roomName ? (
|
||||
<Trans
|
||||
t={t}
|
||||
i18nKey="WelcomeToRoom"
|
||||
ns="Confirm"
|
||||
key={roomName}
|
||||
>
|
||||
<Trans t={t} i18nKey="WelcomeToRoom" ns="Confirm" key={roomName}>
|
||||
Welcome to the <strong>{{ roomName }}</strong> room!
|
||||
</Trans>
|
||||
) : (
|
||||
@ -476,9 +454,7 @@ const CreateUserForm = (props) => {
|
||||
<RegisterContainer>
|
||||
{!emailFromLink && (
|
||||
<>
|
||||
{ssoExists() && (
|
||||
<ButtonsWrapper>{ssoButton()}</ButtonsWrapper>
|
||||
)}
|
||||
{ssoExists() && <ButtonsWrapper>{ssoButton()}</ButtonsWrapper>}
|
||||
|
||||
{oauthDataExists() && (
|
||||
<>
|
||||
@ -491,8 +467,7 @@ const CreateUserForm = (props) => {
|
||||
fontWeight="600"
|
||||
color={currentColorScheme?.main?.accent}
|
||||
className="more-label"
|
||||
onClick={moreAuthOpen}
|
||||
>
|
||||
onClick={moreAuthOpen}>
|
||||
{t("Common:ShowMore")}
|
||||
</Link>
|
||||
)}
|
||||
@ -518,11 +493,8 @@ const CreateUserForm = (props) => {
|
||||
labelVisible={false}
|
||||
hasError={isEmailErrorShow && !emailValid}
|
||||
errorMessage={
|
||||
emailErrorText
|
||||
? t(`Common:${emailErrorText}`)
|
||||
: t("Common:RequiredField")
|
||||
}
|
||||
>
|
||||
emailErrorText ? t(`Common:${emailErrorText}`) : t("Common:RequiredField")
|
||||
}>
|
||||
<EmailInput
|
||||
id="login"
|
||||
name="login"
|
||||
@ -550,9 +522,12 @@ const CreateUserForm = (props) => {
|
||||
labelVisible={false}
|
||||
hasError={!fnameValid}
|
||||
errorMessage={
|
||||
errorText ? errorText : t("Common:RequiredField")
|
||||
}
|
||||
>
|
||||
errorText
|
||||
? errorText
|
||||
: fname.trim().length === 0
|
||||
? t("Common:RequiredField")
|
||||
: t("Common:IncorrectFirstName")
|
||||
}>
|
||||
<TextInput
|
||||
id="first-name"
|
||||
name="first-name"
|
||||
@ -575,9 +550,12 @@ const CreateUserForm = (props) => {
|
||||
labelVisible={false}
|
||||
hasError={!snameValid}
|
||||
errorMessage={
|
||||
errorText ? errorText : t("Common:RequiredField")
|
||||
}
|
||||
>
|
||||
errorText
|
||||
? errorText
|
||||
: sname.trim().length === 0
|
||||
? t("Common:RequiredField")
|
||||
: t("Common:IncorrectLastName")
|
||||
}>
|
||||
<TextInput
|
||||
id="last-name"
|
||||
name="last-name"
|
||||
@ -599,10 +577,10 @@ const CreateUserForm = (props) => {
|
||||
isVertical={true}
|
||||
labelVisible={false}
|
||||
hasError={isPasswordErrorShow && !passwordValid}
|
||||
errorMessage={`${t(
|
||||
"Common:PasswordLimitMessage"
|
||||
)}: ${getPasswordErrorMessage(t, settings)}`}
|
||||
>
|
||||
errorMessage={`${t("Common:PasswordLimitMessage")}: ${getPasswordErrorMessage(
|
||||
t,
|
||||
settings,
|
||||
)}`}>
|
||||
<PasswordInput
|
||||
simpleView={false}
|
||||
hideNewPasswordButton
|
||||
@ -623,21 +601,13 @@ const CreateUserForm = (props) => {
|
||||
onBlur={onBlurPassword}
|
||||
onKeyDown={onKeyPress}
|
||||
onValidateInput={onValidatePassword}
|
||||
tooltipPasswordTitle={`${t(
|
||||
"Common:PasswordLimitMessage"
|
||||
)}:`}
|
||||
tooltipPasswordLength={`${t(
|
||||
"Common:PasswordMinimumLength"
|
||||
)}: ${settings ? settings.minLength : 8}`}
|
||||
tooltipPasswordDigits={`${t(
|
||||
"Common:PasswordLimitDigits"
|
||||
)}`}
|
||||
tooltipPasswordCapital={`${t(
|
||||
"Common:PasswordLimitUpperCase"
|
||||
)}`}
|
||||
tooltipPasswordSpecial={`${t(
|
||||
"Common:PasswordLimitSpecialSymbols"
|
||||
)}`}
|
||||
tooltipPasswordTitle={`${t("Common:PasswordLimitMessage")}:`}
|
||||
tooltipPasswordLength={`${t("Common:PasswordMinimumLength")}: ${
|
||||
settings ? settings.minLength : 8
|
||||
}`}
|
||||
tooltipPasswordDigits={`${t("Common:PasswordLimitDigits")}`}
|
||||
tooltipPasswordCapital={`${t("Common:PasswordLimitUpperCase")}`}
|
||||
tooltipPasswordSpecial={`${t("Common:PasswordLimitSpecialSymbols")}`}
|
||||
generatePasswordTitle={t("Wizard:GeneratePassword")}
|
||||
/>
|
||||
</FieldContainer>
|
||||
@ -647,11 +617,7 @@ const CreateUserForm = (props) => {
|
||||
primary
|
||||
size="medium"
|
||||
scale={true}
|
||||
label={
|
||||
isLoading
|
||||
? t("Common:LoadingProcessing")
|
||||
: t("LoginRegistryButton")
|
||||
}
|
||||
label={isLoading ? t("Common:LoadingProcessing") : t("LoginRegistryButton")}
|
||||
tabIndex={1}
|
||||
isDisabled={isLoading}
|
||||
isLoading={isLoading}
|
||||
@ -667,11 +633,7 @@ const CreateUserForm = (props) => {
|
||||
primary
|
||||
size="medium"
|
||||
scale={true}
|
||||
label={
|
||||
isLoading
|
||||
? t("Common:LoadingProcessing")
|
||||
: t("LoginRegistryButton")
|
||||
}
|
||||
label={isLoading ? t("Common:LoadingProcessing") : t("LoginRegistryButton")}
|
||||
tabIndex={1}
|
||||
isDisabled={isLoading}
|
||||
isLoading={isLoading}
|
||||
@ -715,6 +677,7 @@ export default inject(({ auth }) => {
|
||||
getSettings,
|
||||
getPortalPasswordSettings,
|
||||
currentColorScheme,
|
||||
userNameRegex,
|
||||
} = settingsStore;
|
||||
|
||||
return {
|
||||
@ -731,9 +694,6 @@ export default inject(({ auth }) => {
|
||||
providers,
|
||||
capabilities,
|
||||
currentColorScheme,
|
||||
userNameRegex,
|
||||
};
|
||||
})(
|
||||
withTranslation(["Confirm", "Common", "Wizard"])(
|
||||
withLoader(observer(CreateUserForm))
|
||||
)
|
||||
);
|
||||
})(withTranslation(["Confirm", "Common", "Wizard"])(withLoader(observer(CreateUserForm))));
|
||||
|
@ -23,12 +23,7 @@ import { Trans } from "react-i18next";
|
||||
|
||||
import { AvatarEditorDialog } from "SRC_DIR/components/dialogs";
|
||||
|
||||
import {
|
||||
StyledWrapper,
|
||||
StyledInfo,
|
||||
StyledLabel,
|
||||
StyledAvatarWrapper,
|
||||
} from "./styled-main-profile";
|
||||
import { StyledWrapper, StyledInfo, StyledLabel, StyledAvatarWrapper } from "./styled-main-profile";
|
||||
import { HelpButton, Tooltip } from "@docspace/components";
|
||||
import withCultureNames from "@docspace/common/hoc/withCultureNames";
|
||||
import { isMobile } from "@docspace/components/utils/device";
|
||||
@ -89,15 +84,13 @@ const MainProfile = (props) => {
|
||||
setChangePasswordVisible(true);
|
||||
};
|
||||
|
||||
const userAvatar = profile.hasAvatar
|
||||
? profile.avatarMax
|
||||
: DefaultUserAvatarMax;
|
||||
const userAvatar = profile.hasAvatar ? profile.avatarMax : DefaultUserAvatarMax;
|
||||
|
||||
const tooltipLanguage = (
|
||||
<Text as="div" fontSize="12px" color="#333333">
|
||||
<Trans t={t} i18nKey="NotFoundLanguage" ns="Common">
|
||||
"In case you cannot find your language in the list of the available
|
||||
ones, feel free to write to us at
|
||||
"In case you cannot find your language in the list of the available ones, feel free to write
|
||||
to us at
|
||||
<Link
|
||||
href={`mailto:${documentationEmail}`}
|
||||
isHovered={true}
|
||||
@ -168,9 +161,7 @@ const MainProfile = (props) => {
|
||||
</div>
|
||||
)}
|
||||
</StyledAvatarWrapper>
|
||||
<StyledInfo
|
||||
withActivationBar={withActivationBar}
|
||||
currentColorScheme={currentColorScheme}>
|
||||
<StyledInfo withActivationBar={withActivationBar} currentColorScheme={currentColorScheme}>
|
||||
<div className="rows-container">
|
||||
<div className="profile-block">
|
||||
<StyledLabel as="div">{t("Common:Name")}</StyledLabel>
|
||||
@ -179,16 +170,11 @@ const MainProfile = (props) => {
|
||||
{t("Common:Email")}
|
||||
</StyledLabel>
|
||||
|
||||
<StyledLabel
|
||||
as="div"
|
||||
marginTopProp={withActivationBar ? "34px" : "16px"}>
|
||||
<StyledLabel as="div" marginTopProp={withActivationBar ? "34px" : "16px"}>
|
||||
{t("Common:Password")}
|
||||
</StyledLabel>
|
||||
|
||||
<StyledLabel
|
||||
as="div"
|
||||
className="profile-language"
|
||||
marginTopProp="15px">
|
||||
<StyledLabel as="div" className="profile-language" marginTopProp="15px">
|
||||
{t("Common:Language")}
|
||||
<HelpButton
|
||||
size={12}
|
||||
@ -201,7 +187,7 @@ const MainProfile = (props) => {
|
||||
|
||||
<div className="profile-block">
|
||||
<div className="profile-block-field">
|
||||
<Text fontWeight={600} truncate>
|
||||
<Text fontWeight={600} truncate title={profile.displayName}>
|
||||
{profile.displayName}
|
||||
</Text>
|
||||
{profile.isSSO && (
|
||||
@ -240,9 +226,7 @@ const MainProfile = (props) => {
|
||||
<Tooltip
|
||||
float
|
||||
id="emailTooltip"
|
||||
getContent={({ content }) => (
|
||||
<Text fontSize="12px">{content}</Text>
|
||||
)}
|
||||
getContent={({ content }) => <Text fontSize="12px">{content}</Text>}
|
||||
place="bottom"
|
||||
/>
|
||||
)}
|
||||
@ -256,13 +240,8 @@ const MainProfile = (props) => {
|
||||
)}
|
||||
</div>
|
||||
{withActivationBar && (
|
||||
<div
|
||||
className="send-again-container"
|
||||
onClick={sendActivationLinkAction}>
|
||||
<ReactSVG
|
||||
className="send-again-icon"
|
||||
src={SendClockReactSvgUrl}
|
||||
/>
|
||||
<div className="send-again-container" onClick={sendActivationLinkAction}>
|
||||
<ReactSVG className="send-again-icon" src={SendClockReactSvgUrl} />
|
||||
<Text className="send-again-text" fontWeight={600} noSelect>
|
||||
{t("SendAgain")}
|
||||
</Text>
|
||||
@ -293,9 +272,7 @@ const MainProfile = (props) => {
|
||||
dropDownMaxHeight={364}
|
||||
manualWidth="250px"
|
||||
isDefaultMode={
|
||||
isMobileHorizontalOrientation
|
||||
? isMobileHorizontalOrientation
|
||||
: !isMobile()
|
||||
isMobileHorizontalOrientation ? isMobileHorizontalOrientation : !isMobile()
|
||||
}
|
||||
withBlur={isMobileHorizontalOrientation ? false : isMobile()}
|
||||
fillIcon={false}
|
||||
@ -310,10 +287,7 @@ const MainProfile = (props) => {
|
||||
<Text className="mobile-profile-label" as="div">
|
||||
{t("Common:Name")}
|
||||
</Text>
|
||||
<Text
|
||||
className="mobile-profile-label-field"
|
||||
fontWeight={600}
|
||||
truncate>
|
||||
<Text className="mobile-profile-label-field" fontWeight={600} truncate>
|
||||
{profile.displayName}
|
||||
</Text>
|
||||
</div>
|
||||
@ -344,21 +318,14 @@ const MainProfile = (props) => {
|
||||
<Tooltip
|
||||
float
|
||||
id="emailTooltip"
|
||||
getContent={({ content }) => (
|
||||
<Text fontSize="12px">{content}</Text>
|
||||
)}
|
||||
getContent={({ content }) => <Text fontSize="12px">{content}</Text>}
|
||||
place="bottom"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{withActivationBar && (
|
||||
<div
|
||||
className="send-again-container"
|
||||
onClick={sendActivationLinkAction}>
|
||||
<ReactSVG
|
||||
className="send-again-icon"
|
||||
src={SendClockReactSvgUrl}
|
||||
/>
|
||||
<div className="send-again-container" onClick={sendActivationLinkAction}>
|
||||
<ReactSVG className="send-again-icon" src={SendClockReactSvgUrl} />
|
||||
<Text className="send-again-text" fontWeight={600} noSelect>
|
||||
{t("SendAgain")}
|
||||
</Text>
|
||||
@ -413,9 +380,7 @@ const MainProfile = (props) => {
|
||||
dropDownMaxHeight={364}
|
||||
manualWidth="250px"
|
||||
isDefaultMode={
|
||||
isMobileHorizontalOrientation
|
||||
? isMobileHorizontalOrientation
|
||||
: !isMobile()
|
||||
isMobileHorizontalOrientation ? isMobileHorizontalOrientation : !isMobile()
|
||||
}
|
||||
withBlur={isMobileHorizontalOrientation ? false : isMobile()}
|
||||
fillIcon={false}
|
||||
@ -439,8 +404,7 @@ const MainProfile = (props) => {
|
||||
|
||||
export default inject(({ auth, peopleStore }) => {
|
||||
const { withActivationBar, sendActivationLink } = auth.userStore;
|
||||
const { theme, helpLink, culture, currentColorScheme, documentationEmail } =
|
||||
auth.settingsStore;
|
||||
const { theme, helpLink, culture, currentColorScheme, documentationEmail } = auth.settingsStore;
|
||||
|
||||
const {
|
||||
targetUser: profile,
|
||||
|
@ -2,12 +2,7 @@ import { makeAutoObservable, runInAction } from "mobx";
|
||||
|
||||
import api from "../api";
|
||||
|
||||
import {
|
||||
combineUrl,
|
||||
setCookie,
|
||||
frameCallEvent,
|
||||
getSystemTheme,
|
||||
} from "../utils";
|
||||
import { combineUrl, setCookie, frameCallEvent, getSystemTheme } from "../utils";
|
||||
import FirebaseHelper from "../utils/firebase";
|
||||
import {
|
||||
ThemeKeys,
|
||||
@ -20,10 +15,7 @@ import { version } from "../package.json";
|
||||
import SocketIOHelper from "../utils/socket";
|
||||
import { Dark, Base } from "@docspace/components/themes";
|
||||
import { getCookie } from "@docspace/components/utils/cookie";
|
||||
import {
|
||||
size as deviceSize,
|
||||
isTablet,
|
||||
} from "@docspace/components/utils/device";
|
||||
import { size as deviceSize, isTablet } from "@docspace/components/utils/device";
|
||||
import { wrongPortalNameUrl } from "@docspace/common/constants";
|
||||
import { ARTICLE_ALERTS } from "@docspace/client/src/helpers/constants";
|
||||
import toastr from "@docspace/components/toast/toastr";
|
||||
@ -47,10 +39,7 @@ const initArticleAlertsData = () => {
|
||||
available: articleAlertsArray,
|
||||
};
|
||||
|
||||
localStorage.setItem(
|
||||
"articleAlertsData",
|
||||
JSON.stringify(defaultArticleAlertsData)
|
||||
);
|
||||
localStorage.setItem("articleAlertsData", JSON.stringify(defaultArticleAlertsData));
|
||||
|
||||
return defaultArticleAlertsData;
|
||||
};
|
||||
@ -152,7 +141,6 @@ class SettingsStore {
|
||||
debugInfo = false;
|
||||
socketUrl = "";
|
||||
|
||||
userFormValidation = /^[\p{L}\p{M}'\-]+$/gu;
|
||||
folderFormValidation = new RegExp('[*+:"<>?|\\\\/]', "gim");
|
||||
|
||||
tenantStatus = null;
|
||||
@ -191,6 +179,8 @@ class SettingsStore {
|
||||
blockingTime = null;
|
||||
checkPeriod = null;
|
||||
|
||||
userNameRegex = "";
|
||||
|
||||
windowWidth = window.innerWidth;
|
||||
|
||||
constructor() {
|
||||
@ -420,10 +410,7 @@ class SettingsStore {
|
||||
else newSettings = await api.settings.getSettings(true);
|
||||
|
||||
if (window["AscDesktopEditor"] !== undefined || this.personal) {
|
||||
const dp = combineUrl(
|
||||
window.DocSpaceConfig?.proxy?.url,
|
||||
"/products/files/"
|
||||
);
|
||||
const dp = combineUrl(window.DocSpaceConfig?.proxy?.url, "/products/files/");
|
||||
this.setDefaultPage(dp);
|
||||
}
|
||||
|
||||
@ -433,7 +420,7 @@ class SettingsStore {
|
||||
key,
|
||||
key === "defaultPage"
|
||||
? combineUrl(window.DocSpaceConfig?.proxy?.url, newSettings[key])
|
||||
: newSettings[key]
|
||||
: newSettings[key],
|
||||
);
|
||||
if (key === "culture") {
|
||||
if (newSettings.wizardToken) return;
|
||||
@ -494,7 +481,7 @@ class SettingsStore {
|
||||
requests.push(
|
||||
this.getPortalSettings(),
|
||||
this.getAppearanceTheme(),
|
||||
this.getWhiteLabelLogoUrls()
|
||||
this.getWhiteLabelLogoUrls(),
|
||||
);
|
||||
|
||||
await Promise.all(requests);
|
||||
@ -534,12 +521,12 @@ class SettingsStore {
|
||||
setAdditionalResources = async (
|
||||
feedbackAndSupportEnabled,
|
||||
videoGuidesEnabled,
|
||||
helpCenterEnabled
|
||||
helpCenterEnabled,
|
||||
) => {
|
||||
return await api.settings.setAdditionalResources(
|
||||
feedbackAndSupportEnabled,
|
||||
videoGuidesEnabled,
|
||||
helpCenterEnabled
|
||||
helpCenterEnabled,
|
||||
);
|
||||
};
|
||||
|
||||
@ -586,13 +573,7 @@ class SettingsStore {
|
||||
};
|
||||
|
||||
setCompanyInfoSettings = async (address, companyName, email, phone, site) => {
|
||||
return api.settings.setCompanyInfoSettings(
|
||||
address,
|
||||
companyName,
|
||||
email,
|
||||
phone,
|
||||
site
|
||||
);
|
||||
return api.settings.setCompanyInfoSettings(address, companyName, email, phone, site);
|
||||
};
|
||||
|
||||
setLogoUrl = (url) => {
|
||||
@ -651,15 +632,11 @@ class SettingsStore {
|
||||
};
|
||||
|
||||
getLoginLink = (token, code) => {
|
||||
return combineUrl(
|
||||
window.DocSpaceConfig?.proxy?.url,
|
||||
`/login.ashx?p=${token}&code=${code}`
|
||||
);
|
||||
return combineUrl(window.DocSpaceConfig?.proxy?.url, `/login.ashx?p=${token}&code=${code}`);
|
||||
};
|
||||
|
||||
setModuleInfo = (homepage, productId) => {
|
||||
if (this.homepage === homepage || this.currentProductId === productId)
|
||||
return;
|
||||
if (this.homepage === homepage || this.currentProductId === productId) return;
|
||||
|
||||
console.log(`setModuleInfo('${homepage}', '${productId}')`);
|
||||
|
||||
@ -705,17 +682,12 @@ class SettingsStore {
|
||||
this.setPasswordSettings(settings);
|
||||
};
|
||||
|
||||
setPortalPasswordSettings = async (
|
||||
minLength,
|
||||
upperCase,
|
||||
digits,
|
||||
specSymbols
|
||||
) => {
|
||||
setPortalPasswordSettings = async (minLength, upperCase, digits, specSymbols) => {
|
||||
const settings = await api.settings.setPortalPasswordSettings(
|
||||
minLength,
|
||||
upperCase,
|
||||
digits,
|
||||
specSymbols
|
||||
specSymbols,
|
||||
);
|
||||
this.setPasswordSettings(settings);
|
||||
};
|
||||
@ -772,8 +744,7 @@ class SettingsStore {
|
||||
};
|
||||
|
||||
get socketHelper() {
|
||||
const socketUrl =
|
||||
this.isPublicRoom && !this.publicRoomKey ? null : this.socketUrl;
|
||||
const socketUrl = this.isPublicRoom && !this.publicRoomKey ? null : this.socketUrl;
|
||||
|
||||
return new SocketIOHelper(socketUrl, this.publicRoomKey);
|
||||
}
|
||||
@ -793,8 +764,7 @@ class SettingsStore {
|
||||
...versionInfo,
|
||||
};
|
||||
|
||||
if (!this.buildVersionInfo.documentServer)
|
||||
this.buildVersionInfo.documentServer = "6.4.1";
|
||||
if (!this.buildVersionInfo.documentServer) this.buildVersionInfo.documentServer = "6.4.1";
|
||||
};
|
||||
|
||||
setTheme = (key) => {
|
||||
@ -812,8 +782,7 @@ class SettingsStore {
|
||||
case ThemeKeys.SystemStr:
|
||||
default:
|
||||
theme =
|
||||
window.matchMedia &&
|
||||
window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||
window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||
? ThemeKeys.DarkStr
|
||||
: ThemeKeys.BaseStr;
|
||||
theme = getSystemTheme();
|
||||
@ -893,11 +862,7 @@ class SettingsStore {
|
||||
};
|
||||
|
||||
setBruteForceProtection = async (AttemptCount, BlockTime, CheckPeriod) => {
|
||||
return api.settings.setBruteForceProtection(
|
||||
AttemptCount,
|
||||
BlockTime,
|
||||
CheckPeriod
|
||||
);
|
||||
return api.settings.setBruteForceProtection(AttemptCount, BlockTime, CheckPeriod);
|
||||
};
|
||||
|
||||
setIsBurgerLoading = (isBurgerLoading) => {
|
||||
@ -967,10 +932,7 @@ class SettingsStore {
|
||||
current: current || this.articleAlertsData.current,
|
||||
available: available || this.articleAlertsData.available,
|
||||
};
|
||||
localStorage.setItem(
|
||||
"articleAlertsData",
|
||||
JSON.stringify(this.articleAlertsData)
|
||||
);
|
||||
localStorage.setItem("articleAlertsData", JSON.stringify(this.articleAlertsData));
|
||||
};
|
||||
|
||||
incrementIndexOfArticleAlertsData = () => {
|
||||
@ -987,9 +949,7 @@ class SettingsStore {
|
||||
|
||||
removeAlertFromArticleAlertsData = (alertToRemove) => {
|
||||
const { available } = this.articleAlertsData;
|
||||
const filteredAvailable = available.filter(
|
||||
(alert) => alert !== alertToRemove
|
||||
);
|
||||
const filteredAvailable = available.filter((alert) => alert !== alertToRemove);
|
||||
this.updateArticleAlertsData({ available: filteredAvailable });
|
||||
};
|
||||
|
||||
@ -1022,13 +982,11 @@ class SettingsStore {
|
||||
};
|
||||
|
||||
setWindowWidth = (width) => {
|
||||
if (width <= deviceSize.mobile && this.windowWidth <= deviceSize.mobile)
|
||||
return;
|
||||
if (width <= deviceSize.mobile && this.windowWidth <= deviceSize.mobile) return;
|
||||
|
||||
if (isTablet(width) && isTablet(this.windowWidth)) return;
|
||||
|
||||
if (width > deviceSize.desktop && this.windowWidth > deviceSize.desktop)
|
||||
return;
|
||||
if (width > deviceSize.desktop && this.windowWidth > deviceSize.desktop) return;
|
||||
|
||||
this.windowWidth = width;
|
||||
};
|
||||
|
@ -151,6 +151,8 @@
|
||||
"In": "in",
|
||||
"IncorrectDomain": "Incorrect domain",
|
||||
"IncorrectEmail": "Incorrect email",
|
||||
"IncorrectFirstName": "Incorrect first name",
|
||||
"IncorrectLastName": "Incorrect last name",
|
||||
"IncorrectLocalPart": "Incorrect local part",
|
||||
"IncorrectPassword": "Incorrect password",
|
||||
"Info": "Info",
|
||||
|
@ -149,6 +149,8 @@
|
||||
"In": "в",
|
||||
"IncorrectDomain": "Некорректный домен",
|
||||
"IncorrectEmail": "Некорректный email",
|
||||
"IncorrectFirstName": "Некорректное имя",
|
||||
"IncorrectLastName": "Некорректная фамилия",
|
||||
"IncorrectLocalPart": "Некорректное имя почтового ящика",
|
||||
"IncorrectPassword": "Неправильный пароль",
|
||||
"Info": "Информация",
|
||||
|
Loading…
Reference in New Issue
Block a user