mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Delete user preferences cookie on logout (#3379)
I think it is a good practice to remove those settings on logout. Otherwise they get persisted across multiple accounts, which might not be desired.
This commit is contained in:
@@ -605,6 +605,7 @@ namespace BTCPayServer.Controllers
|
||||
public async Task<IActionResult> Logout()
|
||||
{
|
||||
await _signInManager.SignOutAsync();
|
||||
HttpContext.DeleteUserPrefsCookie();
|
||||
_logger.LogInformation("User logged out.");
|
||||
return RedirectToAction(nameof(UIHomeController.Index), "UIHome");
|
||||
}
|
||||
|
||||
@@ -425,6 +425,11 @@ namespace BTCPayServer
|
||||
return prefCookie;
|
||||
}
|
||||
|
||||
public static void DeleteUserPrefsCookie(this HttpContext ctx)
|
||||
{
|
||||
ctx.Response.Cookies.Delete(nameof(UserPrefsCookie));
|
||||
}
|
||||
|
||||
private static void SetCurrentStoreId(this HttpContext ctx, string storeId)
|
||||
{
|
||||
var prefCookie = ctx.GetUserPrefsCookie();
|
||||
|
||||
Reference in New Issue
Block a user