From 60ca0db26f3c515cdad745d5705a16b82c704e53 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 28 Aug 2023 22:31:12 +0300 Subject: [PATCH] Improve messaging in Authentication Required modal Co-authored-by: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> --- .../AuthenticationRequiredModalContent.js | 92 +++++++++---------- .../src/Settings/General/SecuritySettings.js | 72 ++++++++++++--- src/NzbDrone.Core/Localization/Core/en.json | 15 ++- 3 files changed, 113 insertions(+), 66 deletions(-) diff --git a/frontend/src/FirstRun/AuthenticationRequiredModalContent.js b/frontend/src/FirstRun/AuthenticationRequiredModalContent.js index 920c59a31..2c881d75a 100644 --- a/frontend/src/FirstRun/AuthenticationRequiredModalContent.js +++ b/frontend/src/FirstRun/AuthenticationRequiredModalContent.js @@ -11,7 +11,7 @@ import ModalContent from 'Components/Modal/ModalContent'; import ModalFooter from 'Components/Modal/ModalFooter'; import ModalHeader from 'Components/Modal/ModalHeader'; import { inputTypes, kinds } from 'Helpers/Props'; -import { authenticationMethodOptions, authenticationRequiredOptions, authenticationRequiredWarning } from 'Settings/General/SecuritySettings'; +import { authenticationMethodOptions, authenticationRequiredOptions } from 'Settings/General/SecuritySettings'; import translate from 'Utilities/String/translate'; import styles from './AuthenticationRequiredModalContent.css'; @@ -63,71 +63,63 @@ function AuthenticationRequiredModalContent(props) { className={styles.authRequiredAlert} kind={kinds.WARNING} > - {authenticationRequiredWarning} + {translate('AuthenticationRequiredWarning', { appName: 'Prowlarr' })} { isPopulated && !error ?
- {translate('Authentication')} + {translate('AuthenticationMethod')} - { - authenticationEnabled ? - - {translate('AuthenticationRequired')} - - - : - null - } - - { - authenticationEnabled ? - - {translate('Username')} - - - : - null - } - - { - authenticationEnabled ? - - {translate('Password')} - - - : - null - } + + {translate('AuthenticationRequired')} + + + + + + {translate('Username')} + + + + + + {translate('Password')} + + +
: null } diff --git a/frontend/src/Settings/General/SecuritySettings.js b/frontend/src/Settings/General/SecuritySettings.js index 4b382800c..a7d64bdc0 100644 --- a/frontend/src/Settings/General/SecuritySettings.js +++ b/frontend/src/Settings/General/SecuritySettings.js @@ -11,24 +11,69 @@ import ConfirmModal from 'Components/Modal/ConfirmModal'; import { icons, inputTypes, kinds } from 'Helpers/Props'; import translate from 'Utilities/String/translate'; -export const authenticationRequiredWarning = translate('AuthenticationRequiredWarning'); - export const authenticationMethodOptions = [ - { key: 'none', value: 'None', isDisabled: true }, - { key: 'external', value: 'External', isHidden: true }, - { key: 'basic', value: 'Basic (Browser Popup)' }, - { key: 'forms', value: 'Forms (Login Page)' } + { + key: 'none', + get value() { + return translate('None'); + }, + isDisabled: true + }, + { + key: 'external', + get value() { + return translate('External'); + }, + isHidden: true + }, + { + key: 'basic', + get value() { + return translate('AuthBasic'); + } + }, + { + key: 'forms', + get value() { + return translate('AuthForm'); + } + } ]; export const authenticationRequiredOptions = [ - { key: 'enabled', value: 'Enabled' }, - { key: 'disabledForLocalAddresses', value: 'Disabled for Local Addresses' } + { + key: 'enabled', + get value() { + return translate('Enabled'); + } + }, + { + key: 'disabledForLocalAddresses', + get value() { + return translate('DisabledForLocalAddresses'); + } + } ]; const certificateValidationOptions = [ - { key: 'enabled', value: 'Enabled' }, - { key: 'disabledForLocalAddresses', value: 'Disabled for Local Addresses' }, - { key: 'disabled', value: 'Disabled' } + { + key: 'enabled', + get value() { + return translate('Enabled'); + } + }, + { + key: 'disabledForLocalAddresses', + get value() { + return translate('DisabledForLocalAddresses'); + } + }, + { + key: 'disabled', + get value() { + return translate('Disabled'); + } + } ]; class SecuritySettings extends Component { @@ -95,7 +140,7 @@ class SecuritySettings extends Component { name="authenticationMethod" values={authenticationMethodOptions} helpText={translate('AuthenticationMethodHelpText')} - helpTextWarning={authenticationRequiredWarning} + helpTextWarning={translate('AuthenticationRequiredWarning', { appName: 'Prowlarr' })} onChange={onInputChange} {...authenticationMethod} /> @@ -155,6 +200,7 @@ class SecuritySettings extends Component { type={inputTypes.TEXT} name="apiKey" readOnly={true} + helpTextWarning={translate('RestartRequiredHelpTextWarning')} buttons={[