Skip to content

Commit

Permalink
MDL-53048 forms: Deprecate prevent_form_autofill_password
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Oct 24, 2016
1 parent 919b9df commit ac157b0
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 52 deletions.
2 changes: 0 additions & 2 deletions admin/auth_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@
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();
Expand Down
1 change: 0 additions & 1 deletion admin/templates/settings.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
1 change: 0 additions & 1 deletion admin/templates/settings_search_results.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 0 additions & 2 deletions admin/upgradesettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@
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;
Expand Down
2 changes: 0 additions & 2 deletions files/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1016,8 +1016,6 @@ protected function fp_js_template_loginform() {
<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>
Expand Down
13 changes: 12 additions & 1 deletion lib/deprecatedlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -5620,6 +5620,7 @@ function message_is_user_blocked($recipient, $sender = null) {
}

/**
<<<<<<< 919b9dfabd69f71c088f565746c547e6e169a0b7
* Display logs.
*
* @deprecated since 3.2
Expand Down Expand Up @@ -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 '';
}
2 changes: 0 additions & 2 deletions lib/formslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2750,8 +2750,6 @@ function startForm(&$form){
$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 {
Expand Down
23 changes: 0 additions & 23 deletions lib/templates/prevent_form_autofill_password.mustache

This file was deleted.

1 change: 1 addition & 0 deletions lib/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
11 changes: 0 additions & 11 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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', []);
}
2 changes: 0 additions & 2 deletions repository/filepicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,6 @@
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>';
}
Expand Down
2 changes: 1 addition & 1 deletion theme/boost/classes/output/core/files_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function fp_js_template_uploadform() {
* @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', []);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions theme/boost/templates/core/filemanager_loginform.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand All @@ -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>
1 change: 0 additions & 1 deletion theme/boost/templates/core_admin/settings.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit ac157b0

Please sign in to comment.