Skip to content

fix: skip login on /viewplan for MachAI iframe users#575

Merged
neoneye merged 13 commits intomainfrom
fix/viewplan-skip-login-for-machai
Apr 14, 2026
Merged

fix: skip login on /viewplan for MachAI iframe users#575
neoneye merged 13 commits intomainfrom
fix/viewplan-skip-login-for-machai

Conversation

@neoneye
Copy link
Copy Markdown
Member

@neoneye neoneye commented Apr 14, 2026

Summary

  • Extract is_machai_user() into database_api/is_machai_user.py — single source of truth for identifying MachAI iframe users, used by both frontend_multi_user and worker_plan_database
  • /viewplan no longer requires @login_required unconditionally — checks task.user_id first: MachAI users can view without login, regular users still require authentication and ownership
  • _should_send_to_machai() in the worker now delegates to the shared is_machai_user()

Test plan

  • Iframe plan from mach-ai.com completes and redirects to /viewplan without login prompt
  • Regular user on home.planexe.org still requires login to view plans
  • Regular user cannot view another user's plan (403)
  • Admin can view any plan

🤖 Generated with Claude Code

neoneye and others added 13 commits April 14, 2026 20:48
Extract is_machai_user() into database_api/ so both frontend and worker
share the same check. /viewplan now looks up the task's user_id: MachAI
users (non-UUID, not in UserAccount) can view without login; regular
users still require authentication and ownership.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Accept plan_id as the primary parameter, fall back to run_id for
backwards compatibility. Update all internal links.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update render_template calls and all Jinja references in
run_via_database.html and plan_iframe.html.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… downloads

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fixes pyright error: Flask type doesn't expose login_manager attribute.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@neoneye neoneye merged commit 2359c43 into main Apr 14, 2026
3 checks passed
@neoneye neoneye deleted the fix/viewplan-skip-login-for-machai branch April 14, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant