How to achieve the function of remembering passwords?

I am now in this project, the account password is saved in localStorage.

1. Log in to the interface to determine whether the user checks to remember the password. If so, after interacting with the backend to determine whether the login is successful, save the account and password entered by the user in localStorage, in the form of key-value pairs.
2. Enter the login screen again to determine whether there is an account and password field in localStorage, and enter it in the input input box if so. This is the general idea of
.

I read other people"s articles that it is not safe to encrypt the account password and save it in local Storage or cookies.

I read other articles (shell.cn/articles/5353.html" rel=" nofollow noreferrer "> https://coolshell.cn/articles.) that seem to save the user name, login sequence, login token in cookies.

what is the general method of engineering?

Mar.12,2021

encrypt the user name and password with base64, depending on how you do it (for example, you can encrypt the user name and password by base64 once and write it into a string of defined strings for base64 encryption)
base64 is just one of them depending on how you choose. This encryption still chooses reversible encryption but cannot take out the original value, for example: md5 cannot take out the original value
write the user name and password into the input box. Just decrypt the corresponding base64 (several times of encryption requires several decryptions)


remember the password itself is not safe, localStorage or cookies can be viewed directly. Generally, you don't need to remember the password, just remember your login status. If you have to use it, add it as a rule, your system security is still not guaranteed, but it will not affect other systems.


Local offline token is fine. Put it in cookies and set an expiration time

then the next time I browse the page, I find that token is logged in directly and token, and the user information is fetched.

Menu