mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix(ui/notif): Custom application title in password-related emails and UI messages (#979)
This commit is contained in:
@@ -134,7 +134,7 @@ export class User {
|
|||||||
const password = generatePassword.randomPassword({ length: 16 });
|
const password = generatePassword.randomPassword({ length: 16 });
|
||||||
this.setPassword(password);
|
this.setPassword(password);
|
||||||
|
|
||||||
const applicationUrl = getSettings().main.applicationUrl;
|
const { applicationTitle, applicationUrl } = getSettings().main;
|
||||||
try {
|
try {
|
||||||
logger.info(`Sending generated password email for ${this.email}`, {
|
logger.info(`Sending generated password email for ${this.email}`, {
|
||||||
label: 'User Management',
|
label: 'User Management',
|
||||||
@@ -148,6 +148,7 @@ export class User {
|
|||||||
locals: {
|
locals: {
|
||||||
password: password,
|
password: password,
|
||||||
applicationUrl,
|
applicationUrl,
|
||||||
|
applicationTitle,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -167,7 +168,7 @@ export class User {
|
|||||||
targetDate.setDate(targetDate.getDate() + 1);
|
targetDate.setDate(targetDate.getDate() + 1);
|
||||||
this.recoveryLinkExpirationDate = targetDate;
|
this.recoveryLinkExpirationDate = targetDate;
|
||||||
|
|
||||||
const applicationUrl = getSettings().main.applicationUrl;
|
const { applicationTitle, applicationUrl } = getSettings().main;
|
||||||
const resetPasswordLink = `${applicationUrl}/resetpassword/${guid}`;
|
const resetPasswordLink = `${applicationUrl}/resetpassword/${guid}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -183,6 +184,7 @@ export class User {
|
|||||||
locals: {
|
locals: {
|
||||||
resetPasswordLink,
|
resetPasswordLink,
|
||||||
applicationUrl: resetPasswordLink,
|
applicationUrl: resetPasswordLink,
|
||||||
|
applicationTitle,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@@ -11,6 +11,7 @@ import Alert from '../../../Common/Alert';
|
|||||||
import Button from '../../../Common/Button';
|
import Button from '../../../Common/Button';
|
||||||
import LoadingSpinner from '../../../Common/LoadingSpinner';
|
import LoadingSpinner from '../../../Common/LoadingSpinner';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
|
import useSettings from '../../../../hooks/useSettings';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
password: 'Password',
|
password: 'Password',
|
||||||
@@ -30,10 +31,12 @@ const messages = defineMessages({
|
|||||||
validationConfirmPasswordSame: 'Password must match',
|
validationConfirmPasswordSame: 'Password must match',
|
||||||
nopasswordset: 'No Password Set',
|
nopasswordset: 'No Password Set',
|
||||||
nopasswordsetDescription:
|
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 UserPasswordChange: React.FC = () => {
|
||||||
|
const settings = useSettings();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const { addToast } = useToasts();
|
const { addToast } = useToasts();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -114,7 +117,9 @@ const UserPasswordChange: React.FC = () => {
|
|||||||
type="warning"
|
type="warning"
|
||||||
title={intl.formatMessage(messages.nopasswordset)}
|
title={intl.formatMessage(messages.nopasswordset)}
|
||||||
>
|
>
|
||||||
{intl.formatMessage(messages.nopasswordsetDescription)}
|
{intl.formatMessage(messages.nopasswordsetDescription, {
|
||||||
|
applicationTitle: settings.currentSettings.applicationTitle,
|
||||||
|
})}
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
{data.hasPassword && user?.id === currentUser?.id && (
|
{data.hasPassword && user?.id === currentUser?.id && (
|
||||||
|
@@ -7,6 +7,7 @@ import Error from '../../../pages/_error';
|
|||||||
import LoadingSpinner from '../../Common/LoadingSpinner';
|
import LoadingSpinner from '../../Common/LoadingSpinner';
|
||||||
import PageTitle from '../../Common/PageTitle';
|
import PageTitle from '../../Common/PageTitle';
|
||||||
import ProfileHeader from '../ProfileHeader';
|
import ProfileHeader from '../ProfileHeader';
|
||||||
|
import useSettings from '../../../hooks/useSettings';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
settings: 'User Settings',
|
settings: 'User Settings',
|
||||||
@@ -26,6 +27,7 @@ interface SettingsRoute {
|
|||||||
|
|
||||||
const UserSettings: React.FC = ({ children }) => {
|
const UserSettings: React.FC = ({ children }) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const settings = useSettings();
|
||||||
const { hasPermission } = useUser();
|
const { hasPermission } = useUser();
|
||||||
const { user, error } = useUser({ id: Number(router.query.userId) });
|
const { user, error } = useUser({ id: Number(router.query.userId) });
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
@@ -73,6 +75,14 @@ const UserSettings: React.FC = ({ children }) => {
|
|||||||
regex: RegExp;
|
regex: RegExp;
|
||||||
isMobile?: boolean;
|
isMobile?: boolean;
|
||||||
}> = ({ children, route, regex, isMobile = false }) => {
|
}> = ({ children, route, regex, isMobile = false }) => {
|
||||||
|
if (
|
||||||
|
route === '/settings/password' &&
|
||||||
|
!settings.currentSettings.localLogin &&
|
||||||
|
!hasPermission(Permission.MANAGE_SETTINGS)
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const finalRoute = router.asPath.includes('/profile')
|
const finalRoute = router.asPath.includes('/profile')
|
||||||
? `/profile${route}`
|
? `/profile${route}`
|
||||||
: `/users/${user.id}${route}`;
|
: `/users/${user.id}${route}`;
|
||||||
|
@@ -647,7 +647,7 @@
|
|||||||
"components.UserList.role": "Role",
|
"components.UserList.role": "Role",
|
||||||
"components.UserList.save": "Save Changes",
|
"components.UserList.save": "Save Changes",
|
||||||
"components.UserList.saving": "Saving…",
|
"components.UserList.saving": "Saving…",
|
||||||
"components.UserList.showingResults": "Showing <strong>{from}</strong> to <strong>{to}</strong> of <strong>{total}</strong> results",
|
"components.UserList.showingresults": "Showing <strong>{from}</strong> to <strong>{to}</strong> of <strong>{total}</strong> results",
|
||||||
"components.UserList.sortCreated": "Creation Date",
|
"components.UserList.sortCreated": "Creation Date",
|
||||||
"components.UserList.sortDisplayName": "Display Name",
|
"components.UserList.sortDisplayName": "Display Name",
|
||||||
"components.UserList.sortRequests": "Request Count",
|
"components.UserList.sortRequests": "Request Count",
|
||||||
@@ -690,7 +690,7 @@
|
|||||||
"components.UserProfile.UserSettings.UserPasswordChange.currentpassword": "Current Password",
|
"components.UserProfile.UserSettings.UserPasswordChange.currentpassword": "Current Password",
|
||||||
"components.UserProfile.UserSettings.UserPasswordChange.newpassword": "New Password",
|
"components.UserProfile.UserSettings.UserPasswordChange.newpassword": "New Password",
|
||||||
"components.UserProfile.UserSettings.UserPasswordChange.nopasswordset": "No Password Set",
|
"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.password": "Password",
|
||||||
"components.UserProfile.UserSettings.UserPasswordChange.save": "Save Changes",
|
"components.UserProfile.UserSettings.UserPasswordChange.save": "Save Changes",
|
||||||
"components.UserProfile.UserSettings.UserPasswordChange.saving": "Saving…",
|
"components.UserProfile.UserSettings.UserPasswordChange.saving": "Saving…",
|
||||||
|
Reference in New Issue
Block a user