From 396bdb1ebafaf88ec1c72d89b174d3d1c2f23352 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 7 Sep 2014 16:30:44 +0200 Subject: [PATCH] Utils: improve password prompt Check if the password is empty before asking to confirm it. --- src/Utils.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index 57c1486a..580a725a 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -156,13 +156,15 @@ CString CUtils::GetSaltedHashPass(CString& sSalt) { sSalt = GetSalt(); while (true) { - CString pass1 = CUtils::GetPass("Enter password"); + CString pass1; + do { + pass1 = CUtils::GetPass("Enter password"); + } while (pass1.empty()); + CString pass2 = CUtils::GetPass("Confirm password"); if (!pass1.Equals(pass2, true)) { CUtils::PrintError("The supplied passwords did not match"); - } else if (pass1.empty()) { - CUtils::PrintError("You can not use an empty password"); } else { // Construct the salted pass return SaltedSHA256Hash(pass1, sSalt);