diff --git a/src/ruqolacore/ddpapi/ddpclient.cpp b/src/ruqolacore/ddpapi/ddpclient.cpp --- a/src/ruqolacore/ddpapi/ddpclient.cpp +++ b/src/ruqolacore/ddpapi/ddpclient.cpp @@ -886,7 +886,12 @@ void DDPClient::login() { - if (!mRocketChatAccount->settings()->password().isEmpty()) { + if (!mRocketChatAccount->settings()->authToken().isEmpty() && !m_attemptedTokenLogin) { + m_attemptedPasswordLogin = true; + QJsonObject json; + json[QStringLiteral("resume")] = mRocketChatAccount->settings()->authToken(); + m_loginJob = method(QStringLiteral("login"), QJsonDocument(json)); + } if (!mRocketChatAccount->settings()->password().isEmpty()) { // If we have a password and we couldn't log in, let's stop here if (m_attemptedPasswordLogin) { setLoginStatus(LoginFailed); @@ -901,11 +906,6 @@ qCWarning(RUQOLA_DDPAPI_LOG) <<"No plugins loaded. Please verify your installation."; setLoginStatus(FailedToLoginPluginProblem); } - } else if (!mRocketChatAccount->settings()->authToken().isEmpty() && !m_attemptedTokenLogin) { - m_attemptedPasswordLogin = true; - QJsonObject json; - json[QStringLiteral("resume")] = mRocketChatAccount->settings()->authToken(); - m_loginJob = method(QStringLiteral("login"), QJsonDocument(json)); } else { setLoginStatus(LoginFailed); }