diff --git a/assets/css/frontend-forms.css b/assets/css/frontend-forms.css index 036a963a1..939430a02 100644 --- a/assets/css/frontend-forms.css +++ b/assets/css/frontend-forms.css @@ -1833,3 +1833,9 @@ body .wpuf-attachment-upload-filelist + .moxie-shim { .iti--allow-dropdown input[type="text"] { padding-left: 52px !important; } +img.wpuf-eye { + position: absolute; + right: 5%; + top: 50%; + transform: translateY(-50%) translateX(-6%); +} diff --git a/assets/js/frontend-form.js b/assets/js/frontend-form.js index 94304b736..88b97d3ad 100644 --- a/assets/js/frontend-form.js +++ b/assets/js/frontend-form.js @@ -1492,4 +1492,19 @@ // Set name attribute for google map search field $(".wpuf-form-add #wpuf-map-add-location").attr("name", "find_address"); }); + + $(function($) { + // eye icon for password field + $(document).on('click', '.wpuf-eye', function () { + const input = $( this ).siblings( 'input' ); + + if ( input.attr("type") === "password" ) { + input.attr( "type", "text" ); + $( this ).attr( "src", wpuf_frontend.pro_asset_url + '/images/eye-close.svg' ); + } else { + input.attr( "type", "password" ); + $( this ).attr( "src", wpuf_frontend.pro_asset_url + '/images/eye.svg' ); + } + }); + }); })(jQuery, window); diff --git a/assets/less/frontend-forms.less b/assets/less/frontend-forms.less index 4711939cb..1b72b1963 100644 --- a/assets/less/frontend-forms.less +++ b/assets/less/frontend-forms.less @@ -2121,3 +2121,10 @@ ul.wpuf-form{ .iti--allow-dropdown input[type="text"] { padding-left: 52px !important; } + +img.wpuf-eye { + position: absolute; + right: 5%; + top: 50%; + transform: translateY(-50%) translateX(-6%); +} diff --git a/includes/Frontend.php b/includes/Frontend.php index 1d27c19aa..803304231 100644 --- a/includes/Frontend.php +++ b/includes/Frontend.php @@ -99,44 +99,46 @@ public function enqueue_scripts() { ], ] ); - wp_localize_script( - 'wpuf-frontend-form', 'wpuf_frontend', [ - 'ajaxurl' => admin_url( 'admin-ajax.php' ), - 'error_message' => __( 'Please fix the errors to proceed', 'wp-user-frontend' ), - 'nonce' => wp_create_nonce( 'wpuf_nonce' ), - 'word_limit' => __( 'Word limit reached', 'wp-user-frontend' ), - 'cancelSubMsg' => __( - 'Are you sure you want to cancel your current subscription ?', 'wp-user-frontend' - ), - 'delete_it' => __( 'Yes', 'wp-user-frontend' ), - 'cancel_it' => __( 'No', 'wp-user-frontend' ), - 'word_max_title' => __( - 'Maximum word limit reached. Please shorten your texts.', 'wp-user-frontend' - ), - 'word_max_details' => __( - 'This field supports a maximum of %number% words, and the limit is reached. Remove a few words to reach the acceptable limit of the field.', - 'wp-user-frontend' - ), - 'word_min_title' => __( 'Minimum word required.', 'wp-user-frontend' ), - 'word_min_details' => __( - 'This field requires minimum %number% words. Please add some more text.', 'wp-user-frontend' - ), - 'char_max_title' => __( - 'Maximum character limit reached. Please shorten your texts.', 'wp-user-frontend' - ), - 'char_max_details' => __( - 'This field supports a maximum of %number% characters, and the limit is reached. Remove a few characters to reach the acceptable limit of the field.', - 'wp-user-frontend' - ), - 'char_min_title' => __( 'Minimum character required.', 'wp-user-frontend' ), - 'char_min_details' => __( - 'This field requires minimum %number% characters. Please add some more character.', - 'wp-user-frontend' - ), - 'protected_shortcodes' => wpuf_get_protected_shortcodes(), - 'protected_shortcodes_message' => __( 'Using %shortcode% is restricted', 'wp-user-frontend' ), - ] + 'wpuf-frontend-form', 'wpuf_frontend', apply_filters( + 'wpuf_frontend_object', [ + 'asset_url' => WPUF_ASSET_URI, + 'ajaxurl' => admin_url( 'admin-ajax.php' ), + 'error_message' => __( 'Please fix the errors to proceed', 'wp-user-frontend' ), + 'nonce' => wp_create_nonce( 'wpuf_nonce' ), + 'word_limit' => __( 'Word limit reached', 'wp-user-frontend' ), + 'cancelSubMsg' => __( + 'Are you sure you want to cancel your current subscription ?', 'wp-user-frontend' + ), + 'delete_it' => __( 'Yes', 'wp-user-frontend' ), + 'cancel_it' => __( 'No', 'wp-user-frontend' ), + 'word_max_title' => __( + 'Maximum word limit reached. Please shorten your texts.', 'wp-user-frontend' + ), + 'word_max_details' => __( + 'This field supports a maximum of %number% words, and the limit is reached. Remove a few words to reach the acceptable limit of the field.', + 'wp-user-frontend' + ), + 'word_min_title' => __( 'Minimum word required.', 'wp-user-frontend' ), + 'word_min_details' => __( + 'This field requires minimum %number% words. Please add some more text.', 'wp-user-frontend' + ), + 'char_max_title' => __( + 'Maximum character limit reached. Please shorten your texts.', 'wp-user-frontend' + ), + 'char_max_details' => __( + 'This field supports a maximum of %number% characters, and the limit is reached. Remove a few characters to reach the acceptable limit of the field.', + 'wp-user-frontend' + ), + 'char_min_title' => __( 'Minimum character required.', 'wp-user-frontend' ), + 'char_min_details' => __( + 'This field requires minimum %number% characters. Please add some more character.', + 'wp-user-frontend' + ), + 'protected_shortcodes' => wpuf_get_protected_shortcodes(), + 'protected_shortcodes_message' => __( 'Using %shortcode% is restricted', 'wp-user-frontend' ), + ] + ) ); wp_localize_script( diff --git a/templates/reset-pass-form.php b/templates/reset-pass-form.php index 506e8f95e..4aba1f364 100644 --- a/templates/reset-pass-form.php +++ b/templates/reset-pass-form.php @@ -7,13 +7,19 @@ ?>