nextjs-rewrite #5
@@ -235,17 +235,39 @@ The admin dashboard provides:
|
|||||||
**Logout:**
|
**Logout:**
|
||||||
- Click "Logout" in navigation bar
|
- 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`
|
1. Access the database: `sqlite3 db/euchre_camp.db`
|
||||||
2. Insert a user record:
|
2. Generate a BCrypt password hash:
|
||||||
```sql
|
```bash
|
||||||
INSERT INTO users (player_id, email, password_digest, role, created_at, updated_at)
|
ruby -e "require 'bcrypt'; puts BCrypt::Password.create('your_password')"
|
||||||
VALUES (1, 'user@example.com', '$2b$12$...', 'club_admin', datetime('now'), datetime('now'));
|
```
|
||||||
```
|
3. Insert a user record:
|
||||||
(Use BCrypt to generate password hash)
|
```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
|
## API Reference
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user