diff --git a/products/ASC.Files/Core/ApiModels/ResponseDto/ConfigurationDto.cs b/products/ASC.Files/Core/ApiModels/ResponseDto/ConfigurationDto.cs index bad58fb102..c9a7215fdd 100644 --- a/products/ASC.Files/Core/ApiModels/ResponseDto/ConfigurationDto.cs +++ b/products/ASC.Files/Core/ApiModels/ResponseDto/ConfigurationDto.cs @@ -36,4 +36,5 @@ public class ConfigurationDto public string Token { get; set; } public string Type { get; set; } public FileDto File { get; set; } + public string ErrorMessage { get; set; } } diff --git a/products/ASC.Files/Core/Utils/FileConverter.cs b/products/ASC.Files/Core/Utils/FileConverter.cs index 620e48e7cf..bfff754f50 100644 --- a/products/ASC.Files/Core/Utils/FileConverter.cs +++ b/products/ASC.Files/Core/Utils/FileConverter.cs @@ -553,6 +553,8 @@ public class FileConverter var folderDao = _daoFactory.GetFolderDao(); File newFile = null; var markAsTemplate = false; + var isNewFile = false; + var newFileTitle = FileUtility.ReplaceFileExtension(file.Title, _fileUtility.GetInternalExtension(file.Title)); if (!_filesSettingsHelper.StoreOriginalFiles && await _fileSecurity.CanEditAsync(file)) @@ -584,6 +586,7 @@ public class FileConverter if (newFile != null && await _fileSecurity.CanEditAsync(newFile) && !await _entryManager.FileLockedForMeAsync(newFile.Id) && !_fileTracker.IsEditing(newFile.Id)) { newFile.Version++; + newFile.VersionGroup++; } else { @@ -595,6 +598,7 @@ public class FileConverter { newFile = _serviceProvider.GetService>(); newFile.ParentId = folderId; + isNewFile = true; } } @@ -616,6 +620,11 @@ public class FileConverter using var convertedFileStream = new ResponseStream(response); newFile.ContentLength = convertedFileStream.Length; newFile = await fileDao.SaveFileAsync(newFile, convertedFileStream); + + if (!isNewFile) + { + await _socketManager.UpdateFileAsync(newFile); + } } catch (HttpRequestException e) { diff --git a/web/ASC.Web.Api/Api/AuthenticationController.cs b/web/ASC.Web.Api/Api/AuthenticationController.cs index d4182f7dee..e20861af9f 100644 --- a/web/ASC.Web.Api/Api/AuthenticationController.cs +++ b/web/ASC.Web.Api/Api/AuthenticationController.cs @@ -225,6 +225,7 @@ public class AuthenticationController : ControllerBase var wrapper = await GetUser(inDto); var viaEmail = wrapper.ViaEmail; var user = wrapper.UserInfo; + var session = inDto.Session; if (user == null || Equals(user, Constants.LostUser)) { @@ -275,16 +276,22 @@ public class AuthenticationController : ControllerBase try { var action = viaEmail ? MessageAction.LoginSuccessViaApi : MessageAction.LoginSuccessViaApiSocialAccount; - var token = _cookiesManager.AuthenticateMeAndSetCookies(user.Tenant, user.Id, action); + var token = _cookiesManager.AuthenticateMeAndSetCookies(user.Tenant, user.Id, action, session); - var tenant = _tenantManager.GetCurrentTenant().Id; - var expires = _tenantCookieSettingsHelper.GetExpiresTime(tenant); - - return new AuthenticationTokenDto + var outDto = new AuthenticationTokenDto { - Token = token, - Expires = new ApiDateTime(_tenantManager, _timeZoneConverter, expires) + Token = token }; + + if (!session) + { + var tenant = _tenantManager.GetCurrentTenant().Id; + var expires = _tenantCookieSettingsHelper.GetExpiresTime(tenant); + + outDto.Expires = new ApiDateTime(_tenantManager, _timeZoneConverter, expires); + } + + return outDto; } catch (Exception ex) { diff --git a/web/ASC.Web.Api/Api/Settings/SettingsController.cs b/web/ASC.Web.Api/Api/Settings/SettingsController.cs index de8fec851a..b91f503809 100644 --- a/web/ASC.Web.Api/Api/Settings/SettingsController.cs +++ b/web/ASC.Web.Api/Api/Settings/SettingsController.cs @@ -136,6 +136,7 @@ public class SettingsController : BaseSettingsController public SettingsDto GetSettings(bool? withpassword) { var studioAdminMessageSettings = _settingsManager.Load(); + var tenantCookieSettings = _settingsManager.Load(); var settings = new SettingsDto { @@ -149,7 +150,8 @@ public class SettingsController : BaseSettingsController TenantStatus = _tenantManager.GetCurrentTenant().Status, TenantAlias = Tenant.Alias, EnableAdmMess = studioAdminMessageSettings.Enable || _tenantExtra.IsNotPaid(), - LegalTerms = _setupInfo.LegalTerms + LegalTerms = _setupInfo.LegalTerms, + CookieSettingsEnabled = tenantCookieSettings.Enabled }; if (_authContext.IsAuthenticated) diff --git a/web/ASC.Web.Api/ApiModels/ResponseDto/SettingsDto.cs b/web/ASC.Web.Api/ApiModels/ResponseDto/SettingsDto.cs index eba3ab3033..8a52d14322 100644 --- a/web/ASC.Web.Api/ApiModels/ResponseDto/SettingsDto.cs +++ b/web/ASC.Web.Api/ApiModels/ResponseDto/SettingsDto.cs @@ -59,6 +59,7 @@ public class SettingsDto public string BookTrainingEmail { get; set; } public string DocumentationEmail { get; set; } public string LegalTerms { get; set; } + public bool CookieSettingsEnabled { get; set; } public PluginsDto Plugins { get; set; }