Skip to content

Commit ff7993d

Browse files
committed
cleanup
1 parent 6331bd4 commit ff7993d

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

cli/src/cli.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ int main()
1919
while (isRunning)
2020
{
2121
pwdGen.SetPolicy(policy);
22-
std::cout << "0. Exit 1. Set length\n2. Set use lowercase\n3. Set use uppercase\n4. Set use numbers"
23-
"\n5. Set use symbols\n6. Generate password\n7. Hash password\n\n\nEnter your choice: " << std::flush;
22+
std::cout << "0. Exit\n1. Set length\n2. Set use lowercase\n3. Set use uppercase\n4. Set use numbers"
23+
"\n5. Set use symbols\n6. Generate password\n7. Hash password\n\nEnter your choice: " << std::flush;
2424

2525
int choice = 0;
2626
std::cin >> choice;

gui/src/main.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class MyFrame : public wxFrame
7878
// horizontal sizer holding the slider and label
7979
wxBoxSizer* sliderSizer = new wxBoxSizer(wxHORIZONTAL);
8080

81-
passwordLenText = new wxTextCtrl(panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(100, 25));
81+
passwordLenText = new wxTextCtrl(panel, wxID_ANY, "10", wxDefaultPosition, wxSize(100, 25));
8282
passwordLenText->SetForegroundColour(lightText);
8383
passwordLenText->SetBackgroundColour(darkControlBg);
8484
sliderSizer->Add(passwordLenText, 0, wxALL, 5);
@@ -97,6 +97,7 @@ class MyFrame : public wxFrame
9797

9898
// Create the text field.
9999
wxTextCtrl* excludedCharsTextCtrl = new wxTextCtrl(panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(100, 25));
100+
excludedCharsTextCtrl->SetFocus();
100101
excludedCharsTextCtrl->SetBackgroundColour(darkControlBg);
101102
excludedCharsTextCtrl->SetForegroundColour(lightText);
102103

@@ -141,9 +142,8 @@ class MyFrame : public wxFrame
141142
generateBtn->SetForegroundColour(lightText);
142143
generateSizer->Add(generateBtn, 0, wxALL, 5);
143144

144-
// Read-only text field for the generated password. passwordText is a member
145-
passwordText = new wxTextCtrl(panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(250, 25),
146-
wxTE_READONLY);
145+
// text field for the generated password. passwordText is a member
146+
passwordText = new wxTextCtrl(panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(250, 25));
147147
passwordText->SetBackgroundColour(darkControlBg);
148148
passwordText->SetForegroundColour(lightText);
149149
generateSizer->Add(passwordText, 0, wxALL, 5);
@@ -303,6 +303,13 @@ class MyFrame : public wxFrame
303303

304304
saveBtn->Bind(wxEVT_BUTTON, [&](wxCommandEvent& event)
305305
{
306+
if (hashText->GetValue().empty())
307+
{
308+
std::cerr << "Hash text is empty!" << std::endl;
309+
wxLogError("Hash text is empty!");
310+
return;
311+
}
312+
306313
try
307314
{
308315
SQLite::Statement insertQuery(db, "INSERT INTO passwords (hash) VALUES (?)");

0 commit comments

Comments
 (0)