From ef0e3d649f8e2301c92663db68663508478c47ad Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Fri, 22 Apr 2022 14:59:08 +0200 Subject: [PATCH] Allow admins to disable 2fa for other users without code (#12290) * add functionality to allow admins to disable 2fa for other users * add new translations --- .../configuretwofactor.controller.js | 52 ++- .../twofactor/configuretwofactor.html | 10 +- src/Umbraco.Web.UI/umbraco/config/lang/da.xml | 2 + src/Umbraco.Web.UI/umbraco/config/lang/en.xml | 412 +++++++++--------- .../umbraco/config/lang/en_us.xml | 2 + 5 files changed, 254 insertions(+), 224 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/twofactor/configuretwofactor.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/twofactor/configuretwofactor.controller.js index 382d9ef35e..d1175e7e7f 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/twofactor/configuretwofactor.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/twofactor/configuretwofactor.controller.js @@ -54,19 +54,49 @@ angular.module("umbraco").controller("Umbraco.Editors.ConfigureTwoFactorControll } function disable(provider) { + if ($scope.model.isCurrentUser) { + const disableTwoFactorSettings = { + provider, + user: vm.user, + size: "small", + view: "views/common/infiniteeditors/twofactor/disabletwofactor.html", + close: function () { + editorService.close(); + onInit(); + } + }; - const disableTwoFactorSettings = { - provider, - user: vm.user, - size: "small", - view: "views/common/infiniteeditors/twofactor/disabletwofactor.html", - close: function () { - editorService.close(); - onInit(); - } - }; + editorService.open(disableTwoFactorSettings); + } else { + localizationService.localize("user_2faDisableForUser").then(function (value) { + const removeOverlay = { + content: value, + submitButtonLabelKey: 'actions_disable', + submit: function ({ close }) { + twoFactorLoginResource.disable(provider.providerName, $scope.model.user.key) + .then(onResponse) + .catch(onError); - editorService.open(disableTwoFactorSettings); + close(); + } + }; + + overlayService.confirmRemove(removeOverlay); + }); + } + } + + function onResponse(response) { + if (response) { + localizationService.localize("user_2faProviderIsDisabledMsg").then(function (value) { + notificationsService.info(value); + }); + onInit(); + } else { + localizationService.localize("user_2faProviderIsNotDisabledMsg").then(function (value) { + notificationsService.error(value); + }); + } } function onError(error) { diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/twofactor/configuretwofactor.html b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/twofactor/configuretwofactor.html index 15bb70b7f9..cc25439bb9 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/twofactor/configuretwofactor.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/twofactor/configuretwofactor.html @@ -21,15 +21,9 @@

- + - -
- - -
Hvis du ønsker at slå denne autentificeringsmetode fra, så skal du nu indtaste koden fra dit device: Denne autentificeringsmetode er slået til Den valgte autentificeringsmetode er nu slået fra + Der skete en ukendt fejl da denne autentificeringsmetode skulles slåes fra + Er du sikker på, at du vil fjerne denne autentificeringsmetode for denne bruger? Validering diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index 6670f692b8..3d11fb8fc8 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -577,11 +577,11 @@ %0%' below - ]]> + ]]> Culture Name + ]]> Dictionary overview @@ -932,7 +932,7 @@

Don't worry - no content will be deleted and everything will continue working afterwards!

- ]]> + ]]> Press Next to proceed. ]]> @@ -978,19 +978,19 @@ + ]]> I want to start from scratch learn how) You can still choose to install Runway later on. Please go to the Developer section and choose Packages. - ]]> + ]]> You've just set up a clean Umbraco platform. What do you want to do next? Runway is installed This is our list of recommended modules, check off the ones you would like to install, or view the full list of modules - ]]> + ]]> Only recommended for experienced users I want to start with a simple website Included with Runway: Home page, Getting Started page, Installing Modules page.
Optional Modules: Top Navigation, Sitemap, Contact, Gallery. - ]]>
+ ]]> What is Runway Step 1/5 Accept license Step 2/5: Database configuration @@ -1081,72 +1081,72 @@ To manage your website, simply open the Umbraco backoffice and start adding cont -
- - - - - - - - - - - - + +
-
-
- - - + +
- - - + + +
-

+
+ +

+
+ + + + + + +
+
+

+

If you cannot click on the link, copy and paste this URL into your browser window:

