The VGLUG Application Form now includes a comprehensive admin panel for managing form configurations and users.
http://localhost:5173/admin
- Email:
vglugadmin - Password:
WeGlug@123
- See all form configuration versions
- Each version shows:
- Version number
- Year
- Active status
- Creation date
- Form title
- Click on any version to view/edit its JSON configuration
- Full JSON editor with syntax highlighting
- Real-time validation
- Edit the JSON
- Click "Save as New Version"
- Automatically increments version number
- Automatically sets as active (deactivates previous version)
- Click "Activate" on any inactive version
- Makes it the live form visible to users
- Automatically deactivates other versions for that year
- See all registered users
- View email, role, and creation date
- Admin users have a red "Admin" badge
- Enter email and password
- Optionally grant admin privileges
- New users can immediately log in to admin panel (if admin) or use the regular form
Login to admin panel.
Request:
{
"email": "vglugadmin",
"password": "WeGlug@123"
}Response:
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGc...",
"user": {
"id": 1,
"email": "vglugadmin",
"is_admin": true
}
}Get all form configurations.
Headers:
Authorization: Bearer {token}
Response:
[
{
"id": 1,
"year": 2025,
"version": 4,
"is_active": true,
"created_at": "2025-12-15T20:12:40.857771",
"title": "VGLUG APPLICATION FORM 2025"
}
]Get detailed form configuration including full JSON.
Headers:
Authorization: Bearer {token}
Response:
{
"id": 1,
"year": 2025,
"version": 4,
"is_active": true,
"created_at": "2025-12-15T20:12:40.857771",
"updated_at": "2025-12-15T20:12:40.857771",
"template_json": {
"title": "VGLUG APPLICATION FORM 2025",
"sections": [...]
}
}Create a new form configuration.
Headers:
Authorization: Bearer {token}
Content-Type: application/json
Request:
{
"template_json": {
"title": "VGLUG APPLICATION FORM 2025",
"sections": [...]
},
"year": 2025,
"set_active": true
}Response:
{
"msg": "Form configuration created",
"id": 5,
"year": 2025,
"version": 5,
"is_active": true
}Activate a specific form configuration.
Headers:
Authorization: Bearer {token}
Response:
{
"msg": "Form configuration activated"
}Get all users.
Headers:
Authorization: Bearer {token}
Response:
[
{
"id": 1,
"email": "vglugadmin",
"is_admin": true,
"created_at": "2025-12-15T20:00:00.000000"
}
]Create a new user.
Headers:
Authorization: Bearer {token}
Content-Type: application/json
Request:
{
"email": "newadmin@example.com",
"password": "SecurePassword123",
"is_admin": true
}Response:
{
"msg": "User created",
"id": 2,
"email": "newadmin@example.com",
"is_admin": true
}- All admin endpoints require valid JWT token
- Tokens expire after configured time
- Tokens stored in localStorage for persistence
- All admin endpoints check
is_adminflag - Non-admin users receive 403 Forbidden
- Login endpoint specifically checks for admin privileges
- All passwords hashed using werkzeug security
- Original passwords never stored
- Secure password checking
cd backend
source .venv/bin/activate
python seed_admin.py- Log in to admin panel
- Click "Form Configurations" tab
- Select the current active version
- Edit the JSON in the editor
- Click "Save as New Version"
- New version becomes active automatically
- Log in to admin panel
- Click "Form Configurations" tab
- Find the version you want to activate
- Click "Activate" button
- Confirm the activation
- Log in to admin panel with existing admin account
- Click "User Management" tab
- Fill in email and password
- Check "Admin privileges" checkbox
- Click "Create User"
- New admin can immediately log in
Since there's no direct password change feature:
- Create a new admin user with desired credentials
- Log out and log in with new credentials
- Optionally delete the old admin user (if you have another admin user)
- Verify credentials (default: vglugadmin / WeGlug@123)
- Check backend is running on port 5000
- Check browser console for errors
- Verify user has
is_admin=truein database
- Ensure JSON is valid (use a JSON validator)
- Check required fields:
title,sections - Ensure sections is an array, not an object
- Verify all field names match expected format
- Ensure you clicked "Save as New Version"
- Verify the new version is active (green badge)
- Clear browser cache
- Refresh the public form page
- Verify JWT token is valid
- Check user has admin privileges
- Try logging out and back in
- Check token hasn't expired
Added is_admin field:
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(255), unique=True, nullable=False)
password_hash = db.Column(db.String(255), nullable=False)
is_admin = db.Column(db.Boolean, default=False, nullable=False) # NEW
created_at = db.Column(db.DateTime, default=datetime.utcnow)cd backend
source .venv/bin/activate
flask db migrate -m "Add is_admin field to User model"
flask db upgradefrontend/src/
├── AdminApp.tsx # Main admin app component
├── pages/
│ ├── AdminLogin.tsx # Admin login page
│ └── AdminDashboard.tsx # Admin dashboard with tabs
└── services/
└── adminApi.ts # Admin API service
backend/
├── seed_admin.py # Script to create default admin
└── app.py # Admin endpoints added
-
Always Test in Development First
- Test JSON changes locally before creating new version
- Use JSON validators
-
Keep Old Versions
- Don't delete old versions
- They serve as backup and history
-
Document Changes
- Add comments in version control when updating forms
- Note what changed in each version
-
Secure Credentials
- Change default password immediately
- Use strong passwords for admin accounts
- Don't share admin credentials
-
Regular Backups
- Backup database regularly
- Export form configurations periodically
Possible improvements:
- Password change functionality
- User deletion
- Form configuration diff/comparison
- Form preview before activation
- Audit log for changes
- Export/import configurations
- Bulk operations
- Search and filter