From f23d2cb74d87c2b266dd19208b12c395817bc0bc Mon Sep 17 00:00:00 2001 From: Fred Date: Fri, 10 Feb 2023 12:39:26 -0500 Subject: [PATCH] Add logout button --- src/PuppetMaster.Client.UI/PuppetMaster.Client.UI.csproj | 2 +- .../ViewModels/UpdateUserViewModel.cs | 9 +++++++++ src/PuppetMaster.Client.UI/Views/UpdateUserView.xaml | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/PuppetMaster.Client.UI/PuppetMaster.Client.UI.csproj b/src/PuppetMaster.Client.UI/PuppetMaster.Client.UI.csproj index 44259bd..6b1c280 100644 --- a/src/PuppetMaster.Client.UI/PuppetMaster.Client.UI.csproj +++ b/src/PuppetMaster.Client.UI/PuppetMaster.Client.UI.csproj @@ -4,7 +4,7 @@ WinExe net7.0-windows win-x86 - 1.0.1 + 1.0.2 ../../stylecop.ruleset enable true diff --git a/src/PuppetMaster.Client.UI/ViewModels/UpdateUserViewModel.cs b/src/PuppetMaster.Client.UI/ViewModels/UpdateUserViewModel.cs index ef41381..dbf9d3a 100644 --- a/src/PuppetMaster.Client.UI/ViewModels/UpdateUserViewModel.cs +++ b/src/PuppetMaster.Client.UI/ViewModels/UpdateUserViewModel.cs @@ -1,8 +1,10 @@ using System.ComponentModel.DataAnnotations; using System.Threading; using System.Threading.Tasks; +using System.Windows; using PuppetMaster.Client.UI.Facades; using PuppetMaster.Client.UI.Models.Requests; +using PuppetMaster.Client.UI.Properties; namespace PuppetMaster.Client.UI.ViewModels { @@ -72,6 +74,13 @@ public string? LastName public bool CanUpdateUser => !HasErrors && !IsLoading; + public void Logout() + { + Settings.Default.BackendTokenResponse = null; + Settings.Default.Save(); + Application.Current.Shutdown(); + } + public async Task UpdateUser() { SuccessMessage = null; diff --git a/src/PuppetMaster.Client.UI/Views/UpdateUserView.xaml b/src/PuppetMaster.Client.UI/Views/UpdateUserView.xaml index bf06e7b..157a21c 100644 --- a/src/PuppetMaster.Client.UI/Views/UpdateUserView.xaml +++ b/src/PuppetMaster.Client.UI/Views/UpdateUserView.xaml @@ -29,6 +29,7 @@ + +