+ + + + +
+ +%1% + +
+

+
+ + + +


+ + + + + + + + ]]> Umbraco: Security Code Your security code is: %0% One last step @@ -1193,7 +1193,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Have a nice day! Cheers from the Umbraco robot - ]]> + ]]> The following languages have been modified %0% @@ -1210,70 +1210,70 @@ To manage your website, simply open the Umbraco backoffice and start adding cont -
- - - - - - - - - - - - + +
-
-
- - - + +
- - - + + +
-

+
+ +

+
+ + + + - - -
+
+
+ + + - -
+ + + - -
+

Hi %0%,

-

+

This is an automated mail to inform you that the task '%1%' has been performed on the page '%2%' by the user '%3%' -

- - - - - - -
- -
- EDIT
-
-

-

Update summary:

+

+ + + + + + +
+ +
+EDIT
+
+

+

Update summary:

%6%

-

+

Have a nice day!

Cheers from the Umbraco robot

-
-
-


-
-
- - - ]]> +
+ + + +


+ + + + + + + + ]]>
The following languages have been modified:

%0% - ]]>
+ ]]> [%0%] Notification about %1% performed on %2% Notifications @@ -1284,7 +1284,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont button and locating the package. Umbraco packages usually have a ".umb" or ".zip" extension. - ]]> + ]]> This will delete the package Include all child nodes Installed @@ -1373,19 +1373,19 @@ To manage your website, simply open the Umbraco backoffice and start adding cont + ]]> + ]]> + ]]> + ]]> + ]]> Include unpublished subpages @@ -1396,7 +1396,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Publish %0% and all its subpages Publish to publish %0% and thereby making its content publicly available.

You can publish this page and all its subpages by checking Include unpublished subpages below. - ]]>
+ ]]> You have not configured any approved colours @@ -1480,7 +1480,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Visit our.umbraco.com Visit umbraco.tv Watch our free tutorial videos - on the Umbraco Learning Base + on the Umbraco Learning Base Default template @@ -1520,7 +1520,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Insufficient user permissions, could not complete the operation Cancelled Operation was cancelled by a 3rd party add-in - This file is being uploaded as part of a folder, but creating a new folder is not allowed here + This file is being uploaded as part of a folder, but creating a new folder is not allowed here Creating a new folder is not allowed here Publishing was cancelled by a 3rd party add-in Property type already exists @@ -1653,23 +1653,23 @@ To manage your website, simply open the Umbraco backoffice and start adding cont @RenderBody() placeholder. - ]]> + ]]> Define a named section @section { ... }. This can be rendered in a specific area of the parent of this template, by using @RenderSection. - ]]> + ]]> Render a named section @RenderSection(name) placeholder. This renders an area of a child template which is wrapped in a corresponding @section [name]{ ... } definition. - ]]> + ]]> Section Name Section is mandatory @section definition, otherwise an error is shown. - ]]> + ]]> Query builder items returned, in I want @@ -1945,7 +1945,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Have a nice day! Cheers from the Umbraco robot - ]]> + ]]> No translator users found. Please create a translator user before you start sending content to translation @@ -2134,82 +2134,82 @@ To manage your website, simply open the Umbraco backoffice and start adding cont -
- - - - - - - - - - - - + +
-
-
- - - + +
- - - + + +
-

+
+ +

+
+ + + + + + +
+
+

If you cannot click on the link, copy and paste this URL into your browser window:

+ + + + +
+ +%3% + +
+

+
+ + + +


+ + + + + + +]]> Resending invitation... Delete User Are you sure you wish to delete this user account? @@ -2228,6 +2228,8 @@ To manage your website, simply open the Umbraco backoffice and start adding cont If you wish to disable this two-factor provider, then you must enter the code shown on your authentication device: This two-factor provider is enabled This two-factor provider is now disabled + Something went wrong with trying to disable this two-factor provider + Do you want to disable this two-factor provider for this user? Validation diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index bc8f38d408..dcbe9224d9 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -2304,6 +2304,8 @@ To manage your website, simply open the Umbraco backoffice and start adding cont If you wish to disable this two-factor provider, then you must enter the code shown on your authentication device: This two-factor provider is enabled This two-factor provider is now disabled + Something went wrong with trying to disable this two-factor provider + Do you want to disable this two-factor provider for this user? Validation