diff --git a/server/entity/User.ts b/server/entity/User.ts index 75b55776f..50ede81df 100644 --- a/server/entity/User.ts +++ b/server/entity/User.ts @@ -134,7 +134,7 @@ export class User { const password = generatePassword.randomPassword({ length: 16 }); this.setPassword(password); - const applicationUrl = getSettings().main.applicationUrl; + const { applicationTitle, applicationUrl } = getSettings().main; try { logger.info(`Sending generated password email for ${this.email}`, { label: 'User Management', @@ -148,6 +148,7 @@ export class User { locals: { password: password, applicationUrl, + applicationTitle, }, }); } catch (e) { @@ -167,7 +168,7 @@ export class User { targetDate.setDate(targetDate.getDate() + 1); this.recoveryLinkExpirationDate = targetDate; - const applicationUrl = getSettings().main.applicationUrl; + const { applicationTitle, applicationUrl } = getSettings().main; const resetPasswordLink = `${applicationUrl}/resetpassword/${guid}`; try { @@ -183,6 +184,7 @@ export class User { locals: { resetPasswordLink, applicationUrl: resetPasswordLink, + applicationTitle, }, }); } catch (e) { diff --git a/src/components/UserProfile/UserSettings/UserPasswordChange/index.tsx b/src/components/UserProfile/UserSettings/UserPasswordChange/index.tsx index d2b4a3ff8..cc973aa0d 100644 --- a/src/components/UserProfile/UserSettings/UserPasswordChange/index.tsx +++ b/src/components/UserProfile/UserSettings/UserPasswordChange/index.tsx @@ -11,6 +11,7 @@ import Alert from '../../../Common/Alert'; import Button from '../../../Common/Button'; import LoadingSpinner from '../../../Common/LoadingSpinner'; import * as Yup from 'yup'; +import useSettings from '../../../../hooks/useSettings'; const messages = defineMessages({ password: 'Password', @@ -30,10 +31,12 @@ const messages = defineMessages({ validationConfirmPasswordSame: 'Password must match', nopasswordset: 'No Password Set', nopasswordsetDescription: - 'This user account currently does not have an Overseerr-specific password. Configure a password below to allow this account to sign-in as a "local user."', + 'This user account currently does not have a password specifically for {applicationTitle}.\ + Configure a password below to enable this account to sign in as a "local user."', }); const UserPasswordChange: React.FC = () => { + const settings = useSettings(); const intl = useIntl(); const { addToast } = useToasts(); const router = useRouter(); @@ -114,7 +117,9 @@ const UserPasswordChange: React.FC = () => { type="warning" title={intl.formatMessage(messages.nopasswordset)} > - {intl.formatMessage(messages.nopasswordsetDescription)} + {intl.formatMessage(messages.nopasswordsetDescription, { + applicationTitle: settings.currentSettings.applicationTitle, + })} )} {data.hasPassword && user?.id === currentUser?.id && ( diff --git a/src/components/UserProfile/UserSettings/index.tsx b/src/components/UserProfile/UserSettings/index.tsx index 61b03b686..9e18457b7 100644 --- a/src/components/UserProfile/UserSettings/index.tsx +++ b/src/components/UserProfile/UserSettings/index.tsx @@ -7,6 +7,7 @@ import Error from '../../../pages/_error'; import LoadingSpinner from '../../Common/LoadingSpinner'; import PageTitle from '../../Common/PageTitle'; import ProfileHeader from '../ProfileHeader'; +import useSettings from '../../../hooks/useSettings'; const messages = defineMessages({ settings: 'User Settings', @@ -26,6 +27,7 @@ interface SettingsRoute { const UserSettings: React.FC = ({ children }) => { const router = useRouter(); + const settings = useSettings(); const { hasPermission } = useUser(); const { user, error } = useUser({ id: Number(router.query.userId) }); const intl = useIntl(); @@ -73,6 +75,14 @@ const UserSettings: React.FC = ({ children }) => { regex: RegExp; isMobile?: boolean; }> = ({ children, route, regex, isMobile = false }) => { + if ( + route === '/settings/password' && + !settings.currentSettings.localLogin && + !hasPermission(Permission.MANAGE_SETTINGS) + ) { + return null; + } + const finalRoute = router.asPath.includes('/profile') ? `/profile${route}` : `/users/${user.id}${route}`; diff --git a/src/i18n/locale/en.json b/src/i18n/locale/en.json index aea78bc36..67185fae8 100644 --- a/src/i18n/locale/en.json +++ b/src/i18n/locale/en.json @@ -647,7 +647,7 @@ "components.UserList.role": "Role", "components.UserList.save": "Save Changes", "components.UserList.saving": "Saving…", - "components.UserList.showingResults": "Showing {from} to {to} of {total} results", + "components.UserList.showingresults": "Showing {from} to {to} of {total} results", "components.UserList.sortCreated": "Creation Date", "components.UserList.sortDisplayName": "Display Name", "components.UserList.sortRequests": "Request Count", @@ -690,7 +690,7 @@ "components.UserProfile.UserSettings.UserPasswordChange.currentpassword": "Current Password", "components.UserProfile.UserSettings.UserPasswordChange.newpassword": "New Password", "components.UserProfile.UserSettings.UserPasswordChange.nopasswordset": "No Password Set", - "components.UserProfile.UserSettings.UserPasswordChange.nopasswordsetDescription": "This user account currently does not have an Overseerr-specific password. Configure a password below to allow this account to sign-in as a \"local user.\"", + "components.UserProfile.UserSettings.UserPasswordChange.nopasswordsetDescription": "This user account currently does not have a password specifically for {applicationTitle}. Configure a password below to enable this account to sign in as a \"local user.\"", "components.UserProfile.UserSettings.UserPasswordChange.password": "Password", "components.UserProfile.UserSettings.UserPasswordChange.save": "Save Changes", "components.UserProfile.UserSettings.UserPasswordChange.saving": "Saving…",