General developer forum

Turn off auto complete on password textbox

Picture of gautam Das
Re: Turn off auto complete on password textbox


I have found a function prevent_form_autofill_password() in /lib/weblib.php in moodle version 2.7 to 3.1

Moodle has been tried to fix this issue using this function.

I have added some html elements into this function in moodle version 3.1. The changed function has been written as:

function prevent_form_autofill_password() {
    return '<div class="hide"><input type="text" class="ignoredirty" /><input name="username" class="ignoredirty" /><input type="password" name="password" class="ignoredirty" /><input type="password" name="newpassword" class="ignoredirty" /></div>';

Now, its prevent browsers from automatically inserting the user's password into the form fields. It works....

Average of ratings: Useful (1)