User Registration
New users can join Mirage by creating an account with their credentials and profile information.Fill Registration Form
Provide your username, email, password, and optional profile details:
- Username: Unique identifier for your account
- Email: Used for account verification and recovery
- Avatar URL: Optional profile picture link
- Description: Bio with up to 500 words
Submit Registration
Click the register button to create your account. The system will:
- Validate all required fields are filled
- Check username and email uniqueness
- Hash your password using Werkzeug’s secure password hashing
- Create your user profile with initial stats (0 followers, 0 posts, etc.)
Registration Example
app/routes/auth.py:11-53
Security Note: All passwords are hashed using Werkzeug’s
generate_password_hash() function before storage. Plain text passwords are never stored in the database.User Login
Log into your Mirage account to access all features and your personalized feed.- Login Flow
- Token Authentication
- Error Handling
- Enter your username and password
- System verifies credentials against stored hash
- Receive authentication token for session management
- Token is used for all subsequent API requests
Login Authentication Code
app/routes/auth.py:55-82
Logout
Securely end your session by invalidating your authentication token.Logout Process
When you log out, your session token is removed from the database, preventing any further authenticated requests with that token.
app/routes/auth.py:84-108
Security Features
Password Hashing
Werkzeug’s secure password hashing protects user credentials from database breaches
Token-Based Sessions
UUID tokens provide secure, stateless authentication for API requests
Unique Constraints
Database enforces unique usernames and emails to prevent duplicate accounts
Input Validation
Server-side validation ensures all required fields are present and properly formatted
Database Schema
User authentication relies on the following database structure:app/db.py:77-88
API Endpoints
Register
Create new account
Login
Authenticate user
Logout
End session
All authenticated endpoints require the
Authorization header with your session token.