From 47afcec1c5ab64b15775916525b93b8992fb8f0c Mon Sep 17 00:00:00 2001 From: Dakota G <13515931+shrunbr@users.noreply.github.com> Date: Sat, 14 Mar 2026 05:34:34 -0500 Subject: [PATCH] [Fix]: Allow SMTP to be configured before Advanced Authentication is enabled (#700) [Fix]: Allow SMTP to be configured before Advanced Authentication is enabled (#700) --- frontend/src/components/EmailSettings.tsx | 17 ++++++++++++----- frontend/src/i18n/locales/de.ts | 1 + frontend/src/i18n/locales/en.ts | 1 + frontend/src/i18n/locales/fr.ts | 1 + frontend/src/i18n/locales/it.ts | 1 + frontend/src/i18n/locales/ja.ts | 1 + frontend/src/i18n/locales/pt-BR.ts | 1 + frontend/src/i18n/locales/zh-CN.ts | 1 + 8 files changed, 19 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/EmailSettings.tsx b/frontend/src/components/EmailSettings.tsx index 6c32f278e..9bc43ade4 100644 --- a/frontend/src/components/EmailSettings.tsx +++ b/frontend/src/components/EmailSettings.tsx @@ -8,6 +8,7 @@ import { Card, CardContent, CardHeader } from './Card'; import { Button } from './Button'; import { useToast } from '../contexts/ToastContext'; import { useEffect } from 'react'; +import { useAuth } from '../contexts/AuthContext'; const SECURITY_PORT_MAP: Record = { starttls: 587, @@ -25,7 +26,7 @@ export function EmailSettings() { const { t } = useTranslation(); const { showToast } = useToast(); const queryClient = useQueryClient(); - + const [smtpSettings, setSMTPSettings] = useState({ smtp_host: '', smtp_port: 587, @@ -44,6 +45,8 @@ export function EmailSettings() { queryFn: () => api.getSMTPSettings(), }); + // Fetch global auth status + const { authEnabled } = useAuth(); // Fetch advanced auth status const { data: advancedAuthStatus } = useQuery({ queryKey: ['advancedAuthStatus'], @@ -163,6 +166,10 @@ export function EmailSettings() { }; const handleToggleAdvancedAuth = () => { + if (!authEnabled) { + showToast(t('settings.email.errors.enableAuthFirst'), 'error'); + return; + } if (!advancedAuthStatus?.advanced_auth_enabled && !advancedAuthStatus?.smtp_configured) { showToast(t('settings.email.errors.configureSmtpFirst'), 'error'); return; @@ -251,8 +258,8 @@ export function EmailSettings() { - {/* SMTP Configuration - dimmed when advanced auth is disabled */} -
+ {/* SMTP Configuration */} +

@@ -399,8 +406,8 @@ export function EmailSettings() {

- {/* Test SMTP - dimmed when advanced auth is disabled */} -
+ {/* Test SMTP */} +

diff --git a/frontend/src/i18n/locales/de.ts b/frontend/src/i18n/locales/de.ts index 1a57d4d40..545beba1f 100644 --- a/frontend/src/i18n/locales/de.ts +++ b/frontend/src/i18n/locales/de.ts @@ -1240,6 +1240,7 @@ export default { smtpServerAndEmail: 'Bitte füllen Sie SMTP-Server und Absender-E-Mail aus, bevor Sie testen', usernamePasswordRequired: 'Benutzername und Passwort sind erforderlich, wenn Authentifizierung aktiviert ist', configureSmtpFirst: 'Bitte konfigurieren und testen Sie zuerst die SMTP-Einstellungen', + enableAuthFirst: 'Bitte aktivieren Sie zuerst die Authentifizierung, um E-Mail-basierte Funktionen nutzen zu können.', }, // Success messages success: { diff --git a/frontend/src/i18n/locales/en.ts b/frontend/src/i18n/locales/en.ts index 6135dfc8a..48ba94a9c 100644 --- a/frontend/src/i18n/locales/en.ts +++ b/frontend/src/i18n/locales/en.ts @@ -1240,6 +1240,7 @@ export default { smtpServerAndEmail: 'Please fill in SMTP Server and From Email before testing', usernamePasswordRequired: 'Username and Password are required when authentication is enabled', configureSmtpFirst: 'Please configure and test SMTP settings first', + enableAuthFirst: 'Please enable authentication first to use email-based features.', }, // Success messages success: { diff --git a/frontend/src/i18n/locales/fr.ts b/frontend/src/i18n/locales/fr.ts index 8cfa7fa65..07a5463c9 100644 --- a/frontend/src/i18n/locales/fr.ts +++ b/frontend/src/i18n/locales/fr.ts @@ -1240,6 +1240,7 @@ export default { smtpServerAndEmail: 'Serveur et expéditeur requis pour le test', usernamePasswordRequired: 'Utilisateur et mot de passe requis pour l\'auth', configureSmtpFirst: 'Configurez et testez le SMTP d\'abord', + enableAuthFirst: 'Veuillez d\'abord activer l\'authentification pour utiliser les fonctionnalités basées sur le courrier électronique.', }, // Success messages success: { diff --git a/frontend/src/i18n/locales/it.ts b/frontend/src/i18n/locales/it.ts index 971e6e154..f06b69e23 100644 --- a/frontend/src/i18n/locales/it.ts +++ b/frontend/src/i18n/locales/it.ts @@ -1240,6 +1240,7 @@ export default { smtpServerAndEmail: 'Compilare Server SMTP e Email mittente prima di testare', usernamePasswordRequired: 'Nome utente e password sono obbligatori quando l\'autenticazione è abilitata', configureSmtpFirst: 'Configurare e testare le impostazioni SMTP prima', + enableAuthFirst: 'Per utilizzare le funzionalità basate sulla posta elettronica, è necessario prima abilitare l\'autenticazione.', }, // Success messages success: { diff --git a/frontend/src/i18n/locales/ja.ts b/frontend/src/i18n/locales/ja.ts index f5a346910..ebb74cc94 100644 --- a/frontend/src/i18n/locales/ja.ts +++ b/frontend/src/i18n/locales/ja.ts @@ -1240,6 +1240,7 @@ export default { smtpServerAndEmail: 'テストする前にSMTPサーバーと送信元メールを入力してください', usernamePasswordRequired: '認証が有効な場合、ユーザー名とパスワードは必須です', configureSmtpFirst: '最初にSMTP設定を構成してテストしてください', + enableAuthFirst: 'メール関連機能をご利用いただくには、まず認証を有効にしてください。', }, // Success messages success: { diff --git a/frontend/src/i18n/locales/pt-BR.ts b/frontend/src/i18n/locales/pt-BR.ts index fb1dff03f..d8daf3cda 100644 --- a/frontend/src/i18n/locales/pt-BR.ts +++ b/frontend/src/i18n/locales/pt-BR.ts @@ -1240,6 +1240,7 @@ export default { smtpServerAndEmail: 'Por favor, preencha o servidor SMTP e o email de remetente antes de testar', usernamePasswordRequired: 'Nome de usuário e senha são obrigatórios quando a autenticação está habilitada', configureSmtpFirst: 'Por favor, configure e teste as configurações SMTP primeiro', + enableAuthFirst: 'Por favor, habilite a autenticação primeiro para usar os recursos baseados em e-mail.', }, // Success messages success: { diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.ts index 12ec1b4af..7f95c6231 100644 --- a/frontend/src/i18n/locales/zh-CN.ts +++ b/frontend/src/i18n/locales/zh-CN.ts @@ -1240,6 +1240,7 @@ export default { smtpServerAndEmail: '测试前请填写 SMTP 服务器和发件邮箱', usernamePasswordRequired: '启用认证时需要用户名和密码', configureSmtpFirst: '请先配置并测试 SMTP 设置', + enableAuthFirst: '请先启用身份验证才能使用基于电子邮件的功能。', }, // Success messages success: {