mirror of
https://github.com/sct/overseerr.git
synced 2025-12-26 00:16:16 +01:00
fix(ui/notif): Custom application title in password-related emails and UI messages (#979)
This commit is contained in:
@@ -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,
|
||||
})}
|
||||
</Alert>
|
||||
)}
|
||||
{data.hasPassword && user?.id === currentUser?.id && (
|
||||
|
||||
@@ -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}`;
|
||||
|
||||
Reference in New Issue
Block a user