Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2009
    Posts
    36
    Plugin Contributions
    0

    Default how to disable autocomplete on password fields?

    Hi, my security scanner has identified a recommendation to disable autocomplete on password fields. After consideration, I think this is a good idea, but am unsure how to do so...

    I can see from tpl_modules_create_account.php that there is a function zen_draw_password_field, but am not clued on enough to solve this myself!

    Any help would be much appreciated

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: how to disable autocomplete on password fields

    If you find these lines in your includes/functions/html_output.php file
    PHP Code:
    // Output a form password field
      
    function zen_draw_password_field($name$value ''$required false) {
        
    $field zen_draw_input_field($name$value'maxlength="40"'$required'password'false); 
    and replace them with
    PHP Code:
    // Output a form password field
      
    function zen_draw_password_field($name$value ''$required false) {
        
    $field zen_draw_input_field($name$value'maxlength="40" autocomplete="off"'$required'password'false); 
    it should do the trick.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Oct 2009
    Posts
    36
    Plugin Contributions
    0

    Default Re: how to disable autocomplete on password fields

    Awesome, thanks for your help

  4. #4
    Join Date
    Oct 2009
    Posts
    36
    Plugin Contributions
    0

    Default Re: how to disable autocomplete on password fields

    Hi, on another look at this, I haven't managed to achieve what I set out to do. My code (1.3.8a) is slightly different to what you posted above, but I did my best to adapt what you were saying and ended up with this:

    /*
    * Output a form password field
    */
    function zen_draw_password_field($name, $value = '', $parameters = 'maxlength="40" autocomplete="off"') {
    return zen_draw_input_field($name, $value, $parameters, 'password', true);
    }


    But in the browser render of the page I see this:


    <fieldset>

    <legend>Create a Password (needed to track your packages)</legend>

    <br class="clearBoth">

    <label class="inputLabel" for="password-new">Password:</label>

    <input type="password" name="password" size = "21" maxlength= "40" id="password-new" /><span class="alert">* (at least 5 characters)</span><br class="clearBoth" />



    <label class="inputLabel" for="password-confirm">Confirm Password:</label>

    <input type="password" name="confirmation" size = "21" maxlength= "40" id="password-confirm" /><span class="alert">*</span><br class="clearBoth" />

    </fieldset>


    The desired autocomplete=off has not worked.

    Any more ideas??? Thanks for your help

  5. #5
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: how to disable autocomplete on password fields

    With respect, you really do need to be upgrading.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Oct 2009
    Posts
    36
    Plugin Contributions
    0

    Default Re: how to disable autocomplete on password fields

    Thanks, we plan on doing so, but due to the number of contributions installed it is not going to be easy.

    In the meantime I would appreciate if somebody would be kind enough to advise on this issue?

  7. #7
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: how to disable autocomplete on password fields

    Allow me to clear up some confusion here.

    There is only 1 'html_output.php' file which is found in 'includes/functions' and it appears there has not been any changes to the 'password field' coding between versions.

    v1.3.8a
    includes/functions/html_output.php file #385

    /*
    * Output a form password field
    */
    function zen_draw_password_field($name, $value = '', $parameters = 'maxlength="40"') {
    return zen_draw_input_field($name, $value, $parameters, 'password', true);
    }

    v1.3.9h
    includes/functions/html_output.php file #384

    /*
    * Output a form password field
    */
    function zen_draw_password_field($name, $value = '', $parameters = 'maxlength="40"') {
    return zen_draw_input_field($name, $value, $parameters, 'password', true);
    }



    It is true the second line needs to be altered and it is done like so.

    /*
    * Output a form password field
    */
    function zen_draw_password_field($name, $value = '', $parameters = 'maxlength="40"') {
    return zen_draw_input_field($name, $value, $parameters, 'password autocomplete="off"', true);
    }

  8. #8
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: how to disable autocomplete on password fields

    Ok, so the above change does prevent autocomplete but causes two other problems;

    - password is no longer hidden
    - HTML code is now invalid

    So although it works, it would probably not be advisable to use.

    At this time HTML 4 and XHTML 1 do not support the 'autocomplete' attribute. It is in HTML 5 but that is not currently used with Zen Cart.


    Also of note, changing the $parameters = '' value does not appear to effect any changes at all? What's up with that?

  9. #9
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: how to disable autocomplete on password fields

    Apparently kuroi quoted from the admin version of html_output.php, instead of the storefront version. Hence the confusion. Nevertheless, the concept was the same.

    However, Website Rob is correct in that the password is no longer hidden.
    Instead, because password fields are handled differently, you'll need to edit your tpl_login_default.php template file (for your custom template) and add autocomplete="off" into the zen_draw_form() calls, similar to this:
    Code:
    <?php echo zen_draw_form('login', zen_href_link(FILENAME_LOGIN, 'action=process', 'SSL'), 'post', 'id="loginForm" autocomplete="off"'); ?>
    You'll probably want to do it for all the zen_draw_form calls in that template file, lest your scanner make their "suggestion" again.

    The caveat to this is that the *entire* form contents will no longer be remembered, not just the password field. That's probably just as well though.

    Remember to undo the changes you made to html_output.php, since they're irrelevant if you change the way the forms are drawn.

    Remember to share the love: http://www.zen-cart.com/index.php?ma...es&pages_id=14
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. v151 Search Autocomplete?
    By thanhv in forum General Questions
    Replies: 0
    Last Post: 3 Apr 2013, 02:30 PM
  2. Disable Log in Password?
    By sports guy in forum General Questions
    Replies: 0
    Last Post: 9 Mar 2010, 05:06 PM
  3. Add Customers from Admin disable Random Password
    By explorer1979 in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 4 Mar 2009, 01:37 AM
  4. How do I control autocomplete caching at field level?
    By CrazyCow in forum General Questions
    Replies: 2
    Last Post: 3 Aug 2008, 03:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR