Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mask wifi password in settings app #115

Merged
merged 1 commit into from
Jun 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading