When closing the browser tab, users can log out automatically, instead of closing the browser to log out

Problem Description: when closing the browser tab, users can log out automatically, instead of closing the browser to log out
Parameters have been set, but only the browser can be completely closed to log off the user. When the tab is closed, the user cannot be logged off. When the tab is opened again under the browser, the login state is still maintained, so the security performance is not guaranteed

Age of cookie, in seconds (default: 2 weeks).

SESSION_ COOKIE_ AGE = 60 * 60 * 24 * 7 * 2

Whether a user’s session cookie expires when the Web browser is closed.

SESSION_ EXPIRE_ AT_ BROWSER_ CLOSE = True

Whether to save the session data on every request. Default is False

SESSION_ SAVE_ EVERY_ REQUEST = True