Disable browser 'Save Password' functionality

前端 未结 30 3358
失恋的感觉
失恋的感觉 2020-11-21 23:29

One of the joys of working for a government healthcare agency is having to deal with all of the paranoia around dealing with PHI (Protected Health Information). Don\'t get m

相关标签:
30条回答
  • 2020-11-21 23:42

    Use real two-factor authentication to avoid the sole dependency on passwords which might be stored in many more places than the user's browser cache.

    0 讨论(0)
  • 2020-11-21 23:42

    I have a work around, which may help.

    You could make a custom font hack. So, make a custom font, with all the characters as a dot / circle / star for example. Use this as a custom font for your website. Check how to do this in inkscape: how to make your own font

    Then on your log in form use:

    <form autocomplete='off'  ...>
       <input type="text" name="email" ...>
       <input type="text" name="password" class="password" autocomplete='off' ...>
       <input type=submit>
    </form>
    

    Then add your css:

    @font-face {
        font-family: 'myCustomfont';
        src: url('myCustomfont.eot');
        src: url('myCustomfont?#iefix') format('embedded-opentype'),
             url('myCustomfont.woff') format('woff'),
             url('myCustomfont.ttf') format('truetype'),
             url('myCustomfont.svg#myCustomfont') format('svg');
        font-weight: normal;
        font-style: normal;
    
    }
    .password {
      font-family:'myCustomfont';
    }
    

    Pretty cross browser compatible. I have tried IE6+, FF, Safari and Chrome. Just make sure that the oet font that you convert does not get corrupted. Hope it helps?

    0 讨论(0)
  • 2020-11-21 23:43

    Facing the same HIPAA issue and found a relatively easy solution,

    1. Create a hidden password field with the field name as an array.

      <input type="password" name="password[]" style="display:none" />
      
    2. Use the same array for the actual password field.

      <input type="password" name="password[]" />
      

    The browser (Chrome) may prompt you to "Save password" but regardless if the user selects save, the next time they login the password will auto-populate the hidden password field, the zero slot in the array, leaving the 1st slot blank.

    I tried defining the array, such as "password[part2]" but it still remembered. I think it throws it off if it's an unindexed array because it has no choice but to drop it in the first spot.

    Then you use your programming language of choice to access the array, PHP for example,

    echo $_POST['password'][1];
    
    0 讨论(0)
  • 2020-11-21 23:44

    What I have been doing is a combination of autocomplete="off" and clearing password fields using a javascript / jQuery.

    jQuery Example:

    $(function() { 
        $('#PasswordEdit').attr("autocomplete", "off");
        setTimeout('$("#PasswordEdit").val("");', 50); 
    });
    

    By using setTimeout() you can wait for the browser to complete the field before you clear it, otherwise the browser will always autocomplete after you've clear the field.

    0 讨论(0)
  • 2020-11-21 23:45

    Just so people realise - the 'autocomplete' attribute works most of the time, but power users can get around it using a bookmarklet.

    Having a browser save your passwords actually increases protection against keylogging, so possibly the safest option is to save passwords in the browser but protect them with a master password (at least in Firefox).

    0 讨论(0)
  • 2020-11-21 23:46

    I'm not sure if it'll work in all browsers but you should try setting autocomplete="off" on the form.

    <form id="loginForm" action="login.cgi" method="post" autocomplete="off">
    

    The easiest and simplest way to disable Form and Password storage prompts and prevent form data from being cached in session history is to use the autocomplete form element attribute with value "off".

    From http://developer.mozilla.org/En/How_to_Turn_Off_Form_Autocompletion

    Some minor research shows that this works in IE to but I'll leave no guarantees ;)

    @Joseph: If it's a strict requirement to pass XHTML validation with the actual markup (don't know why it would be though) you could theoretically add this attribute with javascript afterwards but then users with js disabled (probably a neglectable amount of your userbase or zero if your site requires js) will still have their passwords saved.

    Example with jQuery:

    $('#loginForm').attr('autocomplete', 'off');
    
    0 讨论(0)
提交回复
热议问题