From 3b8796ca93004d005859bd4147a7b6fb6953d756 Mon Sep 17 00:00:00 2001 From: Artem Tarasov Date: Fri, 7 Aug 2020 13:39:53 +0300 Subject: [PATCH] refactoring --- config/appsettings.json | 2 +- .../src/components/pages/Wizard/index.js | 22 +++++++++---------- .../src/store/wizard/reducer.js | 1 - 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/config/appsettings.json b/config/appsettings.json index 97e6b1a85d..cb2bad85f0 100644 --- a/config/appsettings.json +++ b/config/appsettings.json @@ -26,7 +26,7 @@ }, "license": { "file": { - "path": "" + "path": "C:\\" } }, "mail": { diff --git a/web/ASC.Web.Client/src/components/pages/Wizard/index.js b/web/ASC.Web.Client/src/components/pages/Wizard/index.js index a1cc3ebc01..93606d78d1 100644 --- a/web/ASC.Web.Client/src/components/pages/Wizard/index.js +++ b/web/ASC.Web.Client/src/components/pages/Wizard/index.js @@ -89,10 +89,8 @@ class Body extends Component { timezones: null, selectLanguage: null, selectTimezone: null, - file: null, emailNeeded: true, - emailOwner: 'fake@mail.com' } @@ -231,8 +229,8 @@ class Body extends Component { } checkingValid = () => { - const { t, isLicenseRequired } = this.props; - const { isValidPass, emailValid, license, emailNeeded, file } = this.state; + const { t, isLicenseRequired, licenseUpload } = this.props; + const { isValidPass, emailValid, license, emailNeeded } = this.state; if(!isValidPass) toastr.error(t('errorPassword')); if(!license) toastr.error(t('errorLicenseRead')); @@ -244,13 +242,13 @@ class Body extends Component { if (emailNeeded && isLicenseRequired) { if(!emailValid) toastr.error(t('errorEmail')); - if(!file) toastr.error(t('errorUploadLicenseFile')); - if( isValidPass && emailValid && license && file) return true; + if(!licenseUpload) toastr.error(t('errorUploadLicenseFile')); + if( isValidPass && emailValid && license && licenseUpload) return true; } if (!emailNeeded && isLicenseRequired) { - if(!file) toastr.error(t('errorUploadLicenseFile')); - if( isValidPass && license && file) return true; + if(!licenseUpload) toastr.error(t('errorUploadLicenseFile')); + if( isValidPass && license && licenseUpload) return true; } return false; @@ -287,7 +285,6 @@ class Body extends Component { fd.append("file", file ); setLicense(wizardToken, fd) - .then(() => this.setState({ file: true })) .catch( e => this.setState({ errorLoading: true, errorMessage: e @@ -394,7 +391,8 @@ Body.propTypes = { settingsPassword: PropTypes.object, cultures: PropTypes.array.isRequired, timezones: PropTypes.array.isRequired, - portalTimezone: PropTypes.string.isRequired + portalTimezone: PropTypes.string.isRequired, + licenseUpload: PropTypes.string } const WizardWrapper = withTranslation()(Body); @@ -435,7 +433,9 @@ function mapStateToProps(state) { timezones: state.auth.settings.timezones, portalTimezone: state.auth.settings.timezone, - isLicenseRequired: state.wizard.isLicenseRequired + isLicenseRequired: state.wizard.isLicenseRequired, + + licenseUpload: state.wizard.licenseUpload }; } diff --git a/web/ASC.Web.Client/src/store/wizard/reducer.js b/web/ASC.Web.Client/src/store/wizard/reducer.js index a30e097d4e..a8caf21f4b 100644 --- a/web/ASC.Web.Client/src/store/wizard/reducer.js +++ b/web/ASC.Web.Client/src/store/wizard/reducer.js @@ -9,7 +9,6 @@ const initState = { isWizardLoaded: false, isLicenseRequired: false, machineName: 'unknown', - response: null, licenseUpload: null };