[Libreoffice-commits] online.git: tools/Config.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 13 13:46:54 UTC 2018
tools/Config.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
New commits:
commit 96760c5e4312e924cbce550bced14384dfce940b
Author: Andras Timar <andras.timar at collabora.com>
AuthorDate: Tue Nov 13 14:32:37 2018 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Nov 13 14:32:37 2018 +0100
ask for username (default to 'admin' if nothing set) with 'loolconfig set-admin-password'
Change-Id: I04bf3d225e4149ed69bc55e14d1ced1dd3f8f7ea
diff --git a/tools/Config.cpp b/tools/Config.cpp
index cb35a6fde..0e2505283 100644
--- a/tools/Config.cpp
+++ b/tools/Config.cpp
@@ -209,6 +209,15 @@ int Config::main(const std::vector<std::string>& args)
RAND_bytes(salt, _adminConfig.pwdSaltLength);
std::stringstream stream;
+ // Ask for admin username
+ std::string adminUser;
+ std::cout << "Enter admin username [admin]: ";
+ std::getline(std::cin, adminUser);
+ if (adminUser.empty())
+ {
+ adminUser = "admin";
+ }
+
// Ask for user password
termios oldTermios;
tcgetattr(STDIN_FILENO, &oldTermios);
@@ -255,6 +264,7 @@ int Config::main(const std::vector<std::string>& args)
std::stringstream pwdConfigValue("pbkdf2.sha512.", std::ios_base::in | std::ios_base::out | std::ios_base::ate);
pwdConfigValue << std::to_string(_adminConfig.pwdIterations) << ".";
pwdConfigValue << saltHash << "." << passwordHash;
+ _loolConfig.setString("admin_console.username", adminUser);
_loolConfig.setString("admin_console.secure_password[@desc]",
"Salt and password hash combination generated using PBKDF2 with SHA512 digest.");
_loolConfig.setString("admin_console.secure_password", pwdConfigValue.str());
More information about the Libreoffice-commits
mailing list