Modernize email: Gmail OAuth2 sending + admin sidebar redesign #46

Merged
whitlocktech merged 2 commits from feature/email-oauth2 into main 2026-07-08 03:33:44 +00:00
Member

Summary

Two changes on this branch:

Gmail OAuth2 email delivery

  • Adds OAuth2-based Gmail sending as an alternative to SMTP, configured from the admin Settings → Email Delivery view.
  • New emailConfig model + DB table for storing email delivery configuration, with admin routes and controller for managing it.
  • mailer.js reworked to support OAuth2 credentials alongside the existing transport.
  • New EmailDelivery.jsx admin view; SettingsAdmin.jsx and API client updated to wire it in.

Admin sidebar redesign

  • Collapsible categories, icons, and role-accurate navigation in AdminLayout.jsx, with supporting theme.css additions.

Tests

  • server/test/emailConfig.model.test.js
  • server/test/mailer.test.js

Notes

  • .env.example files, README.md, and BACKEND_DESIGN.md updated to document the new OAuth2 configuration.

🤖 Generated with Claude Code

## Summary Two changes on this branch: **Gmail OAuth2 email delivery** - Adds OAuth2-based Gmail sending as an alternative to SMTP, configured from the admin **Settings → Email Delivery** view. - New `emailConfig` model + DB table for storing email delivery configuration, with admin routes and controller for managing it. - `mailer.js` reworked to support OAuth2 credentials alongside the existing transport. - New `EmailDelivery.jsx` admin view; `SettingsAdmin.jsx` and API client updated to wire it in. **Admin sidebar redesign** - Collapsible categories, icons, and role-accurate navigation in `AdminLayout.jsx`, with supporting `theme.css` additions. ## Tests - `server/test/emailConfig.model.test.js` - `server/test/mailer.test.js` ## Notes - `.env.example` files, `README.md`, and `BACKEND_DESIGN.md` updated to document the new OAuth2 configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
wtclaude added 1 commit 2026-07-08 03:30:48 +00:00
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
whitlocktech added 1 commit 2026-07-08 03:33:17 +00:00
whitlocktech approved these changes 2026-07-08 03:33:36 +00:00
whitlocktech merged commit d7fc2dccb7 into main 2026-07-08 03:33:44 +00:00
whitlocktech deleted branch feature/email-oauth2 2026-07-08 03:33:45 +00:00
Sign in to join this conversation.
No description provided.