From ba94baba4b9a9a803942bb1916951667ce495b34 Mon Sep 17 00:00:00 2001 From: alma Date: Wed, 16 Apr 2025 00:23:18 +0200 Subject: [PATCH] mail page imap connection mime 5 bis rest 16 login page 16 --- app/api/mail/route.ts | 13 ++++++++++++- app/mail/login/page.tsx | 13 +++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/app/api/mail/route.ts b/app/api/mail/route.ts index 9bfb57a..20e9b21 100644 --- a/app/api/mail/route.ts +++ b/app/api/mail/route.ts @@ -55,14 +55,25 @@ interface ImapConfig { function getStoredCredentials(): StoredCredentials | null { if (typeof window === 'undefined') { // Server-side - we should never get here in a client-side request + console.log('Server-side credentials check - returning null'); return null; } // Client-side const stored = localStorage.getItem('imapCredentials'); - if (!stored) return null; + console.log('Stored credentials from localStorage:', stored); + + if (!stored) { + console.log('No stored credentials found'); + return null; + } const credentials = JSON.parse(stored); + console.log('Parsed credentials:', { + ...credentials, + password: '***' + }); + return { email: credentials.email, password: credentials.password, diff --git a/app/mail/login/page.tsx b/app/mail/login/page.tsx index 8cd2de7..e0dd58a 100644 --- a/app/mail/login/page.tsx +++ b/app/mail/login/page.tsx @@ -43,12 +43,21 @@ export default function LoginPage() { } // Store credentials in localStorage - localStorage.setItem('imapCredentials', JSON.stringify({ + const credentials = { email, password, host, port: parseInt(port), - })); + }; + console.log('Storing credentials:', { + ...credentials, + password: '***' + }); + localStorage.setItem('imapCredentials', JSON.stringify(credentials)); + + // Verify storage + const stored = localStorage.getItem('imapCredentials'); + console.log('Verified stored credentials:', stored); // Redirect to mail page router.push('/mail');