From c4f9d66ef56d27694627d3d4a0405711c27f9965 Mon Sep 17 00:00:00 2001 From: Filip Kuksov Date: Thu, 18 Feb 2021 21:10:21 +0200 Subject: [PATCH 01/70] 3.46.0 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 23d2d2064f2..8e7bd58336f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,7 +9,7 @@ - 3.45.0 + 3.46.0 $(VersionSuffix)-$(BuildNumber) $(NoWarn);S3875 From 8a134c61988e2d0fff898aac2a81cc3a2afb8e53 Mon Sep 17 00:00:00 2001 From: Egis Date: Wed, 24 Feb 2021 09:47:19 +0200 Subject: [PATCH 02/70] VP-7047: Add colSpan support to va-metaform; (#2163) * VP-7047: Add colSpan support to va-metaform * VP-7047: Add disabled and custom placeholder support to va-generic-value-input * VP-7047: Enable va-metaform styling Co-authored-by: Filipp Kuksov <47894313+Vectorfield4@users.noreply.github.com> --- .../directives/genericValueInput.tpl.html | 50 +++++---- .../wwwroot/js/common/directives/metaform.js | 105 +++++++++--------- .../js/common/directives/metaform.tpl.html | 11 +- 3 files changed, 91 insertions(+), 75 deletions(-) diff --git a/src/VirtoCommerce.Platform.Web/wwwroot/js/common/directives/genericValueInput.tpl.html b/src/VirtoCommerce.Platform.Web/wwwroot/js/common/directives/genericValueInput.tpl.html index 82ef26e84c3..4eb31c87faa 100644 --- a/src/VirtoCommerce.Platform.Web/wwwroot/js/common/directives/genericValueInput.tpl.html +++ b/src/VirtoCommerce.Platform.Web/wwwroot/js/common/directives/genericValueInput.tpl.html @@ -2,16 +2,18 @@
+ placeholder="{{currentEntity.placeholder || 'platform.genericValueInput.placeholders.short-text' | translate}}">
@@ -19,30 +21,34 @@
+ type="password" placeholder="{{currentEntity.placeholder || 'platform.genericValueInput.placeholders.secure-string' | translate}}">
- \ No newline at end of file + From b1bfa8204c1c0762b6f189e57591ec32595e1b3b Mon Sep 17 00:00:00 2001 From: Filip Kuksov Date: Wed, 24 Feb 2021 14:15:33 +0200 Subject: [PATCH 03/70] 3.47.0 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 8e7bd58336f..479eb92952c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,7 +9,7 @@
- 3.46.0 + 3.47.0 $(VersionSuffix)-$(BuildNumber) $(NoWarn);S3875 From 6db0c5775e5c668d3be9bd20ec6337e3374e9a73 Mon Sep 17 00:00:00 2001 From: alexandr andreev Date: Wed, 24 Feb 2021 16:16:54 +0300 Subject: [PATCH 04/70] Fix wrong enabling SAVE button (#2165) Co-authored-by: Filipp Kuksov <47894313+Vectorfield4@users.noreply.github.com> --- .../js/app/dynamicProperties/blades/propertyValue-list.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/VirtoCommerce.Platform.Web/wwwroot/js/app/dynamicProperties/blades/propertyValue-list.js b/src/VirtoCommerce.Platform.Web/wwwroot/js/app/dynamicProperties/blades/propertyValue-list.js index da45eef7731..a95cf051c65 100644 --- a/src/VirtoCommerce.Platform.Web/wwwroot/js/app/dynamicProperties/blades/propertyValue-list.js +++ b/src/VirtoCommerce.Platform.Web/wwwroot/js/app/dynamicProperties/blades/propertyValue-list.js @@ -13,9 +13,10 @@ angular.module('platformWebApp') dynamicPropertiesApi.search({objectType: blade.currentEntity.objectType, take: blade.dynamicPropertyCount}, function (response) { var rawProperties = response.results; + var dynamicProperties = angular.copy(blade.currentEntity.dynamicProperties); _.each(response.results, function(prop) { prop.values = []; - var filteredProperty = _.find(blade.currentEntity.dynamicProperties, function (o) { return o.name === prop.name; }); + var filteredProperty = _.find(dynamicProperties, function (o) { return o.name === prop.name; }); if (filteredProperty) { prop.values = filteredProperty.values; } From 089cae9ec190567e91b31df4adcd59267a65f012 Mon Sep 17 00:00:00 2001 From: alexandr andreev Date: Thu, 25 Feb 2021 16:26:23 +0300 Subject: [PATCH 05/70] VP-6884: Verified status for an email address on the account blade (#2166) * Add permission for Verify Email switcher * Add Emeil verifivation event * Add switcher to ui and apply permission --- .../PlatformConstants.cs | 5 +++- .../Events/UserVerificationEmailEvent.cs | 14 ++++++++++ .../Controllers/Api/SecurityController.cs | 24 ++++++++++++++++ .../en.VirtoCommerce.Platform.json | 5 +++- .../css/themes/main/sass/modules/_forms.sass | 7 +++++ .../js/app/security/blades/account-detail.js | 11 ++++++++ .../security/blades/account-detail.tpl.html | 28 +++++++++++++++---- .../js/app/security/resources/accounts.js | 3 +- 8 files changed, 88 insertions(+), 9 deletions(-) create mode 100644 src/VirtoCommerce.Platform.Core/Security/Events/UserVerificationEmailEvent.cs diff --git a/src/VirtoCommerce.Platform.Core/PlatformConstants.cs b/src/VirtoCommerce.Platform.Core/PlatformConstants.cs index 84a1103dd65..86f560ef3c7 100644 --- a/src/VirtoCommerce.Platform.Core/PlatformConstants.cs +++ b/src/VirtoCommerce.Platform.Core/PlatformConstants.cs @@ -56,6 +56,7 @@ public static class Permissions SecurityAccess = "platform:security:access", SecurityUpdate = "platform:security:update", SecurityDelete = "platform:security:delete", + SecurityVerifyEmail = "platform:security:verifyEmail", SecurityLoginOnBehalf = "platform:security:loginOnBehalf"; public const string BackgroundJobsManage = "background_jobs:manage"; @@ -66,7 +67,9 @@ public static class Permissions public static string[] AllPermissions { get; } = new[] { ResetCache, AssetAccess, AssetDelete, AssetUpdate, AssetCreate, AssetRead, ModuleQuery, ModuleAccess, ModuleManage, SettingQuery, SettingAccess, SettingUpdate, DynamicPropertiesQuery, DynamicPropertiesCreate, DynamicPropertiesAccess, DynamicPropertiesUpdate, DynamicPropertiesDelete, - SecurityQuery, SecurityCreate, SecurityAccess, SecurityUpdate, SecurityDelete, BackgroundJobsManage, PlatformExportImportAccess, PlatformImport, PlatformExport, SecurityLoginOnBehalf}; + SecurityQuery, SecurityCreate, SecurityAccess, SecurityUpdate, SecurityDelete, BackgroundJobsManage, PlatformExportImportAccess, PlatformImport, PlatformExport, SecurityLoginOnBehalf , + SecurityVerifyEmail + }; } public static class Changes diff --git a/src/VirtoCommerce.Platform.Core/Security/Events/UserVerificationEmailEvent.cs b/src/VirtoCommerce.Platform.Core/Security/Events/UserVerificationEmailEvent.cs new file mode 100644 index 00000000000..4467d5ad409 --- /dev/null +++ b/src/VirtoCommerce.Platform.Core/Security/Events/UserVerificationEmailEvent.cs @@ -0,0 +1,14 @@ +using VirtoCommerce.Platform.Core.Events; + +namespace VirtoCommerce.Platform.Core.Security.Events +{ + public class UserVerificationEmailEvent : DomainEvent + { + public ApplicationUser ApplicationUser { get; set; } + + public UserVerificationEmailEvent(ApplicationUser applicationUser) + { + ApplicationUser = applicationUser; + } + } +} diff --git a/src/VirtoCommerce.Platform.Web/Controllers/Api/SecurityController.cs b/src/VirtoCommerce.Platform.Web/Controllers/Api/SecurityController.cs index 12276fdad0e..6dea457e115 100644 --- a/src/VirtoCommerce.Platform.Web/Controllers/Api/SecurityController.cs +++ b/src/VirtoCommerce.Platform.Web/Controllers/Api/SecurityController.cs @@ -662,6 +662,30 @@ public async Task> DeleteUserApiKeys([FromQuery] stri return Ok(); } + /// + /// Verify user email + /// + /// + [HttpPost] + [Route("users/{userId}/sendVerificationEmail")] + [Authorize(PlatformConstants.Security.Permissions.SecurityVerifyEmail)] + public async Task SendVerificationEmail([FromRoute] string userId) + { + var user = await _userManager.FindByIdAsync(userId); + if (user == null) + { + return BadRequest(IdentityResult.Failed(new IdentityError { Description = "User not found" }).ToSecurityResult()); + } + if (!IsUserEditable(user.UserName)) + { + return BadRequest(IdentityResult.Failed(new IdentityError { Description = "It is forbidden to edit this user." }).ToSecurityResult()); + } + + await _eventPublisher.Publish(new UserVerificationEmailEvent(user)); + + return Ok(); + } + //TODO: Remove later #region Obsolete methods diff --git a/src/VirtoCommerce.Platform.Web/wwwroot/Localizations/en.VirtoCommerce.Platform.json b/src/VirtoCommerce.Platform.Web/wwwroot/Localizations/en.VirtoCommerce.Platform.json index a00a557ec07..ae272159047 100644 --- a/src/VirtoCommerce.Platform.Web/wwwroot/Localizations/en.VirtoCommerce.Platform.json +++ b/src/VirtoCommerce.Platform.Web/wwwroot/Localizations/en.VirtoCommerce.Platform.json @@ -364,7 +364,10 @@ "account-state": "Account state", "account-email": "Email", "locked-state": "Locked state", - "status": "Status" + "status": "Status", + "verified": "Verified", + "resend-link": "Resend link", + "link-sent": "The link was sent" }, "placeholders": { "account-type": "Select ...", diff --git a/src/VirtoCommerce.Platform.Web/wwwroot/css/themes/main/sass/modules/_forms.sass b/src/VirtoCommerce.Platform.Web/wwwroot/css/themes/main/sass/modules/_forms.sass index 5c7107c4efc..dbca163bcab 100644 --- a/src/VirtoCommerce.Platform.Web/wwwroot/css/themes/main/sass/modules/_forms.sass +++ b/src/VirtoCommerce.Platform.Web/wwwroot/css/themes/main/sass/modules/_forms.sass @@ -81,6 +81,13 @@ fieldset + fieldset .__link float: right margin: 4px 0 0 +.form-group .form-line + display: flex + align-items: center +.form-group .form-line .form-line-item-250 + display: inline-block + width: 250px + padding-right: 20px .form-input input, .form-input textarea, .form-input select diff --git a/src/VirtoCommerce.Platform.Web/wwwroot/js/app/security/blades/account-detail.js b/src/VirtoCommerce.Platform.Web/wwwroot/js/app/security/blades/account-detail.js index d35a56e732e..2985e2a3b3b 100644 --- a/src/VirtoCommerce.Platform.Web/wwwroot/js/app/security/blades/account-detail.js +++ b/src/VirtoCommerce.Platform.Web/wwwroot/js/app/security/blades/account-detail.js @@ -4,6 +4,7 @@ angular.module('platformWebApp').controller('platformWebApp.accountDetailControl blade.updatePermission = 'platform:security:update'; blade.accountTypes = []; blade.statuses = []; + blade.isLinkSent = false; blade.refresh = function (parentRefresh) { var entity = parentRefresh ? blade.currentEntity : blade.data; @@ -44,6 +45,16 @@ angular.module('platformWebApp').controller('platformWebApp.accountDetailControl return !angular.equals(blade.currentEntity, blade.origEntity) && blade.hasUpdatePermission(); } + blade.sendLink = function () { + if (!blade.isLinkSent && !blade.isLoading) { + blade.isLoading = true; + accounts.verifyEmail({ userId: blade.currentEntity.id }, null , () => { + blade.isLinkSent = true; + blade.isLoading = false; + }); + } + } + blade.openSettingDictionaryController = function (currentEntityId) { var newBlade = { id: currentEntityId, diff --git a/src/VirtoCommerce.Platform.Web/wwwroot/js/app/security/blades/account-detail.tpl.html b/src/VirtoCommerce.Platform.Web/wwwroot/js/app/security/blades/account-detail.tpl.html index 46182a15aee..fe82021ef67 100644 --- a/src/VirtoCommerce.Platform.Web/wwwroot/js/app/security/blades/account-detail.tpl.html +++ b/src/VirtoCommerce.Platform.Web/wwwroot/js/app/security/blades/account-detail.tpl.html @@ -56,15 +56,31 @@ -