diff --git a/web/ASC.Web.Client/src/components/pages/Confirm/index.js b/web/ASC.Web.Client/src/components/pages/Confirm/index.js
index 8052ab4e14..ea4e1baa45 100644
--- a/web/ASC.Web.Client/src/components/pages/Confirm/index.js
+++ b/web/ASC.Web.Client/src/components/pages/Confirm/index.js
@@ -31,7 +31,7 @@ const Confirm = ({ match, language }) => {
path={`${match.path}/LinkInvite`}
component={CreateUserForm}
/>
-
diff --git a/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/activateUser.js b/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/activateUser.js
index 44f69cce06..489687e155 100644
--- a/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/activateUser.js
+++ b/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/activateUser.js
@@ -44,35 +44,25 @@ const ConfirmContainer = styled.div`
`;
-const emailInputName = 'email';
-const passwordInputName = 'password';
-
class Confirm extends React.PureComponent {
constructor(props) {
super(props);
- const queryParams = props.location.search.slice(1).split('&');
- const arrayOfQueryParams = queryParams.map(queryParam => queryParam.split('='));
- const linkParams = Object.fromEntries(arrayOfQueryParams);
- const indexOfSlash = this.props.match.path.lastIndexOf('/');
- const typeLink = this.props.match.path.slice(indexOfSlash + 1);
-
this.state = {
- email: decodeURIComponent(linkParams.email),
- emailValid: true,
- firstName: decodeURIComponent(linkParams.firstname),
+ email: props.linkData.email,
+ firstName: props.linkData.firstname,
firstNameValid: true,
- lastName: decodeURIComponent(linkParams.lastname),
+ lastName: props.linkData.lastname,
lastNameValid: true,
password: '',
passwordValid: true,
errorText: '',
isLoading: false,
passwordEmpty: false,
- queryString: `type=${typeLink}&${props.location.search.slice(1)}`,
- type: typeLink,
- userId: linkParams.uid
+ key: props.linkData.confirmHeader,
+ linkType: props.linkData.type,
+ userId: props.linkData.uid
};
}
@@ -110,22 +100,19 @@ class Confirm extends React.PureComponent {
userName: this.state.email,
password: this.state.password
};
+
const personalData = {
firstname: this.state.firstName,
- lastname: this.state.lastName,
- email: this.state.email
+ lastname: this.state.lastName
};
- activateConfirmUser(personalData, loginData, this.state.queryString, this.state.userId, EmployeeActivationStatus.Activated)
+ activateConfirmUser(personalData, loginData, this.state.key, this.state.userId, EmployeeActivationStatus.Activated)
.then(() => history.push('/'))
.catch(e => {
console.error("activate error", e);
this.setState({ errorText: e.message });
this.setState({ isLoading: false });
});
-
-
-
});
};
@@ -141,7 +128,7 @@ class Confirm extends React.PureComponent {
componentDidMount() {
const { getConfirmationInfo, history } = this.props;
- getConfirmationInfo(this.state.queryString)
+ getConfirmationInfo(this.state.key, this.state.linkType)
.then(
function () {
console.log("get settings success");
@@ -173,7 +160,6 @@ class Confirm extends React.PureComponent {
this.state.errorText && this.setState({ errorText: "" });;
}
-
onChangePassword = event => {
this.setState({ password: event.target.value });
!this.state.passwordValid && this.setState({ passwordValid: true });
@@ -244,8 +230,8 @@ class Confirm extends React.PureComponent {
{
- const queryString = querySearch.slice(1).split('&');
+const decomposeConfirmLink = (url, querySearch) => {
+ const decodedString = decodeURIComponent(querySearch);
+ const queryString = decodedString.slice(1).split('&');
const arrayOfQueryString = queryString.map(queryParam => queryParam.split('='));
const queryParams = Object.fromEntries(arrayOfQueryString);
const posSeparator = url.lastIndexOf('/');
@@ -8,4 +9,4 @@ const decomposeLink = (url, querySearch) => {
return data;
}
-export default decomposeLink;
\ No newline at end of file
+export default decomposeConfirmLink;
\ No newline at end of file
diff --git a/web/ASC.Web.Client/src/store/auth/actions.js b/web/ASC.Web.Client/src/store/auth/actions.js
index a310d18411..b07d55c175 100644
--- a/web/ASC.Web.Client/src/store/auth/actions.js
+++ b/web/ASC.Web.Client/src/store/auth/actions.js
@@ -171,14 +171,14 @@ export function changeEmail(userId, email, key) {
}
export function activateConfirmUser(personalData, loginData, key, userId, activationStatus) {
- const data = Object.assign({}, personalData, loginData);
const changedData = {
id: userId,
FirstName: personalData.firstname,
LastName: personalData.lastname
}
+
return dispatch => {
- return api.changePassword(userId, data, key)
+ return api.changePassword(userId, { password: loginData.password }, key)
.then(res => {
checkResponseError(res);
console.log('set password success:', res.data.response);