Autocomplete turn off in login page

giriji

New Member
Hi Team,

I'm looking for a way in which I can stop users to auto complete username and password (if possible even if it is saved in browser) from login page-
{domain name}/customer/index.php/guest/index

Is it possible to do so. If yes can anyone please guide.
 
You can create a file called called app-custom.js in /customer/assets/js folder, and put this content in it:

JavaScript:
window.addEventListener('load', () => {
    if (document.querySelector('.app-customer.ctrl-guest.act-index')) {
        document.querySelectorAll('form').forEach(form => form.autocomplete = 'off');
    }
});
 
You can create a file called called app-custom.js in /customer/assets/js folder, and put this content in it:

JavaScript:
window.addEventListener('load', () => {
    if (document.querySelector('.app-customer.ctrl-guest.act-index')) {
        document.querySelectorAll('form').forEach(form => form.autocomplete = 'off');
    }
});
Thanks for your reply @twisted1919 .
Just one more question, do I need to call this app-custom.js file somewhere else??
Or simply by adding the js code file will do the magic :)
 
Just one more question, do I need to call this app-custom.js file somewhere else??
Or simply by adding the js code file will do the magic
No, just create this file with name: app-custom.js in /customer/assets/js and add that code inside.
 
Hi Team,

I have added the code and still on my customer login page autocomplete is not off....
-rw-r--r-- 1 dlfgurgaon dlfgurgaon 208 Dec 8 17:26 app-custom.js

What I want is when someone comes on my login page they need to type the username password instead of using browser saved password.


Thanks & Regards
 
Hi,
I'm using the below link -(Had removed the domain name)
URL - https://{domain name}/customer/index.php/guest/index
 
Eh, I need to see the page itsel, the actual domain. If you can't post it here, open a private support ticket.
 
Hi @twisted1919 ,

```
window.addEventListener('DOMContentLoaded', () => {
if (document.querySelector('.ctrl-guest')) {
document.querySelectorAll('form').forEach(form => form.autocomplete = 'off');
}
});
```
The above code is for older version as shared by you.

In this code, auto complete works when user doesn't have password saved in browser.
It doesn't work when user password is saved.

Also I want to know, if the below code works on latest mailwizz where saved password will also not autocomplete
```
window.addEventListener('load', () => {
if (document.querySelector('.app-customer.ctrl-guest.act-index')) {
document.querySelectorAll('form').forEach(form => form.autocomplete = 'off');
}
});
```
 
This has nothing to do with MailWizz, it depends entirely how the browser you are using treats the autocomplete attribute which we set to off.
You can go one step further and so something like

JavaScript:
window.addEventListener('DOMContentLoaded', () => {
    if (document.querySelector('.ctrl-guest')) {
        document.querySelectorAll('form').forEach(form => form.autocomplete = 'new-password');
        document.querySelectorAll('input').forEach(input => input.autocomplete = 'new-password');
    }
});
 
Back
Top