diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index f8820be..b53dab8 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -15,7 +15,10 @@ function App() { const [allRules, setAllRules] = useState([]); const [showAllRules, setShowAllRules] = useState(false); const [toast, setToast] = useState(null); - const [isAuthenticating, setIsAuthenticating] = useState(false); + const [isAuthenticating, setIsAuthenticating] = useState(() => { + const params = new URLSearchParams(window.location.search); + return !!(params.get('email') && params.get('expires') && params.get('signature')); + }); const [singleEmailMode, setSingleEmailMode] = useState(false); const showToast = (message, type = 'success') => { @@ -184,106 +187,34 @@ function App() {
- {/* Single Email Mode Header */} - {singleEmailMode && email && ( -
-
-
- - - -
-
-

Your Email Configuration

-

{email}

-
-
+ {/* Authenticating State */} + {isAuthenticating && ( +
+ +

+ Authenticating from Roundcube... +

+

+ Please wait while we verify your session +

)} - {/* Email Search Section - Only show if NOT in single email mode */} - {!singleEmailMode && ( - <> -
-
-
-

Manage Email Rules

-

- Search for an email address to configure auto-replies and forwarding -

-
- -
- -
-
- { - setEmail(e.target.value); - setEmailError(''); - }} - onKeyPress={handleKeyPress} - placeholder="Enter email address (e.g., user@example.com)" - className={`input-field ${emailError ? 'border-red-500 focus:ring-red-500' : ''}`} - /> - {emailError && ( -

{emailError}

- )} -
- -
+ {/* Access Denied / Invalid State */} + {!isAuthenticating && !currentRule && ( +
+
+ + +
- - {/* All Rules List */} - {showAllRules && allRules.length > 0 && ( -
-

All Configured Rules

-
- {allRules.map((rule, index) => ( -
handleSelectRule(rule.email_address)} - className="flex items-center justify-between p-4 bg-gray-50 hover:bg-gray-100 border border-gray-200 rounded-lg cursor-pointer transition-colors" - > -
-

{rule.email_address}

-
- - OOO: {rule.ooo_active ? 'Active' : 'Inactive'} - - Forwards: {rule.forwards?.length || 0} -
-
-
- ))} -
-
- )} - +

+ Access Denied +

+

+ This application can only be accessed via the secure link provided in your Roundcube configuration. +

+
)} {/* Configuration Tabs */} @@ -314,17 +245,15 @@ function App() {
)} - - {/* Empty State */} - {!currentRule && !showAllRules && !isAuthenticating && ( -
- -

- Search for an email address -

-

- Enter an email address above to view and configure its out-of-office auto-replies and forwarding rules -

-
- )} - - {/* Authenticating State */} - {isAuthenticating && ( -
- -

- Authenticating from Roundcube... -

-

- Please wait while we verify your session -

-
- )}
{/* Toast Notifications */}