Skip to content

Commit

Permalink
Mask wifi password in settings app
Browse files Browse the repository at this point in the history
  • Loading branch information
jake-walker authored and npentrel committed Jun 9, 2024
1 parent ae34919 commit d6544ef
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion modules/firmware_apps/settings_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ def string_formatter(value):
return str(value)


def masked_string_formatter(value):
if value is None:
return "Default"
else:
return "*" * 8


def pct_formatter(value):
if value is None:
return "Default"
Expand Down Expand Up @@ -41,6 +48,10 @@ async def string_editor(self, label, id, render_update):
self.dialog = TextDialog(label, self)
self.dialog._settings_id = id

async def masked_string_editor(self, label, id, render_update):
self.dialog = TextDialog(label, self, masked=True)
self.dialog._settings_id = id

async def _button_handler(self, event):
if not self.overlays:
layout_handled = await self.layout.button_event(event)
Expand Down Expand Up @@ -168,7 +179,12 @@ def settings_options(self):
None,
),
("wifi_ssid", "WiFi SSID", string_formatter, self.string_editor),
("wifi_password", "WiFi password", string_formatter, self.string_editor),
(
"wifi_password",
"WiFi password",
masked_string_formatter,
self.masked_string_editor,
),
(
"wifi_wpa2ent_username",
"WPA2 Enterprise Username",
Expand Down

0 comments on commit d6544ef

Please sign in to comment.