BeActive now includes a complete authentication system with user management and admin controls.
- JWT-based Authentication: Secure token-based authentication
- User Accounts: Each user has their own todo lists
- Admin Panel: Admins can manage users and permissions
- First-time Setup: Automatic setup wizard for the first admin user
- Password Hashing: Secure password storage using bcrypt
When you first access the app, you'll be prompted to create an admin account. This first user will automatically be assigned admin privileges.
Admins can create new users from the User Management panel:
- Click the 👥 Users button in the top-right corner
- Click Add New User
- Enter username and password
- Click Create User
From the User Management panel, admins can:
- Make Admin: Promote a user to admin
- Remove Admin: Demote an admin back to regular user
- Delete User: Remove a user account (their todos will be deleted)
POST /api/auth/admin-exists- Check if admin user existsPOST /api/auth/setup- Create first admin userPOST /api/auth/login- Login with username and passwordGET /api/auth/verify- Verify current token
GET /api/users- Get all usersPOST /api/users- Create new userPATCH /api/users/:userId/admin- Toggle admin statusDELETE /api/users/:userId- Delete user
- Each user has their own separate todo lists
- Users can only see their own todos
- Admins cannot view or manage other users' todos
- Public shared links are still accessible without login
The JWT token is stored in the browser's localStorage with the key token. The user information is stored with the key user.
- Change JWT_SECRET: Before deploying to production, change the
JWT_SECRETenvironment variable - HTTPS: Always use HTTPS in production
- Token Expiry: Tokens expire after 7 days
- Password Hashing: Passwords are hashed with bcrypt (10 salt rounds)
CREATE TABLE users (
id TEXT PRIMARY KEY,
username TEXT NOT NULL UNIQUE,
password TEXT NOT NULL,
is_admin BOOLEAN DEFAULT 0,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
)Lists now have optional user_id and is_public fields:
ALTER TABLE lists ADD COLUMN user_id TEXT;
ALTER TABLE lists ADD COLUMN is_public BOOLEAN DEFAULT 0;The admin user has already been created. Use the login page to log in.
Check that your username and password are correct. Passwords are case-sensitive.
You'll need to log in again. Tokens are valid for 7 days.
- Password reset functionality
- Email verification
- User profiles
- More granular permissions
- Audit logging