View Password button

Solved

View Password button

UncleGym
Excursionist
16 0 6

Hi all, 

 

I want to have a 'View Password' button on my login page https://unclegym.co.uk/account/login

 

Using Crave theme, so .json files.

 

Any help would be greatly appreciated, thank you! 

Accepted Solution (1)

Sweans
Shopify Partner
429 89 129

This is an accepted solution.

Hi @UncleGym ,

To add the "View Password" feature to your login page, some coding knowledge is required.

 

Please follow these steps:

 

1. In your Shopify admin, navigate to "Online Store" under Sales Channels. Click the three dots next to the theme you wish to edit, then select "Edit Code".

 

2. Locate the `main-login.liquid` file in the 'Sections' folder on the right.

Find the password input field as shown in the screenshot.

image_2024_07_16T08_49_21_106Z.png

 

3. Add the following `<a>` tag where you want the option to show or hide the password:

 

<a onclick="togglePassword()">Show/Hide</a>

 

4. Finally, include this script in the same file within a `<script>` tag:

 

<script>
  function togglePassword() 
  { 
    const passwordField = document.getElementById('CustomerPassword');
    if(passwordField.type === 'password')
     {
       passwordField.type = 'text' ;
     }
     else
     {
       passwordField.type = 'password'; 
     }
    }
 </script> 

 

 

Please refer to the screenshot for more details.

 

image_2024_07_16T08_49_57_539Z.png

 

If you need further assistance, feel free to ask

Thank you,
Sweans

- Was my reply helpful? Please Like and Accept the Solution or let me know by Buying me coffee!
- Want to modify or custom changes on store Hire me.
- Feel free to contact me at info@sweans.com regarding any help.
- To know more about me check out www.sweans.com

View solution in original post

Replies 2 (2)

Sweans
Shopify Partner
429 89 129

This is an accepted solution.

Hi @UncleGym ,

To add the "View Password" feature to your login page, some coding knowledge is required.

 

Please follow these steps:

 

1. In your Shopify admin, navigate to "Online Store" under Sales Channels. Click the three dots next to the theme you wish to edit, then select "Edit Code".

 

2. Locate the `main-login.liquid` file in the 'Sections' folder on the right.

Find the password input field as shown in the screenshot.

image_2024_07_16T08_49_21_106Z.png

 

3. Add the following `<a>` tag where you want the option to show or hide the password:

 

<a onclick="togglePassword()">Show/Hide</a>

 

4. Finally, include this script in the same file within a `<script>` tag:

 

<script>
  function togglePassword() 
  { 
    const passwordField = document.getElementById('CustomerPassword');
    if(passwordField.type === 'password')
     {
       passwordField.type = 'text' ;
     }
     else
     {
       passwordField.type = 'password'; 
     }
    }
 </script> 

 

 

Please refer to the screenshot for more details.

 

image_2024_07_16T08_49_57_539Z.png

 

If you need further assistance, feel free to ask

Thank you,
Sweans

- Was my reply helpful? Please Like and Accept the Solution or let me know by Buying me coffee!
- Want to modify or custom changes on store Hire me.
- Feel free to contact me at info@sweans.com regarding any help.
- To know more about me check out www.sweans.com

UncleGym
Excursionist
16 0 6

Thank you so much!