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 @@ -881,7 +881,12 @@ void DDPClient::login() { - if (!mRocketChatAccount->settings()->password().isEmpty()) { + if (!mRocketChatAccount->settings()->authToken().isEmpty() && !mRocketChatAccount->settings()->tokenExpired()) { + m_attemptedPasswordLogin = true; + QJsonObject json; + json[QStringLiteral("resume")] = mRocketChatAccount->settings()->authToken(); + m_loginJob = method(QStringLiteral("login"), QJsonDocument(json)); + } else 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); @@ -896,11 +901,6 @@ qCWarning(RUQOLA_DDPAPI_LOG) <<"No plugins loaded. Please verify your installation."; setLoginStatus(FailedToLoginPluginProblem); } - } else if (!mRocketChatAccount->settings()->authToken().isEmpty() && !mRocketChatAccount->settings()->tokenExpired()) { - m_attemptedPasswordLogin = true; - QJsonObject json; - json[QStringLiteral("resume")] = mRocketChatAccount->settings()->authToken(); - m_loginJob = method(QStringLiteral("login"), QJsonDocument(json)); } else { setLoginStatus(LoginFailed); }