Thirdparty: Fix Token can't be null on WebDav (login/password issue)

This commit is contained in:
Alexey Safronov 2021-04-30 13:42:57 +03:00
parent ca819a930c
commit 56997c5cb8
2 changed files with 20 additions and 8 deletions

View File

@ -1225,7 +1225,7 @@ namespace ASC.Web.Files.Services.WCFService
} }
catch (Exception e) catch (Exception e)
{ {
throw GenerateException(e); throw GenerateException(e.InnerException ?? e);
} }
} }
else else

View File

@ -367,7 +367,9 @@ namespace ASC.Files.Thirdparty
{ {
Id = id, Id = id,
Title = customerTitle, Title = customerTitle,
Token = EncryptPassword(authData.Token), Token = EncryptPassword(authData.Token),
Url = authData.Url,
UserName = authData.Login,
Password = EncryptPassword(authData.Password), Password = EncryptPassword(authData.Password),
UserId = owner, UserId = owner,
FolderType = type, FolderType = type,
@ -390,10 +392,11 @@ namespace ASC.Files.Thirdparty
var createOn = TenantUtil.DateTimeFromUtc(input.CreateOn); var createOn = TenantUtil.DateTimeFromUtc(input.CreateOn);
var authData = new AuthData(input.Url, input.UserName, DecryptPassword(input.Password), token); var authData = new AuthData(input.Url, input.UserName, DecryptPassword(input.Password), token);
if (string.IsNullOrEmpty(token)) throw new ArgumentException("Token can't be null");
if (key == ProviderTypes.Box) if (key == ProviderTypes.Box)
{ {
if (string.IsNullOrEmpty(token))
throw new ArgumentException("Token can't be null");
var box = ServiceProvider.GetService<BoxProviderInfo>(); var box = ServiceProvider.GetService<BoxProviderInfo>();
box.ID = id; box.ID = id;
box.CustomerTitle = providerTitle; box.CustomerTitle = providerTitle;
@ -406,7 +409,10 @@ namespace ASC.Files.Thirdparty
} }
if (key == ProviderTypes.DropboxV2) if (key == ProviderTypes.DropboxV2)
{ {
if (string.IsNullOrEmpty(token))
throw new ArgumentException("Token can't be null");
var drop = ServiceProvider.GetService<DropboxProviderInfo>(); var drop = ServiceProvider.GetService<DropboxProviderInfo>();
drop.ID = id; drop.ID = id;
drop.CustomerTitle = providerTitle; drop.CustomerTitle = providerTitle;
@ -436,7 +442,10 @@ namespace ASC.Files.Thirdparty
} }
if (key == ProviderTypes.GoogleDrive) if (key == ProviderTypes.GoogleDrive)
{ {
if (string.IsNullOrEmpty(token))
throw new ArgumentException("Token can't be null");
var gd = ServiceProvider.GetService<GoogleDriveProviderInfo>(); var gd = ServiceProvider.GetService<GoogleDriveProviderInfo>();
gd.ID = id; gd.ID = id;
gd.CustomerTitle = providerTitle; gd.CustomerTitle = providerTitle;
@ -450,7 +459,10 @@ namespace ASC.Files.Thirdparty
} }
if (key == ProviderTypes.OneDrive) if (key == ProviderTypes.OneDrive)
{ {
if (string.IsNullOrEmpty(token))
throw new ArgumentException("Token can't be null");
var od = ServiceProvider.GetService<OneDriveProviderInfo>(); var od = ServiceProvider.GetService<OneDriveProviderInfo>();
od.ID = id; od.ID = id;
od.CustomerTitle = providerTitle; od.CustomerTitle = providerTitle;