Merge branch 'w43_MDL-42208_m26_authunmask' of https://github.com/skodak/moodle

This commit is contained in:
Damyon Wiese
2013-10-23 13:37:24 +08:00
6 changed files with 49 additions and 4 deletions
+3
View File
@@ -78,6 +78,9 @@ echo '<p style="text-align: center"><input type="submit" value="' . get_string("
echo "</div>\n";
echo "</form>\n";
$PAGE->requires->string_for_js('unmaskpassword', 'core_form');
$PAGE->requires->yui_module('moodle-auth-passwordunmask', 'M.auth.passwordunmask');
echo $OUTPUT->footer();
exit;
+1 -1
View File
@@ -321,7 +321,7 @@ if (!ldap_paged_results_supported($config->ldap_version)) {
<label for="bind_pw"><?php print_string('auth_ldap_bind_pw_key', 'auth_ldap') ?></label>
</td>
<td>
<input name="bind_pw" id="bind_pw" type="password" size="30" value="<?php echo $config->bind_pw?>" />
<input name="bind_pw" id="bind_pw" type="password" size="30" value="<?php echo $config->bind_pw?>" autocomplete="off"/>
<?php if (isset($err['bind_pw'])) { echo $OUTPUT->error_text($err['bind_pw']); } ?>
</td>
<td>
+1 -1
View File
@@ -124,7 +124,7 @@
<tr valign="top" class="required">
<td align="right"><label for="pass"><?php print_string("auth_dbpass_key", "auth_db") ?></label></td>
<td>
<input id="pass" name="pass" type="password" size="30" value="<?php p($config->pass)?>" />
<input id="pass" name="pass" type="password" size="30" value="<?php p($config->pass)?>" autocomplete="off"/>
<?php
if (isset($err["pass"])) {
+1 -1
View File
@@ -61,7 +61,7 @@
<tr valign="top" class="required">
<td align="right"><label for="passwd"><?php print_string("auth_fcpasswd_key", "auth_fc") ?>:</label></td>
<td>
<input name="passwd" id="passwd" type="password" size="30" maxlength="12" value="<?php echo $config->passwd?>" />
<input name="passwd" id="passwd" type="password" size="30" maxlength="12" value="<?php echo $config->passwd?>" autocomplete="off"/>
<?php if (isset($err["passwd"])) echo $OUTPUT->error_text($err["passwd"]); ?>
</td>
<td>
+1 -1
View File
@@ -227,7 +227,7 @@ if (!ldap_paged_results_supported($config->ldap_version)) {
<label for="bind_pw"><?php print_string('auth_ldap_bind_pw_key', 'auth_ldap') ?></label>
</td>
<td>
<input name="bind_pw" id="bind_pw" type="password" size="30" value="<?php echo $config->bind_pw?>" />
<input name="bind_pw" id="bind_pw" type="password" size="30" value="<?php echo $config->bind_pw?>" autocomplete="off"/>
<?php if (isset($err['bind_pw'])) { echo $OUTPUT->error_text($err['bind_pw']); } ?>
</td>
<td>
+42
View File
@@ -0,0 +1,42 @@
YUI.add('moodle-auth-passwordunmask', function(Y) {
var PASSWORDUNMASK = function() {
PASSWORDUNMASK.superclass.constructor.apply(this, arguments);
}
Y.extend(PASSWORDUNMASK, Y.Base, {
// Initialize checkboxes.
initializer : function(params) {
this.add_checkboxes();
},
// Create checkboxes for all unmasking passwords.
add_checkboxes : function() {
Y.all('#authmenu input[type=password]').each(function(node) {
var checkboxlabel = M.util.get_string('unmaskpassword', 'core_form');
var elementid = node.get('id');
var elementname = node.get('name');
// Retain unmask div from previous implementation.
var unmaskdiv = Y.Node.create('<div id="'+elementid+'unmaskdiv" class="unmask"></div>');
// Add checkbox for unmasking to unmaskdiv.
var unmaskchb = Y.Node.create('<input id="'+elementid+'unmask" type="checkbox" name="'+elementname+'unmask">');
unmaskdiv.appendChild(unmaskchb);
//Attach event using static javascript function for unmasking password.
unmaskchb.on('click', function() {unmaskPassword(elementid);});
// Add label for checkbox to unmaskdiv.
var unmasklabel = Y.Node.create('<label for="'+elementid+'unmask">'+checkboxlabel+'</label>');
unmaskdiv.appendChild(unmasklabel);
// Insert unmask div in the same div as password input.
node.get('parentNode').insert(unmaskdiv, node.get('lastNode'));
});
return;
}
});
M.auth = M.auth || {};
M.auth.passwordunmask = function(params) {
return new PASSWORDUNMASK(params);
}
}, '@VERSION@', {requires:['base', 'node']});