Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lucy 3 posts 73 karma points
    Jun 30, 2024 @ 11:45
    Lucy
    0

    Disable auto-fill of passwords for Clients

    Is there a way of preventing auto-fill of username/password on client browsers? Website has two different account types – one for teachers, one for students. Browsers autofill teacher logins on student area – doesn't let them log in – but causes confusion. I want to prevent browsers doing this.

  • Huw Reddick 1920 posts 6648 karma points MVP 2x c-trib
    Jul 01, 2024 @ 08:24
    Huw Reddick
    0

    Good luck with that :D

    Seriosly, it is not as easy as you would think.

    If you want to prevent autofilling of password fields, you can use autocomplete="new-password".

    However, this is a hint, which browsers are not required to comply with.

    What I have done in the past is use some javascript on load which sets the value of the password field to an empty string

    let login = document.querySelector('#inputLogin');
    let password = document.querySelector('#inputPassword');
    
    function setLogin () {
         login.value = '';
         password.value = '';
    }
    
  • Lucy 3 posts 73 karma points
    Jul 01, 2024 @ 08:26
    Lucy
    0

    Thank you so much. We'll give that a go.

  • Arun 141 posts 394 karma points
    Jul 01, 2024 @ 09:20
    Arun
    0

    Hi Lucy,

    Are you using Umbraco form or custom form?

    Have you tried attributes like aria-autocomplete="none" autocomplete="off" etc

    Regards

  • Huw Reddick 1920 posts 6648 karma points MVP 2x c-trib
    Jul 01, 2024 @ 09:27
    Huw Reddick
    0

    autocomplete=off is ignored by chrome

  • Arun 141 posts 394 karma points
    Jul 01, 2024 @ 12:42
    Arun
    0

    Hi Huw,

    Yes, I've checked this and understand Chrome ignore this attribute now!

    Finally I was able to avoid this issue by adding autocomplete="username", autocomplete="new-password" to the respective fields.

    Thanks.

  • Huw Reddick 1920 posts 6648 karma points MVP 2x c-trib
    Jul 01, 2024 @ 12:44
    Huw Reddick
    0

    autocomplete="new-password" may also get ignored by some browsers unfortunately :(

  • Lucy 3 posts 73 karma points
    Jul 01, 2024 @ 15:32
    Lucy
    0

    Thank you for all your suggestions here – and for letting me know about the browsers ignoring different attributes – particularly annoying.

Please Sign in or register to post replies

Write your reply to:

Draft