Your problem is that you are trying to cache what should be kept secret. Caching password information is not secure and is a risk.
However, it makes sense to cache the shared html parts of the page with a password. Everything that any user registered in the system can see is in order. Only confidential information, such as username, address, phone number, etc., is confidential.
If you make a separate JSON call to retrieve the data, the information will be easy, but still safe, because it is not cached in the system, but also not complemented by html formatting, etc.
There may also be intelligence on the page to display a log call, if a user session was interrupted for any reason, he repeats and continues from where he left off, while maintaining the return button.
I also think that if any confidential information is stored in the history, for example id, actions, etc., this can be a problem.
Just a few things to consider.
source share