diff --git a/CHANGELOG.md b/CHANGELOG.md index 850911d..f1aee7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.3.0] - 2026-01-08 + +### Added + +- New `[passwp_login]` shortcode for rendering a password form on public pages +- New Customize option for the password input placeholder + +### Changed + +- Unified default texts: "Enter password" placeholder and "Login" button +- Shortcode output uses common WordPress login form CSS classes + ## [1.2.2] - 2025-12-15 ### Security & Fixed diff --git a/assets/js/customize.js b/assets/js/customize.js index a57982a..071bde4 100644 --- a/assets/js/customize.js +++ b/assets/js/customize.js @@ -57,6 +57,7 @@ heading_color: '#1e1e1e', text_color: '#666666', font_family: 'system-ui, -apple-system, sans-serif', + password_placeholder: '', button_text: '', button_bg_color: '#667eea', button_text_color: '#ffffff', @@ -79,6 +80,7 @@ heading_color: '#1e1e1e', text_color: '#666666', font_family: 'system-ui, -apple-system, sans-serif', + password_placeholder: '', button_text: '', button_bg_color: '#2193b0', button_text_color: '#ffffff', @@ -101,6 +103,7 @@ heading_color: '#e5e5e5', text_color: '#a0a0a0', font_family: 'system-ui, -apple-system, sans-serif', + password_placeholder: '', button_text: '', button_bg_color: '#6366f1', button_text_color: '#ffffff', @@ -227,6 +230,7 @@ // Text fields. $('#passwp_heading_text').val(values.heading_text); + $('#passwp_password_placeholder').val(values.password_placeholder); $('#passwp_button_text').val(values.button_text); $('#passwp_footer_text').val(values.footer_text); $('#passwp_footer_link').val(values.footer_link); @@ -290,6 +294,7 @@ const headingColor = $('#passwp_heading_color').val() || '#1e1e1e'; const textColor = $('#passwp_text_color').val() || '#666666'; const fontFamily = $('#passwp_font_family').val() || 'system-ui, -apple-system, sans-serif'; + const passwordPlaceholder = $('#passwp_password_placeholder').val(); const buttonText = $('#passwp_button_text').val(); const buttonBgColor = $('#passwp_button_bg_color').val() || '#667eea'; const buttonTextColor = $('#passwp_button_text_color').val() || '#ffffff'; @@ -353,19 +358,26 @@ $preview.find('.passwp-preview-text').css('color', textColor); // Form input. - $preview.find('.passwp-preview-form input[type="password"]').css('border-radius', inputBorderRadius + 'px'); + const $passwordInput = $preview.find('.passwp-preview-form input[type="password"]'); + $passwordInput.css('border-radius', inputBorderRadius + 'px'); + if ($passwordInput.length) { + const defaultPlaceholder = $passwordInput.data('defaultPlaceholder') || $passwordInput.attr('placeholder') || ''; + $passwordInput.attr('placeholder', passwordPlaceholder || defaultPlaceholder); + } // Remember me. $preview.find('.passwp-preview-remember').toggle(showRememberMe).css('color', textColor); // Button. - $preview.find('.passwp-preview-form button').css({ + const $button = $preview.find('.passwp-preview-form button'); + $button.css({ 'background-color': buttonBgColor, 'color': buttonTextColor, 'border-radius': buttonBorderRadius + 'px' }); - if (buttonText) { - $preview.find('.passwp-preview-form button').text(buttonText); + if ($button.length) { + const defaultButtonText = $button.data('defaultText') || $button.text() || ''; + $button.text(buttonText || defaultButtonText); } // Footer. diff --git a/composer.json b/composer.json index 19c2487..42f216c 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Password protects all pages and posts except the front page", "type": "wordpress-plugin", "license": "GPL-2.0+", - "version": "1.2.2", + "version": "1.3.0", "require": { "php": ">=8.3", "yahnis-elsts/plugin-update-checker": "^5.6" diff --git a/includes/AdminSettings.php b/includes/AdminSettings.php index 1e3340b..1b4b228 100644 --- a/includes/AdminSettings.php +++ b/includes/AdminSettings.php @@ -49,6 +49,7 @@ final class AdminSettings { 'heading_color' => '#1a1a2e', 'text_color' => '#4a5568', 'font_family' => 'system-ui, -apple-system, sans-serif', + 'password_placeholder' => '', 'button_text' => '', 'button_bg_color' => '#667eea', 'button_text_color' => '#ffffff', @@ -605,6 +606,18 @@ class="passwp-range-value">
++ +
+' . esc_html( $error_message ) . '
'; + } + $html .= ''; + $html .= '