welcome now puts credentials instead of generating

This commit is contained in:
Elia Zammuto
2021-07-30 16:06:59 +02:00
parent 28fecbc50c
commit 7f643345ce
6 changed files with 83 additions and 84 deletions
+4 -18
View File
@@ -54,15 +54,11 @@ int init() {
return -1;
}
}
if(!user_creds_exist(config::sunshine.credentials_file)) {
if(save_user_creds(config::sunshine.credentials_file, "sunshine"s, crypto::rand_alphabet(16), true)) {
return -1;
}
if(user_creds_exist(config::sunshine.credentials_file)) {
if(reload_user_creds(config::sunshine.credentials_file)) return -1;
} else {
BOOST_LOG(info) << "Open the Web UI to set your new username and password and getting started";
}
if(reload_user_creds(config::sunshine.credentials_file)) {
return -1;
}
return 0;
}
@@ -92,16 +88,6 @@ int save_user_creds(const std::string &file, const std::string &username, const
}
BOOST_LOG(info) << "New credentials have been created"sv;
if(run_our_mouth) {
//BOOST_LOG(info) << "Username: "sv << username;
//BOOST_LOG(info) << "Password: "sv << password;
BOOST_LOG(info) << "Open the Web UI to see your new username and password";
//Save these two in memory to show user and password the first time Sunshine is started
config::sunshine.showCredentials = true;
config::sunshine.plainPassword = password;
}
return 0;
}