Gray out the password field for admins (#506)

* Gray out the password field for admins

We don't check it for admins since it's not necessary, so ignore it

* Remove the field entirely
This commit is contained in:
gbrodman 2020-03-10 11:30:20 -04:00 committed by GitHub
parent 499237ac57
commit f2846fc914
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 6 deletions

View file

@ -45,6 +45,7 @@ registry.registrar.RegistryLock = function(console, resource) {
goog.inherits(registry.registrar.RegistryLock, registry.ResourceComponent); goog.inherits(registry.registrar.RegistryLock, registry.ResourceComponent);
registry.registrar.RegistryLock.prototype.runAfterRender = function(objArgs) { registry.registrar.RegistryLock.prototype.runAfterRender = function(objArgs) {
this.isAdmin = objArgs.isAdmin;
this.clientId = objArgs.clientId; this.clientId = objArgs.clientId;
this.xsrfToken = objArgs.xsrfToken; this.xsrfToken = objArgs.xsrfToken;
@ -114,7 +115,8 @@ registry.registrar.RegistryLock.prototype.showModal_ = function(targetElement, d
var parentElement = targetElement.parentElement; var parentElement = targetElement.parentElement;
// attach the modal to the parent element so focus remains correct if the user closes the modal // attach the modal to the parent element so focus remains correct if the user closes the modal
var modalElement = goog.soy.renderAsElement( var modalElement = goog.soy.renderAsElement(
registry.soy.registrar.registrylock.confirmModal, {domain: domain, isLock: isLock}); registry.soy.registrar.registrylock.confirmModal,
{domain: domain, isLock: isLock, isAdmin: this.isAdmin});
parentElement.prepend(modalElement); parentElement.prepend(modalElement);
if (domain == null) { if (domain == null) {
goog.dom.getRequiredElement('domain-lock-input-value').focus(); goog.dom.getRequiredElement('domain-lock-input-value').focus();

View file

@ -106,6 +106,7 @@
/** Modal that confirms that the user wishes to lock/unlock a domain. */ /** Modal that confirms that the user wishes to lock/unlock a domain. */
{template .confirmModal} {template .confirmModal}
{@param isLock: bool} {@param isLock: bool}
{@param isAdmin: bool}
{@param? domain: string|null} {@param? domain: string|null}
<div id="lock-confirm-modal" class="{css('lock-confirm-modal')}"> <div id="lock-confirm-modal" class="{css('lock-confirm-modal')}">
<div class="modal-content"> <div class="modal-content">
@ -117,9 +118,11 @@
value="{$domain}" disabled value="{$domain}" disabled
{/if}> {/if}>
<br> <br>
<label for="domain-lock-password">Registry lock password: </label> {if not $isAdmin}
<input type="password" id="domain-lock-password"> <label for="domain-lock-password">Registry lock password: </label>
<br> <input type="password" id="domain-lock-password">
<br>
{/if}
<div id="modal-error-message" hidden class="{css('kd-errormessage')}"></div> <div id="modal-error-message" hidden class="{css('kd-errormessage')}"></div>
<div class="{css('buttons-div')}"> <div class="{css('buttons-div')}">
<button id="domain-lock-cancel" class="{css('kd-button')}">Cancel</button> <button id="domain-lock-cancel" class="{css('kd-button')}">Cancel</button>

View file

@ -499,7 +499,6 @@ public class RegistrarConsoleScreenshotTest extends WebDriverTestCase {
@Test @Test
public void registryLock_unlockModal() throws Throwable { public void registryLock_unlockModal() throws Throwable {
server.setIsAdmin(true);
server.runInAppEngineEnvironment( server.runInAppEngineEnvironment(
() -> { () -> {
createDomainAndSaveLock(); createDomainAndSaveLock();
@ -527,7 +526,6 @@ public class RegistrarConsoleScreenshotTest extends WebDriverTestCase {
driver.findElement(By.id("button-lock-domain")).click(); driver.findElement(By.id("button-lock-domain")).click();
driver.waitForElement(By.className("modal-content")); driver.waitForElement(By.className("modal-content"));
driver.findElement(By.id("domain-lock-input-value")).sendKeys("somedomain.tld"); driver.findElement(By.id("domain-lock-input-value")).sendKeys("somedomain.tld");
driver.findElement(By.id("domain-lock-password")).sendKeys("password");
driver.diffPage("page"); driver.diffPage("page");
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Before After
Before After