[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - tools/Config.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 29 12:06:59 UTC 2018


 tools/Config.cpp |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 40cf25a8a33c55e089b53794efc170c831c18fe2
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: Thu Nov 29 13:06:41 2018 +0100

    ask for username (default to 'admin' if nothing set) with 'loolconfig set-admin-password'
    
    Change-Id: I04bf3d225e4149ed69bc55e14d1ced1dd3f8f7ea
    (cherry picked from commit 96760c5e4312e924cbce550bced14384dfce940b)
    Reviewed-on: https://gerrit.libreoffice.org/63330
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/tools/Config.cpp b/tools/Config.cpp
index 6134e0e94..6a147e01b 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