Commit graph

11 commits

Author SHA1 Message Date
e4cabf4be6
otp (#41)
* Add email OTP authentication system and private room management

## Authentication System
- Implement email OTP-based authentication with User and OTPToken models
- Add auth.py module with OTP generation, email sending, and session management
- Create authentication endpoints: /auth/send-otp, /auth/verify-otp, /auth/claim-name, /auth/status, /auth/logout
- Add authentication modal UI with email verification and display name claiming
- Support SMTP configuration via environment variables (optional)

## Room Privacy & Ownership
- Add is_private, is_archived, owner_id, and forked_from_id fields to Room model
- Implement private rooms (single-user, owner-only access)
- Add room forking: users can fork public rooms to public or private
- Add room archive/delete endpoints (owner-only operations)
- Implement access control for private room viewing

## UI Improvements
- Add public/private room tabs in sidebar
- Show authentication prompt in private rooms tab for non-authenticated users
- Add room action buttons (fork, archive, delete) with proper permissions
- Update homepage with statistics (public/private rooms, active users, active rooms)
- Remove model/voice from URL query strings, use localStorage exclusively

## Database Migration
- Create migration 2025011100 for User, OTPToken tables and Room model updates
- Add indexes for email, display_name, is_private, is_archived, owner_id

## Breaking Changes
- URL parameters now only include username (model/voice moved to localStorage)
- Private rooms require authentication to access
- Room creation can now require authentication (for private rooms)

* Update README with authentication and private room documentation

* Simplify README to be less verbose

* Add missing session import to fix linter errors

* Fix migration dependency to resolve multiple heads conflict

* asdf

* Fix SQLAlchemy auto-correlation error in homepage statistics query

* Change tagline from AI-Powered to Machine Learning Powered

* Add dedicated authentication page instead of modal

- Create new /auth route with full-page authentication flow
- Remove modal code from index.html
- Update Sign in link to point to /auth page
- Auth page has 4-step flow: email, OTP, display name, success
- Better UX with gradient background and cleaner design

* Fix migration: remove batch_alter_table to avoid circular dependency

- Use op.add_column() directly instead of batch_alter_table()
- Remove foreign key constraints (defined in models, not needed in migration)
- User and OTPToken tables created by db.create_all() in make init-db
- Fixes CircularDependencyError during migration

* Fix migration: check if columns exist before adding

- Use inspector to check existing columns and indexes
- Only add columns/indexes if they don't already exist
- Handles case where db.create_all() was run before migration
- Fixes 'duplicate column name' error

* Add profile page, room browsing, and updated_at timestamp

Features:
- Profile page with username change and dark/light mode settings
- Browse page for discovering public and private rooms
- Room updated_at timestamp (integer Unix epoch) that updates on new messages
- Dynamic room tabs based on current room type (public/private)
- Fork and delete room actions moved to right sidebar utility belt
- Remove archive feature and success alerts from room actions

Technical changes:
- Add updated_at column to Room model (integer timestamp)
- Add /profile route with authentication requirement
- Add /browse route for room discovery
- Add API endpoints for username availability check and update
- Update room.updated_at on message creation in app.py:1189
- Wider right sidebar (25% instead of 15%) for better button layout
- Profile link on homepage and browse page for authenticated users

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: russell@unturf. <russell@unturf.com>
2025-11-11 22:56:58 -05:00
1b44c2d66b Integrate comprehensive testing framework with Makefile
- Added unit tests for YAML loading and parsing functionality
- Created integration tests for multiple activity files validation
- Implemented functional tests for complete activity workflows
- Added battleship pre_script functionality tests
- Integrated all test types into comprehensive Makefile
- Fixed CLI validator test with proper failing fixture
- Applied black formatting to all Python files
- Removed problematic hardcoded targets from Makefile
- Added proper venv dependency management

Test coverage includes:
- Unit: YAML loading, validator functionality
- Integration: Cross-file validation, metadata operations
- Functional: End-to-end activity flows, pre_script execution
- All 30 activity files validated and tested
2025-08-10 19:38:50 -04:00
b01311a825 inactive uesrs now collected.
modified:   app.py
	new file:   migrations/versions/5d93cdf18549_room_inactive_users_column.py
	modified:   templates/base.html
	modified:   templates/chat.html
2024-11-24 14:16:25 -05:00
0f82305087 feature complete. "sorry for the convenience"
modified:   app.py
	new file:   migrations/versions/1ac5a8e0f577_user_session_table.py
2024-11-23 11:32:49 -05:00
6f1c7def7b new file: migrations/versions/38a330686a17_room_active_users.py 2024-11-23 10:46:15 -05:00
f5df195e9b black and also set_language isn't "correct" anymore.
so it doesn't move the student on.

	modified:   app.py
	modified:   migrations/env.py
	modified:   migrations/versions/190d5ef26e20_add_token_count_to_message.py
	modified:   migrations/versions/a9e886c56482_create_room_table.py
	modified:   migrations/versions/d737de68d6fa_add_metadata_field_to_activitystate.py
	modified:   research/activity21.yaml
	modified:   research/guarded_ai.py
2024-08-10 17:00:52 -04:00
5d10296f1f escape room mechanics with json_metadata for temporarily collecting data
based on where the user has went we can for example set a key: true if
they collected a key needed to access a section's steps.

	modified:   app.py
	new file:   migrations/versions/d737de68d6fa_add_metadata_field_to_activitystate.py
	new file:   research/activity14-choose-adventure.yaml
2024-07-28 19:14:54 -04:00
6dff9dc6e9 Integrated gaurded ai via websocket frontend.
modified:   app.py
	new file:   migrations/versions/d04950c5a624_add_activitystate_table2.py
	new file:   migrations/versions/d3631b8bb652_add_activitystate_table.py
2024-07-27 10:30:07 -04:00
Russell Ballestrini
c2aaac9768 make count_tokens public on Message
modified:   app.py
	modified:   migrations/versions/190d5ef26e20_add_token_count_to_message.py
2023-12-07 13:01:42 -05:00
06a0867161 token count to message object
modified:   app.py
	new file:   migrations/versions/190d5ef26e20_add_token_count_to_message.py
2023-12-07 09:33:35 -05:00
2639a2f99c room table so we can dedupe the name and title
modified:   app.py
	new file:   migrations/README
	new file:   migrations/alembic.ini
	new file:   migrations/env.py
	new file:   migrations/script.py.mako
	new file:   migrations/versions/a9e886c56482_create_room_table.py
2023-11-10 12:05:30 -05:00