From 5f12e10fe9d137eb7001cbc361f3df5c1a8f6b09 Mon Sep 17 00:00:00 2001 From: Jan Bidler Date: Thu, 25 Aug 2022 12:51:13 +0200 Subject: [PATCH] Adds a workaround to login on servers without .well_known --- src/login.cpp | 5 ++++- src/qml/Component/Login/Login.qml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/login.cpp b/src/login.cpp index 40747e4e8..a4d770c59 100644 --- a/src/login.cpp +++ b/src/login.cpp @@ -156,7 +156,10 @@ void Login::login() m_isLoggingIn = true; Q_EMIT isLoggingInChanged(); - m_connection->loginWithPassword(m_matrixId, m_password, m_deviceName, QString()); + // Some servers do not have a .well_known file. So we login via the username part from the mxid, + // rather than with the full mxid, as that would lead to an invalid user. + QStringRef username(&m_matrixId, 1, m_matrixId.indexOf(":") - 1); + m_connection->loginWithPassword(username.toString(), m_password, m_deviceName, QString()); } bool Login::supportsPassword() const diff --git a/src/qml/Component/Login/Login.qml b/src/qml/Component/Login/Login.qml index 07fa19a0e..1d4509b84 100644 --- a/src/qml/Component/Login/Login.qml +++ b/src/qml/Component/Login/Login.qml @@ -29,7 +29,7 @@ LoginStep { Kirigami.FormData.label: i18n("Matrix ID:") placeholderText: "@user:matrix.org" onTextChanged: { - if(acceptableInput) { + if (acceptableInput) { LoginHelper.matrixId = text } }