Merge branch 'release/v1.1.0' into feature/make-form

This commit is contained in:
Ilya Oleshko 2021-11-29 14:20:02 +03:00
commit 850eb13b0d
17 changed files with 156 additions and 57 deletions

View File

@ -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");

View File

@ -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);

View File

@ -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();

View File

@ -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
}
}

View File

@ -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; }

View File

@ -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};
@ -73,7 +75,7 @@ const CloseButton = styled(CrossSidebarIcon)`
&:hover {
path {
fill: ${(props) => props.theme.modalDialog.closeButton.hoverColor};
stroke: ${(props) => props.theme.modalDialog.closeButton.hoverColor};
}
}
`;

View File

@ -492,6 +492,7 @@ const Base = {
content: {
backgroundColor: white,
modalPadding: "0 12px 12px",
modalBorderRadius: "6px",
asidePadding: "0 16px 16px",
heading: {
maxWidth: "500px",
@ -509,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,
},
},
@ -758,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",

View File

@ -458,6 +458,7 @@ const Dark = {
content: {
backgroundColor: white,
padding: "0 16px 16px",
modalBorderRadius: "6px",
heading: {
maxWidth: "500px",
@ -472,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,
},
},
@ -719,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",

View File

@ -92,7 +92,7 @@ class LinkRow extends React.Component {
color="#333"
dropdownType="alwaysDashed"
data={options}
fontSize="14px"
fontSize="13px"
fontWeight={600}
isDisabled={isDisabled}
>

View File

@ -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 {
@ -763,7 +777,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 {
@ -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;
@ -828,8 +843,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,15 +861,13 @@ 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;
padding-right: 12px;
${(props) => props.isChecked && `background:#F8F9F9;`}
cursor: ${(props) => (props.needRowSelection ? "pointer" : "default")};
border-bottom: 1px solid #eceef1;
@ -869,7 +881,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) =>
@ -883,6 +895,9 @@ const StyledModalRowContainer = styled.div`
min-height: 47px;
.link-row__container {
display: flex;
align-items: center;
height: 41px;
width: 100%;
.link-row {

View File

@ -0,0 +1,11 @@
namespace ASC.Files.Core.Model
{
public class CopyAsModel<T>
{
public string Title { get; set; }
public T FolderId { get; set; }
public bool EnableExternalExt { get; set; }
}
}

View File

@ -1118,6 +1118,37 @@ namespace ASC.Api.Documents
return FilesControllerHelperInt.GetFileInfo(fileId, version);
}
[Create("file/{fileId:int}/copyas")]
public FileWrapper<int> CopyFileAs(int fileId, [FromBody] CopyAsModel<int> 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<int>()
{
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);
}
}
/// <summary>
/// Updates the information of the selected file with the parameters specified in the request
/// </summary>

View File

@ -1,3 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.85498 16L1.15188 16C0.518827 16 0.00382324 15.485 0.00378789 14.8519L0.00378713 6.14776C0.00378708 5.51468 0.518826 4.99964 1.15187 4.99964L4.01036 4.99964L4.01036 9.96112C4.01036 11.1721 4.75801 11.9963 5.96898 11.9963L11.0031 11.9963L11.0031 14.8519C11.0031 15.485 10.4881 16 9.85498 16ZM14.8703 11.0013L6.12976 11.0013C5.50682 11.0013 4.99997 10.4945 5 9.87155L5 1.12969C5 0.506788 5.50679 9.17346e-07 6.12973 8.62887e-07L14.8703 9.87639e-08C15.4932 4.43048e-08 16 0.506787 16 1.12973L16 9.87155C16 10.4945 15.4932 11.0013 14.8703 11.0013Z" fill="#A3A9AE"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.14502 -1.07443e-06L14.8481 -2.59613e-06C15.4812 -2.70681e-06 15.9962 0.515037 15.9962 1.14808L15.9962 9.85224C15.9962 10.4853 15.4812 11.0004 14.8481 11.0004L11.9896 11.0004L11.9896 6.03888C11.9896 4.82791 11.242 4.00369 10.031 4.00369L4.99694 4.00369L4.99694 1.14809C4.99693 0.515038 5.51194 -9.63738e-07 6.14502 -1.07443e-06ZM1.12973 4.99872L9.87024 4.99872C10.4932 4.99872 11 5.50551 11 6.12845L11 14.8703C11 15.4932 10.4932 16 9.87028 16L1.12973 16C0.50679 16 3.70837e-05 15.4932 2.6e-06 14.8703L1.07154e-06 6.12845C9.62618e-07 5.50551 0.506823 4.99872 1.12973 4.99872Z" fill="#A3A9AE"/>
</svg>

Before

Width:  |  Height:  |  Size: 716 B

After

Width:  |  Height:  |  Size: 747 B

View File

@ -1,3 +1,4 @@
<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.9862 0.721877L16.2791 0.0147705L8.50091 7.79295L0.722732 0.0147736L0.015625 0.72188L7.7938 8.50006L0.0156276 16.2782L0.722734 16.9853L8.50091 9.20716L16.2791 16.9853L16.9862 16.2782L9.20801 8.50005L16.9862 0.721877Z" fill="#D0D5DA"/>
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 1.99951L1.99968 11.9998" stroke="#A3A9AE" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M2 1.99951L12.0003 11.9998" stroke="#A3A9AE" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 390 B

After

Width:  |  Height:  |  Size: 344 B

View File

@ -1,12 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g stroke="none" stroke-width="1" fill-rule="evenodd">
<g transform="translate(-168.000000, -936.000000)" fill="#000000">
<g transform="translate(24.000000, 888.000000)">
<g transform="translate(144.000000, 48.000000)">
<path fill="#000000" stroke="#000000" stroke-width="0.1" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" d="m1.40265,7.01045c0,0 21.20239,0 21.20239,0c0,0 -10.56768,11.23794 -10.56768,11.23794c0,0 -10.63471,-11.23794 -10.63471,-11.23794z" id="svg_29"/>
</g>
</g>
</g>
</g>
</svg>
<svg width="5" height="4" viewBox="0 0 5 4" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.5 4L0 1L5 1L2.5 4Z" fill="#333333"/>
</svg>

Before

Width:  |  Height:  |  Size: 804 B

After

Width:  |  Height:  |  Size: 188 B

View File

@ -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);
@ -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
{

View File

@ -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