From f8094bbdb6fb17aba91e3d33ebd5b70879699bf0 Mon Sep 17 00:00:00 2001 From: Jessica Lawshe <5312836+lawshe@users.noreply.github.com> Date: Mon, 19 Feb 2024 09:35:55 -0600 Subject: [PATCH] Merge pull request #17060 from overleaf/jel-password-linked-group-sso [web] Prevent updating password for managed users linked to group SSO GitOrigin-RevId: f40bba47575cfac1b1e42d3138112c0db4f7865c --- services/web/app/src/router.js | 1 + .../web/frontend/extracted-translations.json | 1 + .../settings/components/password-section.tsx | 22 +++++++++++++++++-- services/web/locales/en.json | 1 + .../components/password-section.test.tsx | 11 ++++++++++ 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/services/web/app/src/router.js b/services/web/app/src/router.js index ebc7585cf7..315281e41a 100644 --- a/services/web/app/src/router.js +++ b/services/web/app/src/router.js @@ -290,6 +290,7 @@ function initialize(webRouter, privateApiRouter, publicApiRouter) { '/user/password/update', AuthenticationController.requireLogin(), RateLimiterMiddleware.rateLimit(rateLimiters.changePassword), + PermissionsController.requirePermission('change-password'), UserController.changePassword ) webRouter.get( diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 8410d3660c..4c55cee28d 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -1536,6 +1536,7 @@ "you_are_on_x_plan_as_member_of_group_subscription_y_administered_by_z": "", "you_can_now_enable_sso": "", "you_can_now_log_in_sso": "", + "you_cant_add_or_change_password_due_to_sso": "", "you_dont_have_any_repositories": "", "you_have_added_x_of_group_size_y": "", "you_have_been_invited_to_transfer_management_of_your_account": "", diff --git a/services/web/frontend/js/features/settings/components/password-section.tsx b/services/web/frontend/js/features/settings/components/password-section.tsx index 59427088b2..c1f0552210 100644 --- a/services/web/frontend/js/features/settings/components/password-section.tsx +++ b/services/web/frontend/js/features/settings/components/password-section.tsx @@ -25,15 +25,33 @@ type PasswordUpdateResult = { function PasswordSection() { const { t } = useTranslation() - + const hideChangePassword = getMeta('ol-cannot-change-password') as boolean return ( <>
+