MDL-53048 forms: Deprecate prevent_form_autofill_password

This commit is contained in:
Andrew Nicols 2016-08-25 15:17:29 +08:00
parent 919b9dfabd
commit ac157b0bbe
15 changed files with 15 additions and 52 deletions

View File

@ -64,8 +64,6 @@ echo "<form id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n";
echo "<div>\n";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />\n";
echo "<input type=\"hidden\" name=\"auth\" value=\"".$auth."\" />\n";
// HACK to prevent browsers from automatically inserting the user's password into the wrong fields.
echo prevent_form_autofill_password();
// auth plugin description
echo $OUTPUT->box_start();

View File

@ -43,7 +43,6 @@
{{/params}}
<input type="hidden" name="sesskey" value="{{sesskey}}">
<input type="hidden" name="return" value="{{return}}">
{{>core/prevent_form_autofill_password}}
{{#title}}
<h2>{{title}}</h2>
{{/title}}

View File

@ -37,7 +37,6 @@
<form action="{{actionurl}}" method="post" id="adminsettings">
<div>
<input type="hidden" name="sesskey" value="{{sesskey}}">
{{>core/prevent_form_autofill_password}}
</div>
<fieldset>
<div class="clearer"></div>

View File

@ -63,8 +63,6 @@ echo '<form action="upgradesettings.php" method="post" id="adminsettings">';
echo '<div>';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<input type="hidden" name="return" value="'.$return.'" />';
// HACK to prevent browsers from automatically inserting the user's password into the wrong fields.
echo prevent_form_autofill_password();
echo '<fieldset>';
echo '<div class="clearer"><!-- --></div>';
echo $newsettingshtml;

View File

@ -1016,8 +1016,6 @@ class core_files_renderer extends plugin_renderer_base {
<div class="controls"><select></select></div>
</div>';
// HACK to prevent browsers from automatically inserting the user's password into the wrong fields.
$rv .= prevent_form_autofill_password();
$rv .= '
<div class="fp-login-input control-group clearfix">
<label class="control-label"></label>

View File

@ -5620,6 +5620,7 @@ function message_is_user_blocked($recipient, $sender = null) {
}
/**
<<<<<<< 919b9dfabd69f71c088f565746c547e6e169a0b7
* Display logs.
*
* @deprecated since 3.2
@ -6369,5 +6370,15 @@ function get_logs($select, array $params=null, $order='l.time DESC', $limitfrom=
$select
$order";
return $DB->get_records_sql($sql, $params, $limitfrom, $limitnum) ;
return $DB->get_records_sql($sql, $params, $limitfrom, $limitnum);
}
/**
* Renders a hidden password field so that browsers won't incorrectly autofill password fields with the user's password.
*
* @deprecated since Moodle 3.2 MDL-53048
*/
function prevent_form_autofill_password() {
debugging('prevent_form_autofill_password has been deprecated and is no longer in use.', DEBUG_DEVELOPER);
return '';
}

View File

@ -2750,8 +2750,6 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
$this->_collapseButtons = '';
$formid = $form->getAttribute('id');
parent::startForm($form);
// HACK to prevent browsers from automatically inserting the user's password into the wrong fields.
$this->_hiddenHtml .= prevent_form_autofill_password();
if ($form->isFrozen()){
$this->_formTemplate = "\n<div class=\"mform frozen\">\n{content}\n</div>";
} else {

View File

@ -1,23 +0,0 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
Snippet to prevent browsers from autofilling password fields.
}}
<div class="hide">
<input type="text" class="ignoredirty" />
<input type="password" class="ignoredirty" />
</div>

View File

@ -37,6 +37,7 @@ information provided here is intended especially for developers.
- get_logs() - See MDL-43681 for more information
- get_logs_usercourse() - See MDL-43681 for more information
- get_logs_userday() - See MDL-43681 for more information
- prevent_form_autofill_password() Please do not use anymore.
* The password_compat library was removed as it is no longer required.
* Phpunit has been upgraded to 5.4.x and following has been deprecated and is not used any more:
- setExpectedException(), use @expectedException or $this->expectException() and $this->expectExceptionMessage()

View File

@ -3556,14 +3556,3 @@ function get_formatted_help_string($identifier, $component, $ajax = false, $a =
}
return $data;
}
/**
* Renders a hidden password field so that browsers won't incorrectly autofill password fields with the user's password.
*
* @since 3.0
* @return string HTML to prevent password autofill
*/
function prevent_form_autofill_password() {
global $OUTPUT;
return $OUTPUT->render_from_template('core/prevent_form_autofill_password', []);
}

View File

@ -272,8 +272,6 @@ case 'sign':
echo '<form method="post">';
echo '<input type="hidden" name="action" value="sign" />';
echo '<input type="hidden" name="repo_id" value="'.s($repo_id).'" />';
// HACK to prevent browsers from automatically inserting the user's password into the wrong fields.
echo prevent_form_autofill_password();
$repo->print_login();
echo '</form>';
}

View File

@ -107,7 +107,7 @@ class files_renderer extends \core_files_renderer {
* @return string
*/
protected function fp_js_template_loginform() {
return $this->render_from_template('core/filemanager_loginform', ['autofillhack' => prevent_form_autofill_password()]);
return $this->render_from_template('core/filemanager_loginform', []);
}
/**

View File

@ -14,7 +14,6 @@
<label class="form-control-label"></label>
<select class="form-control"></select>
</div>
{{{autofillhack}}}
<div class="fp-login-input form-group">
<label class="form-control-label"></label>
<input class="form-control"/>
@ -27,4 +26,4 @@
<p class="mdl-align"><button class="fp-login-submit btn-primary btn">{{#str}}submit, repository{{/str}}</button></p>
</form>
</div>
</div>
</div>

View File

@ -24,7 +24,6 @@
{{/params}}
<input type="hidden" name="sesskey" value="{{sesskey}}">
<input type="hidden" name="return" value="{{return}}">
{{>core/prevent_form_autofill_password}}
{{#title}}
<h2>{{title}}</h2>
{{/title}}

View File

@ -20,7 +20,6 @@
<form action="{{actionurl}}" method="post" id="adminsettings">
<div>
<input type="hidden" name="sesskey" value="{{sesskey}}">
{{>core/prevent_form_autofill_password}}
</div>
<fieldset>
<div class="clearer"></div>