Basically, you would need to use a cookie.
People explained the technique in many places. For example:
Want to find other code samples? See http://bit.ly/YAUv8o
My concern is different: you should warn the user about the danger of storing log on information in a cookie on a local computer. If you use proper authentication, you never store any passwords anywhere (you can store cryptographic hash functions of passwords, but it makes cryptographically infeasible
to restore the original password). Storing the password on local computer creates sensitive data which can be captures if a client computer is stolen or cracked in some way. So, this decision should be optional; and the user should be warned, to be aware and careful about such things. Such solution should never be a default.