From 002302bb52ef5aa588afaa7c168c1aab89c6863e Mon Sep 17 00:00:00 2001 From: Joshua Ryder Date: Thu, 2 Oct 2025 11:14:43 -0400 Subject: [PATCH] auth changes --- .env.example | 5 +++++ README.md | 13 +++++++++++-- docker-compose.yml | 4 ++++ nuxt.config.ts | 2 ++ pages/login.vue | 4 ---- server/utils/database.ts | 10 +++++++--- 6 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index c62e493..e06b837 100644 --- a/.env.example +++ b/.env.example @@ -7,3 +7,8 @@ SITE_URL=https://your-domain.com # Generate a secure random string for production # You can use: openssl rand -hex 32 AUTH_SECRET=change-this-secret-in-production + +# Admin Credentials +# Set your admin username and password here +ADMIN_USERNAME=admin +ADMIN_PASSWORD=admin123 diff --git a/README.md b/README.md index 2c6cfc5..d3bd072 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ This application uses environment variables for configuration. These must be set |----------|-------------|----------|---------| | `SITE_URL` | Public URL where the app is hosted (used for QR codes) | Yes | `https://nlcc.rydertech.us` | | `AUTH_SECRET` | Secret key for authentication sessions | Yes | `change-this-secret-in-production` | +| `ADMIN_USERNAME` | Admin login username | Yes | `admin` | +| `ADMIN_PASSWORD` | Admin login password | Yes | `admin123` | ### Setting Up Environment Variables @@ -73,6 +75,10 @@ SITE_URL=https://your-domain.com # Required: Set a secure authentication secret # Generate with: openssl rand -hex 32 AUTH_SECRET=your-secure-random-secret-here + +# Required: Set your admin credentials +ADMIN_USERNAME=your-admin-username +ADMIN_PASSWORD=your-secure-password ``` 4. Build and run with Docker Compose: @@ -84,12 +90,15 @@ The application will be available at `http://localhost:3002` (or your configured **Important**: The `SITE_URL` must be set correctly for QR codes to work. This should be the public URL where your application is accessible (e.g., `https://church.example.com`). -### Default Credentials +### Admin Credentials +Admin credentials are now configured via environment variables (`ADMIN_USERNAME` and `ADMIN_PASSWORD`). Set these in your `.env` file before building the Docker image. + +**Default values** (if not set in `.env`): - **Username**: admin - **Password**: admin123 -⚠️ **Important**: Change these credentials in production by modifying `server/utils/database.ts` +⚠️ **Important**: Always change these default credentials in production by setting `ADMIN_USERNAME` and `ADMIN_PASSWORD` in your `.env` file. ## Project Structure diff --git a/docker-compose.yml b/docker-compose.yml index 108ae37..3d43a11 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,6 +5,8 @@ services: args: - SITE_URL=${SITE_URL:-https://nlcc.rydertech.us} - AUTH_SECRET=${AUTH_SECRET:-change-this-secret-in-production} + - ADMIN_USERNAME=${ADMIN_USERNAME:-admin} + - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin123} container_name: nlcc-itinerary ports: - "3002:3000" @@ -14,4 +16,6 @@ services: - NODE_ENV=production - AUTH_SECRET=${AUTH_SECRET:-change-this-secret-in-production} - SITE_URL=${SITE_URL:-https://nlcc.rydertech.us} + - ADMIN_USERNAME=${ADMIN_USERNAME:-admin} + - ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin123} restart: unless-stopped diff --git a/nuxt.config.ts b/nuxt.config.ts index b8c0953..fb0cfda 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -28,6 +28,8 @@ export default defineNuxtConfig({ runtimeConfig: { authSecret: process.env.AUTH_SECRET || 'change-this-secret-in-production', + adminUsername: process.env.ADMIN_USERNAME || 'admin', + adminPassword: process.env.ADMIN_PASSWORD || 'admin123', public: { siteUrl: process.env.SITE_URL || 'https://newlife-christian.com' } diff --git a/pages/login.vue b/pages/login.vue index 8643df5..3ce19b9 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -58,10 +58,6 @@ - -
-

Default credentials: admin / admin123

-