diff --git a/assets/css/woocommerce-layout.scss b/assets/css/woocommerce-layout.scss index 57332eede05..2682e99d8f2 100644 --- a/assets/css/woocommerce-layout.scss +++ b/assets/css/woocommerce-layout.scss @@ -352,6 +352,28 @@ .form-row-wide { clear: both; } + + .password-input { + display: flex; + flex-direction: column; + justify-content: center; + position: relative; + } + + .show-password-input { + position: absolute; + right: 0.7em; + top: 0.7em; + cursor: pointer; + } + + .show-password-input::after { + @include iconafter( "\e010" ); // Icon styles and glyph + } + + .show-password-input.display-password:after { + color: #e8e8e8; + } } #payment { diff --git a/assets/js/frontend/woocommerce.js b/assets/js/frontend/woocommerce.js index c05641f8642..5891153545f 100644 --- a/assets/js/frontend/woocommerce.js +++ b/assets/js/frontend/woocommerce.js @@ -78,4 +78,19 @@ jQuery( function( $ ) { }, 1000 ); } }; + + // Show password visiblity hover icon on woocommerce forms + $( '.woocommerce form input[type="password"]' ).wrap( '' ); + $( '.password-input' ).append( '' ); + + $( '.show-password-input' ).click( + function() { + $( this ).toggleClass( 'display-password' ); + if ( $( this ).hasClass('display-password') ) { + $( this ).siblings( ['input[name="password"]', 'input[type="password"]'] ).prop('type', 'text'); + } else { + $( this ).siblings( 'input[name="password"]' ).prop('type', 'password'); + } + } + ); });