Skip to content

Commit

Permalink
Add "Show password" button, add info to auth options
Browse files Browse the repository at this point in the history
* "Show password" button toggles hiding the entered text by
  replacing the letters with "*".

* Add info about security to the authentication options
  "Open" and "WEP".

  When building the package, the flag "CONFIG_WEP=y" should be set,
  to manually enable WEP. We now explicitly say WEP is insecure, so
  if the user is determined to use it anyway, we shouldn't stand in
  their way.

* Updated en.catkeys
  • Loading branch information
humdingerb authored and waddlesplash committed May 10, 2024
1 parent e952d30 commit c5c7572
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 13 deletions.
43 changes: 37 additions & 6 deletions wpa_supplicant/wpa_gui-haiku/WirelessConfigDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

static const uint32 kMessageCancel = 'btcl';
static const uint32 kMessageOk = 'btok';
static const uint32 kMessageShowPass = 'btsh';


class WirelessConfigView : public BView {
Expand Down Expand Up @@ -65,16 +66,15 @@ class WirelessConfigView : public BView {

int32 row = 0;
layout->AddItem(fNetworkName->CreateLabelLayoutItem(), 0, row);
layout->AddItem(fNetworkName->CreateTextViewLayoutItem(), 1, row++);
layout->AddItem(fNetworkName->CreateTextViewLayoutItem(), 1, row++, 2, 1);

BPopUpMenu* authMenu = new(std::nothrow) BPopUpMenu("authMode");
if (authMenu == NULL)
return;

fAuthOpen = new(std::nothrow) BMenuItem(
B_TRANSLATE_COMMENT("Open", "Open network"), NULL);
fAuthOpen = new(std::nothrow) BMenuItem(B_TRANSLATE("Open ‒ no encryption"), NULL);
authMenu->AddItem(fAuthOpen);
fAuthWEP = new(std::nothrow) BMenuItem(B_TRANSLATE("WEP"), NULL);
fAuthWEP = new(std::nothrow) BMenuItem(B_TRANSLATE("WEP ‒ insecure encryption"), NULL);
authMenu->AddItem(fAuthWEP);
fAuthWPA = new(std::nothrow) BMenuItem(B_TRANSLATE("WPA/WPA2"), NULL);
authMenu->AddItem(fAuthWPA);
Expand All @@ -85,7 +85,7 @@ class WirelessConfigView : public BView {
return;

layout->AddItem(authMenuField->CreateLabelLayoutItem(), 0, row);
layout->AddItem(authMenuField->CreateMenuBarLayoutItem(), 1, row++);
layout->AddItem(authMenuField->CreateMenuBarLayoutItem(), 1, row++, 2, 1);

fPassword = new(std::nothrow) BTextControl(B_TRANSLATE("Password:"),
"", NULL);
Expand All @@ -99,7 +99,14 @@ class WirelessConfigView : public BView {
B_SIZE_UNSET));

layout->AddItem(fPassword->CreateLabelLayoutItem(), 0, row);
layout->AddItem(layoutItem, 1, row++);
layout->AddItem(layoutItem, 1, row);

fShowPassButton = new(std::nothrow) BButton("👁", new BMessage(kMessageShowPass));
fShowPassButton->SetToolTip(B_TRANSLATE("Show password"));
fShowPassButton->SetBehavior(BButton::B_TOGGLE_BEHAVIOR);
const float height = fPassword->Bounds().Height();
fShowPassButton->SetExplicitSize(BSize(height, height));
layout->AddView(fShowPassButton, 2, row++);

fPersist = new(std::nothrow) BCheckBox(B_TRANSLATE("Store this configuration"));
layout->AddItem(BSpaceLayoutItem::CreateGlue(), 0, row);
Expand All @@ -126,12 +133,35 @@ class WirelessConfigView : public BView {
virtual void
AttachedToWindow()
{
fShowPassButton->SetTarget(this);
fCancelButton->SetTarget(Window());
fOkButton->SetTarget(Window());
fOkButton->MakeDefault(true);
fPassword->MakeFocus(true);
}

virtual void
MessageReceived(BMessage* message)
{
switch (message->what) {
case kMessageShowPass:
bool state = fShowPassButton->Value() == B_CONTROL_OFF;

BString temp(fPassword->Text()); // HideTyping() will clear the text
fPassword->TextView()->HideTyping(state);
fPassword->SetText(temp);
temp = "";

if (state)
fShowPassButton->SetToolTip(B_TRANSLATE("Show password"));
else
fShowPassButton->SetToolTip(B_TRANSLATE("Hide password"));
return;
}

BView::MessageReceived(message);
}

void
SetUp(const BMessage& message)
{
Expand Down Expand Up @@ -200,6 +230,7 @@ class WirelessConfigView : public BView {
BCheckBox* fPersist;
BButton* fCancelButton;
BButton* fOkButton;
BButton* fShowPassButton;
};


Expand Down
16 changes: 9 additions & 7 deletions wpa_supplicant/wpa_gui-haiku/locales/en.catkeys
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
1 English application/x-vnd.malinen-wpa_supplicant 4272080571
1 English application/x-vnd.malinen-wpa_supplicant 2596284191
Password: wpa_supplicant Password:
Store this configuration wpa_supplicant Store this configuration
WEP ‒ insecure encryption wpa_supplicant WEP ‒ insecure encryption
Cancel wpa_supplicant Cancel
OK wpa_supplicant OK
Show password wpa_supplicant Show password
Open ‒ no encryption wpa_supplicant Open ‒ no encryption
Authentication: wpa_supplicant Authentication:
Failed to join network. (Incorrect password?) wpa_supplicant Failed to join network. (Incorrect password?)
Store this configuration wpa_supplicant Store this configuration
Password: wpa_supplicant Password:
WPA/WPA2 wpa_supplicant WPA/WPA2
Connect to a WiFi network wpa_supplicant Connect to a WiFi network
Password format invalid! wpa_supplicant Password format invalid!
WEP wpa_supplicant WEP
Hide password wpa_supplicant Hide password
Network name: wpa_supplicant Network name:
OK wpa_supplicant OK
Cancel wpa_supplicant Cancel
Open wpa_supplicant Open network Open

0 comments on commit c5c7572

Please sign in to comment.