Files
yottob/templates/register.html
Ryan Chen 1a4413ae1a Implement complete user authentication system
- Configured Flask-Login with user_loader
- Added register, login, logout routes with proper validation
- Created login.html and register.html templates with auth forms
- Updated base.html navigation to show username and conditional menu
- Added auth page styling to style.css
- Protected all routes with @login_required decorator
- Updated all routes to filter by current_user.id
- Added user ownership validation for:
  - Channels (can only view/refresh own channels)
  - Videos (can only watch/download own videos)
  - Streams (can only stream videos from own channels)
- Updated save_to_db() calls to pass current_user.id
- Improved user_loader to properly handle session management

Features:
- User registration with password confirmation
- Secure password hashing with bcrypt
- Login with "remember me" functionality
- Flash messages for all auth actions
- Redirect to requested page after login
- User-specific data isolation (multi-tenant)

Security:
- All sensitive routes require authentication
- Users can only access their own data
- Passwords hashed with bcrypt salt
- Session-based authentication via Flask-Login

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 14:29:31 -05:00

78 lines
2.5 KiB
HTML

{% extends "base.html" %}
{% block title %}Register - YottoB{% endblock %}
{% block content %}
<div class="auth-page">
<div class="auth-container">
<h2>Create Account</h2>
<p class="auth-subtitle">Join YottoB to start downloading YouTube videos</p>
<form method="POST" action="{{ url_for('register') }}" class="auth-form">
<div class="form-group">
<label for="username">Username</label>
<input
type="text"
id="username"
name="username"
required
autofocus
class="form-input"
placeholder="Choose a username"
minlength="3"
maxlength="80"
>
<small class="form-help">3-80 characters, letters, numbers, and underscores</small>
</div>
<div class="form-group">
<label for="email">Email</label>
<input
type="email"
id="email"
name="email"
required
class="form-input"
placeholder="Enter your email address"
>
</div>
<div class="form-group">
<label for="password">Password</label>
<input
type="password"
id="password"
name="password"
required
class="form-input"
placeholder="Choose a strong password"
minlength="8"
>
<small class="form-help">At least 8 characters</small>
</div>
<div class="form-group">
<label for="confirm_password">Confirm Password</label>
<input
type="password"
id="confirm_password"
name="confirm_password"
required
class="form-input"
placeholder="Re-enter your password"
minlength="8"
>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary btn-block">Create Account</button>
</div>
</form>
<div class="auth-footer">
<p>Already have an account? <a href="{{ url_for('login') }}">Login here</a></p>
</div>
</div>
</div>
{% endblock %}