about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/Index.razor
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-07-17 00:21:24 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-07-17 00:21:24 +0200
commit1beca653b772cf10586c417b2c25df03a67df8a2 (patch)
treed539b5f329cb62f253e1bc8142c3a313719657b0 /MatrixRoomUtils.Web/Pages/Index.razor
parentChanges (diff)
downloadMatrixUtils-1beca653b772cf10586c417b2c25df03a67df8a2.tar.xz
Handle external logouts
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/Index.razor')
-rw-r--r--MatrixRoomUtils.Web/Pages/Index.razor18
1 files changed, 14 insertions, 4 deletions
diff --git a/MatrixRoomUtils.Web/Pages/Index.razor b/MatrixRoomUtils.Web/Pages/Index.razor

index 16a6cee..01e2be4 100644 --- a/MatrixRoomUtils.Web/Pages/Index.razor +++ b/MatrixRoomUtils.Web/Pages/Index.razor
@@ -21,10 +21,10 @@ Small collection of tools to do not-so-everyday things. <input type="radio" name="csa" checked="@(_currentSession.AccessToken == _auth.AccessToken)" @onclick="@(()=>SwitchSession(_auth))" style="text-decoration-line: unset;"/> <b>@_user.DisplayName</b> on <b>@_auth.Homeserver</b> <a role="button" @onclick="@(() => RemoveUser(_auth))">Remove</a> - + </p> <p style="margin-top: -1.5em; margin-left: 4em;">Member of @_user.RoomCount rooms</p> - + </div> } </form> @@ -39,7 +39,17 @@ Small collection of tools to do not-so-everyday things. var tokens = await MRUStorage.GetAllTokens(); var profileTasks = tokens.Select(async token => { UserInfo userInfo = new(); - var hs = await HomeserverProvider.GetAuthenticatedWithToken(token.Homeserver, token.AccessToken); + AuthenticatedHomeServer hs; + try { + hs = await HomeserverProvider.GetAuthenticatedWithToken(token.Homeserver, token.AccessToken); + } + catch (MatrixException e) { + if (e.ErrorCode == "M_UNKNOWN_TOKEN") { + NavigationManager.NavigateTo("/InvalidSession?ctx="+token.AccessToken); + return; + } + throw; + } var roomCountTask = hs.GetJoinedRooms(); var profile = await hs.GetProfile(hs.WhoAmI.UserId); userInfo.DisplayName = profile.DisplayName ?? hs.WhoAmI.UserId; @@ -75,4 +85,4 @@ Small collection of tools to do not-so-everyday things. await MRUStorage.SetCurrentToken(auth); await OnInitializedAsync(); } -} \ No newline at end of file +}