Modernize email: Gmail OAuth2 sending + admin sidebar redesign #46
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/email-oauth2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Two changes on this branch:
Gmail OAuth2 email delivery
emailConfigmodel + DB table for storing email delivery configuration, with admin routes and controller for managing it.mailer.jsreworked to support OAuth2 credentials alongside the existing transport.EmailDelivery.jsxadmin view;SettingsAdmin.jsxand API client updated to wire it in.Admin sidebar redesign
AdminLayout.jsx, with supportingtheme.cssadditions.Tests
server/test/emailConfig.model.test.jsserver/test/mailer.test.jsNotes
.env.examplefiles,README.md, andBACKEND_DESIGN.mdupdated to document the new OAuth2 configuration.🤖 Generated with Claude Code
Retire env-var SMTP basic-auth and send the contact form through Gmail over OAuth2 (SMTP XOAUTH2), configured in Admin -> Settings -> Email via an in-app "Connect Gmail" consent flow. Reuses the existing google SSO OAuth client; the captured refresh token is stored AES-GCM-encrypted (write-only over the API, never returned), mirroring the auth-provider and Discord-bot secret patterns. - schema: new email_config singleton table (mirrors bot_config) - model: emailConfig.{db,model} with encrypted refresh token + getSafe/getWithSecret - mailer: nodemailer OAuth2 transport (client id/secret from the google provider row), contact recipient = contact_email setting, mailto: fallback preserved, plus sendTest() - routes/controller: /admin/email config, connect start+callback (ssoState CSRF + PKCE), test, disconnect - client: EmailDelivery section on the Settings page + api methods; Settings copy now spells out that contact_email is the delivery recipient - docs/env: drop SMTP_*/CONTACT_TO from env examples; update README/BACKEND_DESIGN - tests: emailConfig.model + mailer suites (8 new; full suite 142 pass) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XKeCQEJZr1AFJN4Bgcmvh3