From af95e8aacc5d2cdab66d6bd86228247f07481527 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 26 Nov 2021 17:37:27 +0300 Subject: [PATCH 01/12] Web: Components: added border-radius to modal-dialog --- packages/asc-web-components/modal-dialog/styled-modal-dialog.js | 2 ++ packages/asc-web-components/themes/base.js | 1 + packages/asc-web-components/themes/dark.js | 1 + 3 files changed, 4 insertions(+) diff --git a/packages/asc-web-components/modal-dialog/styled-modal-dialog.js b/packages/asc-web-components/modal-dialog/styled-modal-dialog.js index 787761b300..884149074c 100644 --- a/packages/asc-web-components/modal-dialog/styled-modal-dialog.js +++ b/packages/asc-web-components/modal-dialog/styled-modal-dialog.js @@ -28,6 +28,8 @@ const Content = styled.div` props.displayType === "modal" ? props.theme.modalDialog.content.modalPadding : props.theme.modalDialog.content.asidePadding}; + border-radius: ${(props) => + props.theme.modalDialog.content.modalBorderRadius}; .heading { max-width: ${(props) => props.theme.modalDialog.content.heading.maxWidth}; diff --git a/packages/asc-web-components/themes/base.js b/packages/asc-web-components/themes/base.js index a92e101c12..3240c9eb7c 100644 --- a/packages/asc-web-components/themes/base.js +++ b/packages/asc-web-components/themes/base.js @@ -492,6 +492,7 @@ const Base = { content: { backgroundColor: white, modalPadding: "0 12px 12px", + modalBorderRadius: "6px", asidePadding: "0 16px 16px", heading: { maxWidth: "500px", diff --git a/packages/asc-web-components/themes/dark.js b/packages/asc-web-components/themes/dark.js index af6723b1ec..6508f85bec 100644 --- a/packages/asc-web-components/themes/dark.js +++ b/packages/asc-web-components/themes/dark.js @@ -458,6 +458,7 @@ const Dark = { content: { backgroundColor: white, padding: "0 16px 16px", + modalBorderRadius: "6px", heading: { maxWidth: "500px", From 3f56b018323c06965c6ca8fd005bf204d442f647 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 26 Nov 2021 18:08:43 +0300 Subject: [PATCH 02/12] Web: Files: added margin to modal-dialog_file-name --- products/ASC.Files/Client/src/components/panels/StyledPanels.js | 1 + 1 file changed, 1 insertion(+) diff --git a/products/ASC.Files/Client/src/components/panels/StyledPanels.js b/products/ASC.Files/Client/src/components/panels/StyledPanels.js index 53be0f7eb1..0d2677db5a 100644 --- a/products/ASC.Files/Client/src/components/panels/StyledPanels.js +++ b/products/ASC.Files/Client/src/components/panels/StyledPanels.js @@ -856,6 +856,7 @@ const StyledFilesList = styled.div` } .modal-dialog_file-name { border-radius: 3px; + margin-right: 12px; ${(props) => props.isChecked && `background:#F8F9F9;`} cursor: ${(props) => (props.needRowSelection ? "pointer" : "default")}; border-bottom: 1px solid #eceef1; From b716f95a71f9ab1e0785ae1175d4bfb4c7cfb63d Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 26 Nov 2021 18:22:30 +0300 Subject: [PATCH 03/12] Web: Files: fixed FilesListRow styles --- .../Client/src/components/panels/StyledPanels.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/products/ASC.Files/Client/src/components/panels/StyledPanels.js b/products/ASC.Files/Client/src/components/panels/StyledPanels.js index 0d2677db5a..9c736c2688 100644 --- a/products/ASC.Files/Client/src/components/panels/StyledPanels.js +++ b/products/ASC.Files/Client/src/components/panels/StyledPanels.js @@ -828,8 +828,7 @@ const StyledFilesList = styled.div` white-space: nowrap; text-overflow: ellipsis; overflow: hidden; - max-width: ${(props) => - props.displayType === "aside" ? "213px" : "274px"}; + max-width: ${(props) => props.displayType === "aside" && "213px"}; grid-area: full-name; display: flex; @@ -847,12 +846,9 @@ const StyledFilesList = styled.div` } .files-list_file-children_wrapper { grid-area: owner-name; - margin-right: 12px; - ${(props) => - props.displayType === "aside" && - css` - margin-top: -17px; - `} + /* margin-right: 12px; */ + margin-top: ${(props) => + props.displayType === "aside" ? "-17px" : "-8px"}; } .modal-dialog_file-name { border-radius: 3px; @@ -870,7 +866,7 @@ const StyledFilesList = styled.div` ` : css` height: 41px; - grid-template-areas: "checked-button icon-name full-name owner-name"; + grid-template-areas: "checked-button icon-name full-name" "checked-button icon-name owner-name"; `} grid-template-columns: 22px 33px 1fr; padding-left: ${(props) => From d297fa0dd1be6b1e034bca18abb0e4b2b41a4ac9 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Fri, 26 Nov 2021 21:36:51 +0300 Subject: [PATCH 04/12] fix Bug 52071 --- web/ASC.Web.Api/Controllers/AuthenticationController.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/ASC.Web.Api/Controllers/AuthenticationController.cs b/web/ASC.Web.Api/Controllers/AuthenticationController.cs index 191d4659c2..eed75f442f 100644 --- a/web/ASC.Web.Api/Controllers/AuthenticationController.cs +++ b/web/ASC.Web.Api/Controllers/AuthenticationController.cs @@ -436,6 +436,8 @@ namespace ASC.Web.Api.Controllers { throw new Exception("user not found"); } + + Cache.Insert("loginsec/" + memberModel.UserName, (--counter).ToString(CultureInfo.InvariantCulture), DateTime.UtcNow.Add(TimeSpan.FromMinutes(1))); } else { From cecfc406c5224502577d5d5437097c2a8634d057 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Fri, 26 Nov 2021 21:59:39 +0300 Subject: [PATCH 05/12] Auth: added session param --- web/ASC.Web.Api/Controllers/AuthenticationController.cs | 2 +- web/ASC.Web.Api/Models/AuthModel.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/web/ASC.Web.Api/Controllers/AuthenticationController.cs b/web/ASC.Web.Api/Controllers/AuthenticationController.cs index eed75f442f..58fab2bfdd 100644 --- a/web/ASC.Web.Api/Controllers/AuthenticationController.cs +++ b/web/ASC.Web.Api/Controllers/AuthenticationController.cs @@ -301,7 +301,7 @@ namespace ASC.Web.Api.Controllers try { var token = SecurityContext.AuthenticateMe(user.ID); - CookiesManager.SetCookies(CookiesType.AuthKey, token); + CookiesManager.SetCookies(CookiesType.AuthKey, token, auth.Session); MessageService.Send(viaEmail ? MessageAction.LoginSuccessViaApi : MessageAction.LoginSuccessViaApiSocialAccount); diff --git a/web/ASC.Web.Api/Models/AuthModel.cs b/web/ASC.Web.Api/Models/AuthModel.cs index 27ae1b864c..f112eeb4c3 100644 --- a/web/ASC.Web.Api/Models/AuthModel.cs +++ b/web/ASC.Web.Api/Models/AuthModel.cs @@ -9,6 +9,7 @@ public string AccessToken { get; set; } public string SerializedProfile { get; set; } public string Code { get; set; } + public bool Session { get; set; } } public class MobileModel From 4f4fd7811f76ca6565b2e4f47959ab1b40432fd7 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Mon, 29 Nov 2021 11:29:46 +0300 Subject: [PATCH 06/12] Web: Files: fixed modal-dialog_file-name styles --- products/ASC.Files/Client/src/components/panels/StyledPanels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/products/ASC.Files/Client/src/components/panels/StyledPanels.js b/products/ASC.Files/Client/src/components/panels/StyledPanels.js index 9c736c2688..e6fc3463fe 100644 --- a/products/ASC.Files/Client/src/components/panels/StyledPanels.js +++ b/products/ASC.Files/Client/src/components/panels/StyledPanels.js @@ -852,7 +852,7 @@ const StyledFilesList = styled.div` } .modal-dialog_file-name { border-radius: 3px; - margin-right: 12px; + padding-right: 12px; ${(props) => props.isChecked && `background:#F8F9F9;`} cursor: ${(props) => (props.needRowSelection ? "pointer" : "default")}; border-bottom: 1px solid #eceef1; From aed178f0b104c969b3eef8d8e315afe72cf063aa Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Mon, 29 Nov 2021 11:58:27 +0300 Subject: [PATCH 07/12] Web: updated icons --- public/images/copy.react.svg | 2 +- public/images/cross.sidebar.react.svg | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/images/copy.react.svg b/public/images/copy.react.svg index ea6ff819ed..366df0d4a8 100644 --- a/public/images/copy.react.svg +++ b/public/images/copy.react.svg @@ -1,3 +1,3 @@ - + diff --git a/public/images/cross.sidebar.react.svg b/public/images/cross.sidebar.react.svg index c0ccb863e9..b8ebc5145f 100644 --- a/public/images/cross.sidebar.react.svg +++ b/public/images/cross.sidebar.react.svg @@ -1,3 +1,4 @@ - - + + + From 4586cb45d914698eab7ba492d654c7e835a6a871 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Mon, 29 Nov 2021 11:58:54 +0300 Subject: [PATCH 08/12] Web: Components: fixed CloseButton styles --- packages/asc-web-components/modal-dialog/styled-modal-dialog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/asc-web-components/modal-dialog/styled-modal-dialog.js b/packages/asc-web-components/modal-dialog/styled-modal-dialog.js index 884149074c..8d3c76eb69 100644 --- a/packages/asc-web-components/modal-dialog/styled-modal-dialog.js +++ b/packages/asc-web-components/modal-dialog/styled-modal-dialog.js @@ -75,7 +75,7 @@ const CloseButton = styled(CrossSidebarIcon)` &:hover { path { - fill: ${(props) => props.theme.modalDialog.closeButton.hoverColor}; + stroke: ${(props) => props.theme.modalDialog.closeButton.hoverColor}; } } `; From e774dd056117f16bf9616b148229d116346b4bb9 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Mon, 29 Nov 2021 12:01:39 +0300 Subject: [PATCH 09/12] Web: Files: fixed modal dialog styles --- products/ASC.Files/Client/src/components/panels/StyledPanels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/products/ASC.Files/Client/src/components/panels/StyledPanels.js b/products/ASC.Files/Client/src/components/panels/StyledPanels.js index e6fc3463fe..355df112fe 100644 --- a/products/ASC.Files/Client/src/components/panels/StyledPanels.js +++ b/products/ASC.Files/Client/src/components/panels/StyledPanels.js @@ -763,7 +763,7 @@ const StyledSelectFilePanel = styled.div` .modal-dialog_body { display: grid; - grid-template-columns: 212px 493px; + grid-template-columns: 228px 477px; height: 295px; grid-template-areas: "tree files-list"; .modal-dialog_tree-body { From 99c71148d890d64236f7eb7f03d8cdbbbeb1559c Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Mon, 29 Nov 2021 12:58:21 +0300 Subject: [PATCH 10/12] Web: Files: fixed SharingPanel styles --- packages/asc-web-components/themes/base.js | 10 +++++----- packages/asc-web-components/themes/dark.js | 10 +++++----- .../components/panels/SharingPanel/linkRow.js | 2 +- .../src/components/panels/StyledPanels.js | 20 ++++++++++++++++++- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/packages/asc-web-components/themes/base.js b/packages/asc-web-components/themes/base.js index 3240c9eb7c..66c0fe9f96 100644 --- a/packages/asc-web-components/themes/base.js +++ b/packages/asc-web-components/themes/base.js @@ -510,13 +510,13 @@ const Base = { }, closeButton: { - width: "17px", - height: "17px", - minWidth: "17px", - minHeight: "17px", + width: "14px", + height: "14px", + minWidth: "14px", + minHeight: "14px", right: "16px", - top: "11px", + top: "13px", hoverColor: grayMain, }, }, diff --git a/packages/asc-web-components/themes/dark.js b/packages/asc-web-components/themes/dark.js index 6508f85bec..cdf4044905 100644 --- a/packages/asc-web-components/themes/dark.js +++ b/packages/asc-web-components/themes/dark.js @@ -473,13 +473,13 @@ const Dark = { }, closeButton: { - width: "17px", - height: "17px", - minWidth: "17px", - minHeight: "17px", + width: "14px", + height: "14px", + minWidth: "14px", + minHeight: "14px", right: "16px", - top: "19px", + top: "13px", hoverColor: grayMain, }, }, diff --git a/products/ASC.Files/Client/src/components/panels/SharingPanel/linkRow.js b/products/ASC.Files/Client/src/components/panels/SharingPanel/linkRow.js index babdf9fa5b..2ba6c7adbc 100644 --- a/products/ASC.Files/Client/src/components/panels/SharingPanel/linkRow.js +++ b/products/ASC.Files/Client/src/components/panels/SharingPanel/linkRow.js @@ -92,7 +92,7 @@ class LinkRow extends React.Component { color="#333" dropdownType="alwaysDashed" data={options} - fontSize="14px" + fontSize="13px" fontWeight={600} isDisabled={isDisabled} > diff --git a/products/ASC.Files/Client/src/components/panels/StyledPanels.js b/products/ASC.Files/Client/src/components/panels/StyledPanels.js index 355df112fe..83f71d2bad 100644 --- a/products/ASC.Files/Client/src/components/panels/StyledPanels.js +++ b/products/ASC.Files/Client/src/components/panels/StyledPanels.js @@ -574,6 +574,20 @@ const StyledLinkRow = styled.div` .sharing_panel-link-container { display: flex; + + .sharing_panel-link { + a { + text-decoration: none; + + ${(props) => + props.isDisabled && + css` + :hover { + text-decoration: none; + } + `}; + } + } } .link-row { @@ -809,7 +823,8 @@ const StyledFilesList = styled.div` } .files-list_file-owner { - max-width: 213px; + max-width: ${(props) => + props.displayType === "aside" ? "213px" : "406px"}; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; @@ -880,6 +895,9 @@ const StyledModalRowContainer = styled.div` min-height: 47px; .link-row__container { + display: flex; + align-items: center; + height: 41px; width: 100%; .link-row { From 4dac8e9ce6c7c770711d1b39f6129c8c38fa051e Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Mon, 29 Nov 2021 13:11:01 +0300 Subject: [PATCH 11/12] Web: Components: changed expander-down.react.svg, fixed styles --- packages/asc-web-components/themes/base.js | 8 ++++---- packages/asc-web-components/themes/dark.js | 8 ++++---- public/images/expander-down.react.svg | 15 +++------------ 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/packages/asc-web-components/themes/base.js b/packages/asc-web-components/themes/base.js index 66c0fe9f96..692b1d1686 100644 --- a/packages/asc-web-components/themes/base.js +++ b/packages/asc-web-components/themes/base.js @@ -759,10 +759,10 @@ const Base = { span: { maxWidth: "300px" }, caret: { - width: "8px", - minWidth: "8px", - height: "8px", - minHeight: "8px", + width: "5px", + minWidth: "5px", + height: "4px", + minHeight: "4px", marginLeft: "5px", marginTop: "-4px", right: "6px", diff --git a/packages/asc-web-components/themes/dark.js b/packages/asc-web-components/themes/dark.js index cdf4044905..0087ea457d 100644 --- a/packages/asc-web-components/themes/dark.js +++ b/packages/asc-web-components/themes/dark.js @@ -720,10 +720,10 @@ const Dark = { span: { maxWidth: "300px" }, caret: { - width: "8px", - minWidth: "8px", - height: "8px", - minHeight: "8px", + width: "5px", + minWidth: "5px", + height: "4px", + minHeight: "4px", marginLeft: "5px", marginTop: "-4px", right: "6px", diff --git a/public/images/expander-down.react.svg b/public/images/expander-down.react.svg index 4de887bdcd..df12fe3c15 100644 --- a/public/images/expander-down.react.svg +++ b/public/images/expander-down.react.svg @@ -1,12 +1,3 @@ - - - - - - - - - - - - \ No newline at end of file + + + From 85316c9d63c4f7fcd5ff8e9986bdbee11d55367d Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Mon, 29 Nov 2021 14:11:03 +0300 Subject: [PATCH 12/12] Moved from 45122194 --- common/ASC.Common/Web/MimeMapping.cs | 6 ++-- .../ASC.ApiSystem/Classes/CommonMethods.cs | 20 ++++++++++-- .../Controllers/PortalController.cs | 8 ++--- .../ASC.ApiSystem/Models/RecaptchaType.cs | 25 +++++++++++++++ .../ASC.ApiSystem/Models/TenantModel.cs | 4 ++- products/ASC.Files/Core/Model/CopyAsModel.cs | 11 +++++++ .../Server/Controllers/FilesController.cs | 31 +++++++++++++++++++ 7 files changed, 95 insertions(+), 10 deletions(-) create mode 100644 common/services/ASC.ApiSystem/Models/RecaptchaType.cs create mode 100644 products/ASC.Files/Core/Model/CopyAsModel.cs diff --git a/common/ASC.Common/Web/MimeMapping.cs b/common/ASC.Common/Web/MimeMapping.cs index f7bdd493b1..eeefcc7d18 100644 --- a/common/ASC.Common/Web/MimeMapping.cs +++ b/common/ASC.Common/Web/MimeMapping.cs @@ -159,7 +159,8 @@ namespace ASC.Common.Web AddMimeMapping(".docm", "application/vnd.ms-word.document.macroEnabled.12"); AddMimeMapping(".doct", "application/doct"); AddMimeMapping(".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); - AddMimeMapping(".docxf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + AddMimeMapping(".docxf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + AddMimeMapping(".docxf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf"); AddMimeMapping(".dot", "application/msword"); AddMimeMapping(".dotm", "application/vnd.ms-word.template.macroEnabled.12"); AddMimeMapping(".dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template"); @@ -431,7 +432,8 @@ namespace ASC.Common.Web AddMimeMapping(".odp", "application/vnd.oasis.opendocument.presentation"); AddMimeMapping(".ods", "application/vnd.oasis.opendocument.spreadsheet"); AddMimeMapping(".odt", "application/vnd.oasis.opendocument.text"); - AddMimeMapping(".oform", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + AddMimeMapping(".oform", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); + AddMimeMapping(".oform", "application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform"); AddMimeMapping(".oga", "audio/ogg"); AddMimeMapping(".ogg", "video/ogg"); AddMimeMapping(".ogg", "audio/ogg"); diff --git a/common/services/ASC.ApiSystem/Classes/CommonMethods.cs b/common/services/ASC.ApiSystem/Classes/CommonMethods.cs index 377bd9d215..84519d0df1 100644 --- a/common/services/ASC.ApiSystem/Classes/CommonMethods.cs +++ b/common/services/ASC.ApiSystem/Classes/CommonMethods.cs @@ -299,11 +299,25 @@ namespace ASC.ApiSystem.Controllers //return null; } - public bool ValidateRecaptcha(string response, string ip) + public bool ValidateRecaptcha(string response, RecaptchaType recaptchaType, string ip) { try - { - var data = string.Format("secret={0}&remoteip={1}&response={2}", Configuration["recaptcha:private-key"], ip, response); + { + string privateKey; + switch (recaptchaType) + { + case RecaptchaType.AndroidV2: + privateKey = Configuration["recaptcha:private-key:android"]; + break; + case RecaptchaType.iOSV2: + privateKey = Configuration["recaptcha:private-key:ios"]; + break; + default: + privateKey = Configuration["recaptcha:private-key"]; + break; + } + + var data = string.Format("secret={0}&remoteip={1}&response={2}", privateKey, ip, response); var url = Configuration["recaptcha:verify-url"] ?? "https://www.recaptcha.net/recaptcha/api/siteverify"; var webRequest = (HttpWebRequest)WebRequest.Create(url); diff --git a/common/services/ASC.ApiSystem/Controllers/PortalController.cs b/common/services/ASC.ApiSystem/Controllers/PortalController.cs index 81d95688a1..ed15972444 100644 --- a/common/services/ASC.ApiSystem/Controllers/PortalController.cs +++ b/common/services/ASC.ApiSystem/Controllers/PortalController.cs @@ -671,12 +671,12 @@ namespace ASC.ApiSystem.Controllers { Log.DebugFormat("PortalName = {0}; Elapsed ms. ValidateRecaptcha via app key: {1}. {2}", model.PortalName, model.AppKey, sw.ElapsedMilliseconds); return true; - } - - var data = string.Format("{0} {1} {2} {3} {4}", model.PortalName, model.FirstName, model.LastName, model.Email, model.Phone); + } + + var data = string.Format("{0} {1} {2} {3} {4} {5}", model.PortalName, model.FirstName, model.LastName, model.Email, model.Phone, model.recaptchaType); /*** validate recaptcha ***/ - if (!CommonMethods.ValidateRecaptcha(model.RecaptchaResponse, clientIP)) + if (!CommonMethods.ValidateRecaptcha(model.RecaptchaResponse, model.recaptchaType, clientIP)) { Log.DebugFormat("PortalName = {0}; Elapsed ms. ValidateRecaptcha error: {1} {2}", model.PortalName, sw.ElapsedMilliseconds, data); sw.Stop(); diff --git a/common/services/ASC.ApiSystem/Models/RecaptchaType.cs b/common/services/ASC.ApiSystem/Models/RecaptchaType.cs new file mode 100644 index 0000000000..8193e74eda --- /dev/null +++ b/common/services/ASC.ApiSystem/Models/RecaptchaType.cs @@ -0,0 +1,25 @@ +/* + * + * (c) Copyright Ascensio System Limited 2010-2021 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace ASC.ApiSystem.Models +{ + public enum RecaptchaType + { + Default = 0, + AndroidV2 = 1, + iOSV2 = 2 + } +} \ No newline at end of file diff --git a/common/services/ASC.ApiSystem/Models/TenantModel.cs b/common/services/ASC.ApiSystem/Models/TenantModel.cs index dde90598f0..e95d6200c7 100644 --- a/common/services/ASC.ApiSystem/Models/TenantModel.cs +++ b/common/services/ASC.ApiSystem/Models/TenantModel.cs @@ -73,7 +73,9 @@ namespace ASC.ApiSystem.Models [StringLength(32)] public string Phone { get; set; } - public string RecaptchaResponse { get; set; } + public string RecaptchaResponse { get; set; } + + public RecaptchaType RecaptchaType { get; set; } [StringLength(20)] public string Region { get; set; } diff --git a/products/ASC.Files/Core/Model/CopyAsModel.cs b/products/ASC.Files/Core/Model/CopyAsModel.cs new file mode 100644 index 0000000000..f44e1d06f3 --- /dev/null +++ b/products/ASC.Files/Core/Model/CopyAsModel.cs @@ -0,0 +1,11 @@ +namespace ASC.Files.Core.Model +{ + public class CopyAsModel + { + public string Title { get; set; } + + public T FolderId { get; set; } + + public bool EnableExternalExt { get; set; } + } +} diff --git a/products/ASC.Files/Server/Controllers/FilesController.cs b/products/ASC.Files/Server/Controllers/FilesController.cs index 2c544260c1..2ea118c42b 100644 --- a/products/ASC.Files/Server/Controllers/FilesController.cs +++ b/products/ASC.Files/Server/Controllers/FilesController.cs @@ -1118,6 +1118,37 @@ namespace ASC.Api.Documents return FilesControllerHelperInt.GetFileInfo(fileId, version); } + [Create("file/{fileId:int}/copyas")] + public FileWrapper CopyFileAs(int fileId, [FromBody] CopyAsModel model) + { + var file = FileStorageServiceInt.GetFile(fileId, -1); + var ext = FileUtility.GetFileExtension(file.Title); + var destExt = FileUtility.GetFileExtension(model.Title); + + if (ext == destExt) + { + var createFileModel = new CreateFileModel() + { + Title = model.Title, + TemplateId = fileId, + EnableExternalExt = model.EnableExternalExt + }; + + return CreateFileFromBody(createFileModel); + } + + using (var fileStream = FileConverter.Exec(file, destExt)) + { + var insertFileModel = new InsertFileModel() + { + Title = file.Title, + CreateNewIfExist = true, + Stream = fileStream + }; + return InsertFile(model.FolderId, insertFileModel); + } + } + /// /// Updates the information of the selected file with the parameters specified in the request ///