docs: Update README with admin user creation instructions
This commit is contained in:
@@ -235,17 +235,39 @@ The admin dashboard provides:
|
||||
**Logout:**
|
||||
- Click "Logout" in navigation bar
|
||||
|
||||
### Registration
|
||||
### Admin User Creation
|
||||
|
||||
Currently registration is not implemented. To add a user manually:
|
||||
To create an admin user, use the provided script:
|
||||
|
||||
```bash
|
||||
ruby scripts/create_admin.rb <email> <password>
|
||||
```
|
||||
|
||||
**Example:**
|
||||
```bash
|
||||
ruby scripts/create_admin.rb david@dhg.lol admin
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Create a player profile
|
||||
2. Create a user account with `club_admin` role
|
||||
3. Mark the account as confirmed
|
||||
|
||||
**Manual SQL Alternative:**
|
||||
|
||||
If you prefer to create users manually via SQL:
|
||||
|
||||
1. Access the database: `sqlite3 db/euchre_camp.db`
|
||||
2. Insert a user record:
|
||||
```sql
|
||||
INSERT INTO users (player_id, email, password_digest, role, created_at, updated_at)
|
||||
VALUES (1, 'user@example.com', '$2b$12$...', 'club_admin', datetime('now'), datetime('now'));
|
||||
```
|
||||
(Use BCrypt to generate password hash)
|
||||
2. Generate a BCrypt password hash:
|
||||
```bash
|
||||
ruby -e "require 'bcrypt'; puts BCrypt::Password.create('your_password')"
|
||||
```
|
||||
3. Insert a user record:
|
||||
```sql
|
||||
INSERT INTO players (name, rating) VALUES ('PlayerName', 1000);
|
||||
INSERT INTO users (player_id, email, password_digest, role, confirmed, created_at, updated_at)
|
||||
VALUES (1, 'user@example.com', '$2b$12$...', 'club_admin', 1, datetime('now'), datetime('now'));
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
|
||||
Reference in New Issue
Block a user