diff --git a/LANCommander.Playnite.Extension/LANCommanderClient.cs b/LANCommander.Playnite.Extension/LANCommanderClient.cs index 5105445..c65d21d 100644 --- a/LANCommander.Playnite.Extension/LANCommanderClient.cs +++ b/LANCommander.Playnite.Extension/LANCommanderClient.cs @@ -70,9 +70,6 @@ namespace LANCommander.PlaynitePlugin Password = password })); - if (String.IsNullOrWhiteSpace(response.Data.AccessToken)) - throw new WebException("Invalid username or password"); - switch (response.StatusCode) { case HttpStatusCode.OK: @@ -80,6 +77,7 @@ namespace LANCommander.PlaynitePlugin case HttpStatusCode.Forbidden: case HttpStatusCode.BadRequest: + case HttpStatusCode.Unauthorized: throw new WebException("Invalid username or password"); default: diff --git a/LANCommander.Playnite.Extension/Views/Authentication.xaml.cs b/LANCommander.Playnite.Extension/Views/Authentication.xaml.cs index 2366f81..1ea4545 100644 --- a/LANCommander.Playnite.Extension/Views/Authentication.xaml.cs +++ b/LANCommander.Playnite.Extension/Views/Authentication.xaml.cs @@ -113,6 +113,12 @@ namespace LANCommander.PlaynitePlugin.Views catch (Exception ex) { Plugin.PlayniteApi.Dialogs.ShowErrorMessage(ex.Message); + + LoginButton.Dispatcher.Invoke(new System.Action(() => + { + LoginButton.IsEnabled = true; + LoginButton.Content = "Login"; + })); } } } diff --git a/LANCommander/Controllers/Api/AuthController.cs b/LANCommander/Controllers/Api/AuthController.cs index 0782fb8..4bf74a4 100644 --- a/LANCommander/Controllers/Api/AuthController.cs +++ b/LANCommander/Controllers/Api/AuthController.cs @@ -75,7 +75,7 @@ namespace LANCommander.Controllers.Api }); } - return RedirectToAction("Index", "Home"); + return Unauthorized(); } [HttpPost("Validate")]