small fix and an explanation of the password remembering function...

...in the preferences
This commit is contained in:
Thomas Baumhauer 2009-01-14 15:21:24 +00:00
parent d4ae8a322b
commit 44a43e7068
2 changed files with 9 additions and 5 deletions

View file

@ -371,11 +371,7 @@ bool remember_password()
void set_remember_password(bool remember)
{
preferences::set("remember_password", remember ? "yes" : "no");
// Clear the password
if(!remember) {
preferences::set("password", "");
}
preferences::set("password", remember ? prv::password : "");
}
bool turn_dialog()

View file

@ -73,6 +73,14 @@ namespace preferences {
std::string login();
void set_login(const std::string& username);
// If password remembering is turned off use
// prv::password instead. This way we will not
// have to worry about whether to remember the
// password or not anywhere else in the code.
//
// It is put into a separate namespace to make clear
// it is "private" and not supposed to be edit outside
// of the preferences functions.
namespace prv {
extern std::string password;
}