From b9d846cd42b4de921153e722cca7a6dc7e9cc753 Mon Sep 17 00:00:00 2001 From: gbrodman Date: Thu, 26 Mar 2020 15:55:54 -0400 Subject: [PATCH] Don't rely on the password field's existence for admins (#534) * Don't rely on the password field's existence for admins We don't have the field when it's an admin user that's logged in. A nicer language would have caught this unfortunately. --- .../google/registry/ui/js/registrar/registry_lock.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/javascript/google/registry/ui/js/registrar/registry_lock.js b/core/src/main/javascript/google/registry/ui/js/registrar/registry_lock.js index 1eb96141c..27e71731f 100644 --- a/core/src/main/javascript/google/registry/ui/js/registrar/registry_lock.js +++ b/core/src/main/javascript/google/registry/ui/js/registrar/registry_lock.js @@ -121,7 +121,10 @@ registry.registrar.RegistryLock.prototype.showModal_ = function(targetElement, d if (domain == null) { goog.dom.getRequiredElement('domain-lock-input-value').focus(); } else { - goog.dom.getRequiredElement('domain-lock-password').focus(); + var passwordElem = goog.dom.getElement('domain-lock-password'); + if (passwordElem != null) { + passwordElem.focus(); + } } // delete the modal when the user clicks the cancel button goog.events.listen( @@ -162,7 +165,8 @@ registry.registrar.RegistryLock.prototype.showModal_ = function(targetElement, d */ registry.registrar.RegistryLock.prototype.lockOrUnlockDomain_ = function(isLock, e) { var domain = goog.dom.getRequiredElement('domain-lock-input-value').value; - var password = goog.dom.getRequiredElement('domain-lock-password').value; + var passwordElem = goog.dom.getElement('domain-lock-password'); + var password = passwordElem == null ? null : passwordElem.value; goog.net.XhrIo.send('/registry-lock-post', e => this.fillLocksPage_(e), 'POST',