From 7be83661f9a5a479d89693d4c68fe801967c7c12 Mon Sep 17 00:00:00 2001 From: hz Date: Sat, 25 Jul 2026 09:34:44 -0500 Subject: [PATCH] Standardize password reveal to the in-field eye icon everywhere Register, reset, and Steam-linking forms used a separate "Show password" CheckButton row; the main login form already had the eye icon embedded in the field itself. Generalized _add_password_reveal (previously hardwired to a single tracked button) to support multiple fields via password_reveal_entries, and used it for every password field instead. Removed the now-unused _add_show_password. Verified all 6 password fields (login, register x2, reset x2, steam) get a working reveal button and there's no leftover "Show password" checkbox anywhere. --- scripts/ui/login_screen.gd | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/scripts/ui/login_screen.gd b/scripts/ui/login_screen.gd index 3ccb6af..80aee17 100644 --- a/scripts/ui/login_screen.gd +++ b/scripts/ui/login_screen.gd @@ -25,7 +25,7 @@ var reset_view: VBoxContainer var steam_view: VBoxContainer var login_input: LineEdit var password_input: LineEdit -var password_reveal_button: Button +var password_reveal_entries: Array[Dictionary] = [] var registration_username_input: LineEdit var registration_email_input: LineEdit var registration_password_input: LineEdit @@ -295,7 +295,8 @@ func _build_register_view() -> VBoxContainer: registration_email_input = _add_field(view, "Email", "name@example.com") registration_password_input = _add_field(view, "Password", "At least 8 characters", true) registration_confirm_input = _add_field(view, "Confirm password", "Re-enter your password", true) - _add_show_password(view, [registration_password_input, registration_confirm_input]) + _add_password_reveal(registration_password_input) + _add_password_reveal(registration_confirm_input) registration_legal_check = _add_legal_consent(view) _add_primary_button(view, "Create Account", _on_register_pressed) _add_back_button(view, "Already have an account? Sign in", "login") @@ -313,7 +314,8 @@ func _build_reset_view() -> VBoxContainer: reset_code_input.max_length = 6 reset_password_input = _add_field(reset_confirm_group, "New password", "At least 8 characters", true) reset_confirm_input = _add_field(reset_confirm_group, "Confirm new password", "Re-enter your new password", true) - _add_show_password(reset_confirm_group, [reset_password_input, reset_confirm_input]) + _add_password_reveal(reset_password_input) + _add_password_reveal(reset_confirm_input) _add_primary_button(reset_confirm_group, "Update Password", _confirm_reset) _add_back_button(view, "Back to sign in", "login") reset_confirm_group.visible = false @@ -334,7 +336,7 @@ func _build_steam_view() -> VBoxContainer: steam_username_input = _add_field(view, "Username or email", "Choose a username") steam_email_input = _add_field(view, "Email", "name@example.com") steam_password_input = _add_field(view, "Password", "At least 8 characters", true) - _add_show_password(view, [steam_password_input]) + _add_password_reveal(steam_password_input) steam_legal_check = _add_legal_consent(view) _add_primary_button(view, "Continue", _complete_steam) _add_back_button(view, "Cancel external sign in", "login") @@ -407,19 +409,9 @@ func _add_field(parent: VBoxContainer, label_text: String, placeholder: String, return input -func _add_show_password(parent: VBoxContainer, targets: Array) -> void: - var toggle := CheckButton.new() - toggle.text = "Show password" - toggle.toggled.connect(func(should_reveal: bool): - for target in targets: - target.secret = not should_reveal - ) - parent.add_child(toggle) - - func _add_password_reveal(input: LineEdit) -> void: var reveal := Button.new() - password_reveal_button = reveal + password_reveal_entries.append({"input": input, "button": reveal}) reveal.text = "" reveal.tooltip_text = "Show password" reveal.flat = true @@ -588,8 +580,8 @@ func _apply_theme() -> void: theme_button.add_theme_stylebox_override("normal", theme_normal) theme_button.add_theme_stylebox_override("hover", theme_normal) theme_button.add_theme_color_override("font_color", Brand.AMBER) - if password_reveal_button != null: - _refresh_password_reveal(password_input, password_reveal_button) + for entry in password_reveal_entries: + _refresh_password_reveal(entry["input"], entry["button"]) subheading.add_theme_color_override("font_color", Brand.muted_color(dark)) message_label.add_theme_color_override("font_color", Brand.muted_color(dark)) if brand_tagline != null: