about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/UserImportPage.razor
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-03 18:40:53 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-03 18:40:53 +0200
commit3d3edeae16252a311704b390cfad6faa435a8b84 (patch)
tree34974194435fbe9789de5140ef9a9c0ddb834c74 /MatrixRoomUtils.Web/Pages/UserImportPage.razor
parentAdd policy room discovery ,add room state viewer (diff)
downloadMatrixUtils-3d3edeae16252a311704b390cfad6faa435a8b84.tar.xz
Refactor
Diffstat (limited to 'MatrixRoomUtils.Web/Pages/UserImportPage.razor')
-rw-r--r--MatrixRoomUtils.Web/Pages/UserImportPage.razor14
1 files changed, 6 insertions, 8 deletions
diff --git a/MatrixRoomUtils.Web/Pages/UserImportPage.razor b/MatrixRoomUtils.Web/Pages/UserImportPage.razor
index ca0a213..612b3ce 100644
--- a/MatrixRoomUtils.Web/Pages/UserImportPage.razor
+++ b/MatrixRoomUtils.Web/Pages/UserImportPage.razor
@@ -15,7 +15,7 @@
 <table border="1">
     @foreach (var (homeserver, username, password) in records)
     {
-        <tr style="background-color: @(RuntimeStorage.UsersCache.Any(x => x.Value.LoginResponse.UserId == $"@{username}:{homeserver}") ? "green" : "unset")">
+        <tr style="background-color: @(LocalStorageWrapper.LoginSessions.Any(x => x.Value.LoginResponse.UserId == $"@{username}:{homeserver}") ? "green" : "unset")">
             <td style="border-width: 1px;">@username</td>
             <td style="border-width: 1px;">@homeserver</td>
             <td style="border-width: 1px;">@password.Length chars</td>
@@ -33,23 +33,21 @@
     {
         foreach (var (homeserver, username, password) in records)
         {
-            if(RuntimeStorage.UsersCache.Any(x => x.Value.LoginResponse.UserId == $"@{username}:{homeserver}")) continue;
-            var result = await MatrixAccount.Login(homeserver, username, password);
+            if(LocalStorageWrapper.LoginSessions.Any(x => x.Value.LoginResponse.UserId == $"@{username}:{homeserver}")) continue;
+            var result = await MatrixAuth.Login(homeserver, username, password);
             Console.WriteLine($"Obtained access token for {result.UserId}!");
 
-            RuntimeStorage.AccessToken = result.AccessToken;
-
             var userinfo = new UserInfo()
             {
                 LoginResponse = result
             };
-            userinfo.Profile = await MatrixAccount.GetProfile(result.HomeServer, result.UserId);
+            userinfo.Profile = await MatrixAuth.GetProfile(result.HomeServer, result.UserId);
 
-            RuntimeStorage.UsersCache.Add(result.AccessToken, userinfo);
+            LocalStorageWrapper.LoginSessions.Add(result.AccessToken, userinfo);
             StateHasChanged();
         }
         
-        await RuntimeStorage.SaveToLocalStorage(LocalStorage);
+        await LocalStorageWrapper.SaveToLocalStorage(LocalStorage);
     }
 
     private async Task FileChanged(InputFileChangeEventArgs obj)