From fa91ac28493020f141169c33b8778e77480b6e98 Mon Sep 17 00:00:00 2001 From: Nick Mills-Barrett Date: Tue, 13 Oct 2026 13:06:08 +0100 Subject: [PATCH] fix: show the background re-login PIN to cloud users The PIN for a silent password re-login was sent as a CONNECTING state, which the status endpoint drops, so cloud users never saw it and the re-login timed out. Send it as TRANSIENT_DISCONNECT with OPEN_NATIVE and the PIN in Info so each new PIN is delivered, and send CONNECTED once it is confirmed. Co-Authored-By: Claude Opus 5.5 --- pkg/connector/client.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/connector/client.go b/pkg/connector/client.go index a881521..c4077d1 100644 --- a/pkg/connector/client.go +++ b/pkg/connector/client.go @@ -27,6 +27,7 @@ var ( ) const lineMissingE2EEKeyMessage = "LINE encryption keys are unavailable. Reconnect LINE in Beeper to restore message decryption." +const linePINRequiredMessage = "LINE needs you to confirm this sign-in. Open the LINE app on your phone and enter this PIN: %s" var newLineAPIClient = line.NewClient var newE2EEManager = e2ee.NewManager @@ -694,7 +695,7 @@ func (lc *LineClient) Connect(ctx context.Context) { workersStarted = true } -func (lc *LineClient) tryLogin(ctx context.Context) error { +func (lc *LineClient) tryLogin(ctx context.Context) (err error) { var email, password, certificate string if meta, ok := lc.UserLogin.Metadata.(*UserLoginMetadata); ok { email = meta.Email @@ -741,11 +742,17 @@ func (lc *LineClient) tryLogin(ctx context.Context) error { lc.UserLogin.Bridge.Log.Warn().Msg("PIN verification required — check your LINE mobile app to complete re-login") // Send the PIN via bridge state so the user sees it in their Matrix client lc.UserLogin.BridgeState.Send(status.BridgeState{ - StateEvent: status.StateConnecting, + StateEvent: status.StateTransientDisconnect, Error: "line-pin-required", - Message: fmt.Sprintf("Enter this PIN on your LINE mobile app: %s", pin), - UserAction: status.UserActionRelogin, + Message: fmt.Sprintf(linePINRequiredMessage, pin), + UserAction: status.UserActionOpenNative, + Info: map[string]any{"pin": pin}, }) + defer func() { + if err == nil && !lc.superseded.Load() && !lc.isSessionInvalidated() { + lc.UserLogin.BridgeState.Send(status.BridgeState{StateEvent: status.StateConnected}) + } + }() } lc.UserLogin.Bridge.Log.Info().Msg("Waiting for PIN verification on mobile device...")