Overview
EverShop provides CLI commands to manage admin users without accessing the database directly. These commands handle password hashing and validation automatically.Available Commands
evershop user:create- Create a new admin userevershop user:changePassword- Change an admin user’s password
user:create
Create a new admin user account.Usage
Options
| Option | Alias | Required | Description |
|---|---|---|---|
--name | -n | Yes | Admin user’s full name |
--email | -e | Yes | Admin user’s email address |
--password | -p | Yes | Admin user’s password |
Examples
Basic Usage
Using Short Flags
Get Help
Password Requirements
Passwords must:- Be at least 8 characters long
- Contain at least one letter
- Contain at least one digit
Email Validation
Email addresses must be valid format:Implementation Details
The command:- Validates input parameters
- Hashes the password using bcrypt
- Inserts or updates the user in the database
- Uses
insertOnUpdateto handle duplicate emails
Success Output
Error Handling
Invalid Email
Weak Password
Missing Required Field
user:changePassword
Change the password for an existing admin user.Usage
Options
| Option | Alias | Required | Description |
|---|---|---|---|
--email | -e | Yes | Admin user’s email address |
--password | -p | Yes | New password |
Examples
Basic Usage
Using Short Flags
Get Help
Password Requirements
Same requirements asuser:create:
- Minimum 8 characters
- At least one letter
- At least one digit
Implementation Details
The command:- Validates the new password
- Checks if the user exists
- Hashes the new password
- Updates the database
Success Output
Error Handling
User Not Found
Weak Password
Missing Required Field
Password Hashing
All passwords are hashed using bcrypt:Database Schema
Admin users are stored in theadmin_user table:
Security Best Practices
Strong Passwords
Use strong passwords with:- At least 12 characters (longer than minimum)
- Mix of uppercase and lowercase
- Numbers and special characters
- No common words or patterns
Avoid Command History
Passwords in command line are visible in shell history. For production:Use Interactive Prompts
For sensitive operations, consider using a script with interactive prompts:Use Cases
Initial Admin Setup
After installation:Creating Multiple Admins
Password Reset
When an admin forgets their password:Account Recovery
If locked out of admin panel:Automation Scripts
Bulk User Creation
Password Rotation
Troubleshooting
Database Connection Error
.env file exists with database credentials.
User Already Exists
Theuser:create command uses insertOnUpdate, so it will update the existing user if the email already exists:
Permission Denied
Related Commands
evershop install- Initial setup with first admin userevershop start- Start the server to login