diff --git a/server/interfaces/api/settingsInterfaces.ts b/server/interfaces/api/settingsInterfaces.ts index a55b71b3a..924023d43 100644 --- a/server/interfaces/api/settingsInterfaces.ts +++ b/server/interfaces/api/settingsInterfaces.ts @@ -22,6 +22,7 @@ export interface SettingsAboutResponse { export interface PublicSettingsResponse { initialized: boolean; applicationTitle: string; + applicationUrl: string; hideAvailable: boolean; localLogin: boolean; movie4kEnabled: boolean; @@ -33,6 +34,7 @@ export interface PublicSettingsResponse { vapidPublic: string; enablePushRegistration: boolean; locale: string; + emailEnabled: boolean; } export interface CacheItem { diff --git a/server/lib/settings.ts b/server/lib/settings.ts index 6c91dabc5..656be8680 100644 --- a/server/lib/settings.ts +++ b/server/lib/settings.ts @@ -98,6 +98,7 @@ interface PublicSettings { interface FullPublicSettings extends PublicSettings { applicationTitle: string; + applicationUrl: string; hideAvailable: boolean; localLogin: boolean; movie4kEnabled: boolean; @@ -109,6 +110,7 @@ interface FullPublicSettings extends PublicSettings { vapidPublic: string; enablePushRegistration: boolean; locale: string; + emailEnabled: boolean; } export interface NotificationAgentConfig { @@ -396,6 +398,7 @@ class Settings { return { ...this.data.public, applicationTitle: this.data.main.applicationTitle, + applicationUrl: this.data.main.applicationUrl, hideAvailable: this.data.main.hideAvailable, localLogin: this.data.main.localLogin, movie4kEnabled: this.data.radarr.some( @@ -411,6 +414,7 @@ class Settings { vapidPublic: this.vapidPublic, enablePushRegistration: this.data.notifications.agents.webpush.enabled, locale: this.data.main.locale, + emailEnabled: this.data.notifications.agents.email.enabled, }; } diff --git a/src/components/Login/LocalLogin.tsx b/src/components/Login/LocalLogin.tsx index 71b815fd1..ece109fe4 100644 --- a/src/components/Login/LocalLogin.tsx +++ b/src/components/Login/LocalLogin.tsx @@ -5,6 +5,7 @@ import Link from 'next/link'; import React, { useState } from 'react'; import { defineMessages, useIntl } from 'react-intl'; import * as Yup from 'yup'; +import useSettings from '../../hooks/useSettings'; import Button from '../Common/Button'; import SensitiveInput from '../Common/SensitiveInput'; @@ -25,6 +26,7 @@ interface LocalLoginProps { const LocalLogin: React.FC = ({ revalidate }) => { const intl = useIntl(); + const settings = useSettings(); const [loginError, setLoginError] = useState(null); const LoginSchema = Yup.object().shape({ @@ -36,6 +38,10 @@ const LocalLogin: React.FC = ({ revalidate }) => { ), }); + const passwordResetEnabled = + settings.currentSettings.applicationUrl && + settings.currentSettings.emailEnabled; + return ( = ({ revalidate }) => { return ( <>
-
+
@@ -101,17 +107,7 @@ const LocalLogin: React.FC = ({ revalidate }) => { )}
-
- - - - - +
+ {passwordResetEnabled && ( + + + + + + )}
diff --git a/src/components/ResetPassword/RequestResetLink.tsx b/src/components/ResetPassword/RequestResetLink.tsx index 0cf20abb7..49fc5afef 100644 --- a/src/components/ResetPassword/RequestResetLink.tsx +++ b/src/components/ResetPassword/RequestResetLink.tsx @@ -94,7 +94,7 @@ const ResetPassword: React.FC = () => { {({ errors, touched, isSubmitting, isValid }) => { return (
-
+