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:
d11n
2022-02-01 02:42:31 +01:00
committed by GitHub
parent faef6d82ff
commit ff9a1a1f55
2 changed files with 6 additions and 0 deletions

View File

@@ -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");
}

View File

@@ -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();