Merge branch 'develop' into bugfix/fix-invite-panel
This commit is contained in:
commit
b78f83969b
@ -92,9 +92,9 @@ public class CommonMethods
|
||||
};
|
||||
}
|
||||
|
||||
public string CreateReference(string requestUriScheme, string tenantDomain, string email, bool first = false, string module = "", bool sms = false)
|
||||
public string CreateReference(int tenantId,string requestUriScheme, string tenantDomain, string email, bool first = false, string module = "", bool sms = false)
|
||||
{
|
||||
var url = _commonLinkUtility.GetConfirmationUrlRelative(email, ConfirmType.Auth, (first ? "true" : "") + module + (sms ? "true" : ""));
|
||||
var url = _commonLinkUtility.GetConfirmationUrlRelative(tenantId, email, ConfirmType.Auth, (first ? "true" : "") + module + (sms ? "true" : ""));
|
||||
return $"{requestUriScheme}{Uri.SchemeDelimiter}{tenantDomain}/{url}{(first ? "&first=true" : "")}{(string.IsNullOrEmpty(module) ? "" : "&module=" + module)}{(sms ? "&sms=true" : "")}";
|
||||
}
|
||||
|
||||
|
@ -309,26 +309,17 @@ public class PortalController : ControllerBase
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
var reference = _commonMethods.CreateReference(t.Id, Request.Scheme, t.GetTenantDomain(_coreSettings), info.Email, isFirst);
|
||||
_log.LogDebug("PortalName = {0}; Elapsed ms. CreateReferenceByCookie...: {1}", model.PortalName, sw.ElapsedMilliseconds);
|
||||
|
||||
sw.Stop();
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
_log.LogDebug("try CreateReference");
|
||||
var reference = _commonMethods.CreateReference(Request.Scheme, t.GetTenantDomain(_coreSettings), info.Email, isFirst);
|
||||
_log.LogDebug("PortalName = {0}; Elapsed ms. CreateReferenceByCookie...: {1}", model.PortalName, sw.ElapsedMilliseconds);
|
||||
|
||||
sw.Stop();
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
reference,
|
||||
tenant = _commonMethods.ToTenantWrapper(t),
|
||||
referenceWelcome = sendCongratulationsAddress
|
||||
});
|
||||
}catch (Exception e)
|
||||
{
|
||||
_log.LogError(e, "CreateReference error");
|
||||
|
||||
return BadRequest(error);
|
||||
}
|
||||
reference,
|
||||
tenant = _commonMethods.ToTenantWrapper(t),
|
||||
referenceWelcome = sendCongratulationsAddress
|
||||
});
|
||||
}
|
||||
|
||||
[HttpDelete("remove")]
|
||||
|
@ -59,6 +59,9 @@ public class PortalController : ControllerBase
|
||||
private readonly MessageService _messageService;
|
||||
private readonly MessageTarget _messageTarget;
|
||||
private readonly DisplayUserSettingsHelper _displayUserSettingsHelper;
|
||||
private readonly EmailValidationKeyProvider _emailValidationKeyProvider;
|
||||
private readonly StudioSmsNotificationSettingsHelper _studioSmsNotificationSettingsHelper;
|
||||
private readonly TfaAppAuthSettingsHelper _tfaAppAuthSettingsHelper;
|
||||
|
||||
public PortalController(
|
||||
ILogger<PortalController> logger,
|
||||
@ -86,8 +89,9 @@ public class PortalController : ControllerBase
|
||||
StudioNotifyService studioNotifyService,
|
||||
MessageService messageService,
|
||||
MessageTarget messageTarget,
|
||||
DisplayUserSettingsHelper displayUserSettingsHelper
|
||||
)
|
||||
DisplayUserSettingsHelper displayUserSettingsHelper,
|
||||
EmailValidationKeyProvider emailValidationKeyProvider,
|
||||
StudioSmsNotificationSettingsHelper studioSmsNotificationSettingsHelper, TfaAppAuthSettingsHelper tfaAppAuthSettingsHelper)
|
||||
{
|
||||
_log = logger;
|
||||
_apiContext = apiContext;
|
||||
@ -115,6 +119,9 @@ public class PortalController : ControllerBase
|
||||
_messageService = messageService;
|
||||
_messageTarget = messageTarget;
|
||||
_displayUserSettingsHelper = displayUserSettingsHelper;
|
||||
_emailValidationKeyProvider = emailValidationKeyProvider;
|
||||
_studioSmsNotificationSettingsHelper = studioSmsNotificationSettingsHelper;
|
||||
_tfaAppAuthSettingsHelper = tfaAppAuthSettingsHelper;
|
||||
}
|
||||
|
||||
[HttpGet("")]
|
||||
@ -484,5 +491,37 @@ public class PortalController : ControllerBase
|
||||
_studioNotifyService.SendMsgPortalDeletionSuccess(owner, redirectLink);
|
||||
|
||||
return redirectLink;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost("sendcongratulations")]
|
||||
public void SendCongratulations([FromQuery] SendCongratulationsDto inDto)
|
||||
{
|
||||
var authInterval = TimeSpan.FromHours(1);
|
||||
var checkKeyResult = _emailValidationKeyProvider.ValidateEmailKey(inDto.Userid.ToString() + ConfirmType.Auth, inDto.Key, authInterval);
|
||||
|
||||
switch (checkKeyResult)
|
||||
{
|
||||
case ValidationResult.Ok:
|
||||
var currentUser = _userManager.GetUsers(inDto.Userid);
|
||||
|
||||
_studioNotifyService.SendCongratulations(currentUser);
|
||||
_studioNotifyService.SendRegData(currentUser);
|
||||
|
||||
if (!SetupInfo.IsSecretEmail(currentUser.Email))
|
||||
{
|
||||
if (_setupInfo.TfaRegistration == "sms")
|
||||
{
|
||||
_studioSmsNotificationSettingsHelper.Enable = true;
|
||||
}
|
||||
else if (_setupInfo.TfaRegistration == "code")
|
||||
{
|
||||
_tfaAppAuthSettingsHelper.Enable = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new SecurityException("Access Denied.");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
// (c) Copyright Ascensio System SIA 2010-2022
|
||||
//
|
||||
// This program is a free software product.
|
||||
// You can redistribute it and/or modify it under the terms
|
||||
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||
// any third-party rights.
|
||||
//
|
||||
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
//
|
||||
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||
//
|
||||
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||
//
|
||||
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||
// trademark law for use of our trademarks.
|
||||
//
|
||||
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
|
||||
namespace ASC.Web.Api.ApiModels.RequestsDto;
|
||||
|
||||
public class SendCongratulationsDto
|
||||
{
|
||||
public Guid Userid { get; set; }
|
||||
public string Key { get; set; }
|
||||
}
|
Loading…
Reference in New Issue
Block a user