Commit eac2c415 authored by Aryan Noshirvnai's avatar Aryan Noshirvnai

Fix /auth/telegram/login to actually link to the caller's account

It was documented as an account-linking flow (attach a Telegram session to
the already-logged-in user) but the code never changed to match - it still
created/looked up a *separate* User row keyed by Telegram's own numeric
user_id and issued that identity a fresh token pair, same as the old
Telegram-is-the-login design it was supposed to replace. Silently
pointless: nothing actually got linked to whoever was logged in.

Now requires an authenticated caller and attaches telegram_session_string
+ phone_number directly to current_user, no new tokens issued (the caller
already has valid ones). Returns 409 if that Telegram account is already
linked to a different Stax user. Found and fixed while helping the user
actually test the chat-scanning feature against their real account.
Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
parent 575d3a59
Pipeline #1101 passed with stage
in 10 minutes and 45 seconds