about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/UserImportPage.razor
diff options
context:
space:
mode:
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)