Sign Out Should Delete Stored Credential
This commit is contained in:
parent
4361a69506
commit
f1648a12c2
@ -20,6 +20,14 @@ namespace QtCNETAPI.Services
|
|||||||
CredentialManager.WriteCredential(applicationName, username, accessToken, $"Access Token For User {username} On QtC.NET", CredentialPersistence.LocalMachine);
|
CredentialManager.WriteCredential(applicationName, username, accessToken, $"Access Token For User {username} On QtC.NET", CredentialPersistence.LocalMachine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteAccessToken()
|
||||||
|
{
|
||||||
|
string applicationName = "QtC.NET";
|
||||||
|
if (System.Diagnostics.Debugger.IsAttached) applicationName = "QtC.NET.Development";
|
||||||
|
|
||||||
|
CredentialManager.DeleteCredential(applicationName);
|
||||||
|
}
|
||||||
|
|
||||||
public string? GetAccessToken()
|
public string? GetAccessToken()
|
||||||
{
|
{
|
||||||
string applicationName = "QtC.NET";
|
string applicationName = "QtC.NET";
|
||||||
|
|||||||
@ -22,6 +22,7 @@ namespace qtc_net_client_2
|
|||||||
private ServerConfig _serverConfig;
|
private ServerConfig _serverConfig;
|
||||||
private AudioService AudioService = new();
|
private AudioService AudioService = new();
|
||||||
private ImageFactory _imgFactory = new();
|
private ImageFactory _imgFactory = new();
|
||||||
|
private CredentialService _credService = new();
|
||||||
private LoggingService LoggingService;
|
private LoggingService LoggingService;
|
||||||
|
|
||||||
public List<Room> RoomList = [];
|
public List<Room> RoomList = [];
|
||||||
@ -162,7 +163,7 @@ namespace qtc_net_client_2
|
|||||||
{
|
{
|
||||||
if (MessageBox.Show("Are You Sure You Want To Sign Out?\nThis Deletes Your session.token, Requiring You To Sign In Again", "are you sure...?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
if (MessageBox.Show("Are You Sure You Want To Sign Out?\nThis Deletes Your session.token, Requiring You To Sign In Again", "are you sure...?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
File.Delete("./session.token");
|
_credService.DeleteAccessToken();
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user