@@ -164,11 +164,10 @@ MainController::MainController(QObject* parent)
164164
165165 // Auth: on login success, auto-bind device + start sync + fetch lists
166166 connect (m_authManager.get (), &AuthManager::loginSuccess, this , [this ]() {
167- // Auto-bind this host device
167+ // Auto-bind this host device (also marks logged_in=true on server)
168168 QString deviceId = m_hostManager->deviceId ();
169169 if (!deviceId.isEmpty ()) {
170170 m_cloudDeviceManager->autoBindDevice (deviceId);
171- m_cloudDeviceManager->deviceLogin (deviceId);
172171 }
173172 // Start sync WebSocket
174173 m_cloudDeviceManager->startSync ();
@@ -183,19 +182,11 @@ MainController::MainController(QObject* parent)
183182 }
184183 });
185184
186- // Auth: on logout, notify server device is no longer logged in + stop sync
185+ // Auth: on logout, stop sync ( server handles logged_in=false in its logout API)
187186 connect (m_authManager.get (), &AuthManager::loggedOut, this , [this ]() {
188187 m_cloudDeviceManager->stopSync ();
189188 });
190189
191- // Notify server before token is cleared (loggedOut fires after token is gone)
192- connect (m_authManager.get (), &AuthManager::loggingOut, this , [this ]() {
193- QString deviceId = m_hostManager->deviceId ();
194- if (!deviceId.isEmpty ()) {
195- m_cloudDeviceManager->deviceLogout (deviceId);
196- }
197- });
198-
199190 // Sync access code changes from cloud devices to recent connections
200191 connect (m_cloudDeviceManager.get (), &CloudDeviceManager::myDevicesChanged, this , [this ]() {
201192 for (const auto & v : m_cloudDeviceManager->myDevices ()) {
@@ -787,7 +778,6 @@ void MainController::onHostReady(const QString& deviceId, const QString& accessC
787778 // Auto-bind if user is already logged in (loginSuccess may have fired before hostReady)
788779 if (m_authManager->isLoggedIn () && !deviceId.isEmpty ()) {
789780 m_cloudDeviceManager->autoBindDevice (deviceId);
790- m_cloudDeviceManager->deviceLogin (deviceId);
791781 if (!accessCode.isEmpty ()) {
792782 m_cloudDeviceManager->syncAccessCode (deviceId, accessCode);
793783 }
0 commit comments