Correctly handle account with invalid access token
Show a popup saying the session was signed out and cleanup the models data, instead of spamming the users with never-ending errors.
This commit is contained in:
46
src/gui/Popups/InvalidAccessTokenPopup.qml
Normal file
46
src/gui/Popups/InvalidAccessTokenPopup.qml
Normal file
@@ -0,0 +1,46 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
import "../Base"
|
||||
import "../Base/Buttons"
|
||||
|
||||
HFlickableColumnPopup {
|
||||
id: popup
|
||||
|
||||
property string userId
|
||||
|
||||
signal signBackInRequest()
|
||||
|
||||
page.footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
id: signBackButton
|
||||
text: qsTr("Sign back in")
|
||||
icon.name: "sign-back-in"
|
||||
onClicked: {
|
||||
const page = "Pages/AddAccount/AddAccount.qml"
|
||||
window.mainUI.pageLoader.show(page)
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
|
||||
CancelButton {
|
||||
text: qsTr("Close")
|
||||
onClicked: popup.close()
|
||||
}
|
||||
}
|
||||
|
||||
SummaryLabel {
|
||||
text: qsTr("Signed out from %1").arg(coloredNameHtml("", userId))
|
||||
textFormat: SummaryLabel.StyledText
|
||||
}
|
||||
|
||||
DetailsLabel {
|
||||
text: qsTr(
|
||||
"You have been disconnected from another session, " +
|
||||
"by the server for security reasons, or the access token in " +
|
||||
"your configuration file is invalid."
|
||||
)
|
||||
}
|
||||
|
||||
onOpened: signBackButton.forceActiveFocus()
|
||||
}
|
@@ -94,4 +94,8 @@ QtObject {
|
||||
function onDevicesUpdated(forAccount) {
|
||||
deviceUpdateSignal(forAccount)
|
||||
}
|
||||
|
||||
function onInvalidAccessToken(userId) {
|
||||
window.makePopup("Popups/InvalidAccessTokenPopup.qml", {userId})
|
||||
}
|
||||
}
|
||||
|
@@ -5,5 +5,7 @@ import QtQuick 2.12
|
||||
|
||||
QtObject {
|
||||
readonly property var pendingCoroutines: ({})
|
||||
readonly property var hideErrorTypes: new Set(["gaierror", "SSLError"])
|
||||
readonly property var hideErrorTypes: new Set([
|
||||
"gaierror", "SSLError", "MatrixInvalidAccessToken",
|
||||
])
|
||||
}
|
||||
|
Reference in New Issue
Block a user