Allow users the option of seeing their registry lock password (#663)

* Allow users the option of seeing their registry lock password

Only when entering it for the first time, of course.
This commit is contained in:
gbrodman 2020-07-05 20:08:22 -04:00 committed by GitHub
parent 683af3fa6e
commit 57d1d1697a
7 changed files with 47 additions and 3 deletions

View file

@ -106,6 +106,7 @@ registry.registrar.ContactSettings.prototype.renderItem = function(rspObj) {
registryLockAllowedForRegistrar: rspObj.registryLockAllowed
});
this.setupAppbar();
this.setupPasswordElemIfNecessary_(targetContactNdx);
} else {
var contactsByType = {};
for (var c in contacts) {
@ -251,3 +252,26 @@ registry.registrar.ContactSettings.prototype.handleDeleteResponse =
}
return rsp;
};
// Show or hide the password based on what the user chooses
registry.registrar.ContactSettings.prototype.setupPasswordElemIfNecessary_ =
function(contactIndex) {
var showOrHidePasswordButton = goog.dom.getElement('showOrHideRegistryLockPassword')
var showOrHidePassword = function() {
var inputElement = goog.dom.getRequiredElement(
'contacts[' + contactIndex + '].registryLockPassword')
var type = inputElement.getAttribute('type')
if (type === 'password') {
showOrHidePasswordButton.text = 'Hide password';
inputElement.setAttribute('type', 'text');
} else {
showOrHidePasswordButton.text = 'Show password';
inputElement.setAttribute('type', 'password');
}
};
if (showOrHidePasswordButton != null) {
goog.events.listen(showOrHidePasswordButton,
goog.events.EventType.CLICK, showOrHidePassword, false, this);
}
};