From d96a2134f343c3195683cf9efa62559252a64c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Thu, 9 Mar 2023 13:13:40 +0000 Subject: [PATCH] fix: hide change password when simple auth is disabled (#3282) https://linear.app/unleash/issue/2-764/change-password-should-be-disabled-when-password-login-is-disabled Hides "Change password" option on the profile page when "Password based login" is disabled. ![image](https://user-images.githubusercontent.com/14320932/224018081-d866a17f-97a4-4e6e-8057-2f60a20e3d52.png) --- frontend/src/component/user/Profile/Profile.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/component/user/Profile/Profile.tsx b/frontend/src/component/user/Profile/Profile.tsx index 14675dec53..94748642d3 100644 --- a/frontend/src/component/user/Profile/Profile.tsx +++ b/frontend/src/component/user/Profile/Profile.tsx @@ -1,6 +1,7 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { ITab, VerticalTabs } from 'component/common/VerticalTabs/VerticalTabs'; import { useAuthUser } from 'hooks/api/getters/useAuth/useAuthUser'; +import useAuthSettings from 'hooks/api/getters/useAuthSettings/useAuthSettings'; import { useEffect, useState } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; import { PasswordTab } from './PasswordTab/PasswordTab'; @@ -11,10 +12,16 @@ export const Profile = () => { const { user } = useAuthUser(); const location = useLocation(); const navigate = useNavigate(); + const { config: simpleAuthConfig } = useAuthSettings('simple'); const tabs = [ { id: 'profile', label: 'Profile' }, - { id: 'password', label: 'Change password', path: 'change-password' }, + { + id: 'password', + label: 'Change password', + path: 'change-password', + hidden: simpleAuthConfig.disabled, + }, { id: 'pat', label: 'Personal API tokens',