diff --git a/java/google/registry/ui/server/registrar/ConsoleRegistrarCreatorAction.java b/java/google/registry/ui/server/registrar/ConsoleRegistrarCreatorAction.java index 9d48c100c..7444d196e 100644 --- a/java/google/registry/ui/server/registrar/ConsoleRegistrarCreatorAction.java +++ b/java/google/registry/ui/server/registrar/ConsoleRegistrarCreatorAction.java @@ -117,7 +117,7 @@ public final class ConsoleRegistrarCreatorAction implements Runnable { @Inject @Parameter("ianaId") Optional ianaId; @Inject @Parameter("referralEmail") Optional referralEmail; @Inject @Parameter("driveId") Optional driveId; - @Inject @Parameter("email") Optional email; + @Inject @Parameter("consoleUserEmail") Optional consoleUserEmail; // Address fields, some of which are required and others are optional. @Inject @Parameter("street1") Optional street1; @@ -229,7 +229,7 @@ public final class ConsoleRegistrarCreatorAction implements Runnable { checkPresent(ianaId, "ianaId"); checkPresent(referralEmail, "referralEmail"); checkPresent(driveId, "driveId"); - checkPresent(email, "email"); + checkPresent(consoleUserEmail, "consoleUserEmail"); checkPresent(street1, "street"); checkPresent(city, "city"); checkPresent(countryCode, "countryCode"); @@ -240,7 +240,7 @@ public final class ConsoleRegistrarCreatorAction implements Runnable { data.put("referralEmail", referralEmail.get()); data.put("billingAccount", billingAccount.get()); data.put("driveId", driveId.get()); - data.put("email", email.get()); + data.put("consoleUserEmail", consoleUserEmail.get()); data.put("street1", street1.get()); optionalStreet2.ifPresent(street2 -> data.put("street2", street2)); @@ -252,9 +252,9 @@ public final class ConsoleRegistrarCreatorAction implements Runnable { String gaeUserId = checkNotNull( - convertEmailAddressToGaeUserId(email.get()), + convertEmailAddressToGaeUserId(consoleUserEmail.get()), "Email address %s is not associated with any GAE ID", - email.get()); + consoleUserEmail.get()); String password = optionalPassword.orElse(passwordGenerator.createString(PASSWORD_LENGTH)); String phonePasscode = optionalPasscode.orElse(passcodeGenerator.createString(PASSCODE_LENGTH)); @@ -265,6 +265,7 @@ public final class ConsoleRegistrarCreatorAction implements Runnable { .setBillingAccountMap(parseBillingAccount(billingAccount.get())) .setIanaIdentifier(Long.valueOf(ianaId.get())) .setIcannReferralEmail(referralEmail.get()) + .setEmailAddress(referralEmail.get()) .setDriveFolderId(driveId.get()) .setType(Registrar.Type.REAL) .setPassword(password) @@ -286,8 +287,8 @@ public final class ConsoleRegistrarCreatorAction implements Runnable { RegistrarContact contact = new RegistrarContact.Builder() .setParent(registrar) - .setName(email.get()) - .setEmailAddress(email.get()) + .setName(consoleUserEmail.get()) + .setEmailAddress(consoleUserEmail.get()) .setGaeUserId(gaeUserId) .build(); ofy() @@ -331,7 +332,7 @@ public final class ConsoleRegistrarCreatorAction implements Runnable { data.put("ianaId", ianaId.orElse(null)); data.put("referralEmail", referralEmail.orElse(null)); data.put("driveId", driveId.orElse(null)); - data.put("email", email.orElse(null)); + data.put("consoleUserEmail", consoleUserEmail.orElse(null)); response.setPayload( TOFU_SUPPLIER @@ -362,7 +363,8 @@ public final class ConsoleRegistrarCreatorAction implements Runnable { .append(toEmailLine(ianaId, "ianaId")) .append(toEmailLine(referralEmail, "referralEmail")) .append(toEmailLine(driveId, "driveId")) - .append(String.format("Gave user %s web access to the registrar\n", email.get())); + .append( + String.format("Gave user %s web access to the registrar\n", consoleUserEmail.get())); sendEmailUtils.sendEmail( String.format("Registrar %s created in %s", clientId.get(), environment), builder.toString()); diff --git a/java/google/registry/ui/server/registrar/RegistrarConsoleModule.java b/java/google/registry/ui/server/registrar/RegistrarConsoleModule.java index 70f695184..63b1a48e8 100644 --- a/java/google/registry/ui/server/registrar/RegistrarConsoleModule.java +++ b/java/google/registry/ui/server/registrar/RegistrarConsoleModule.java @@ -73,6 +73,12 @@ public final class RegistrarConsoleModule { return extractOptionalParameter(req, "referralEmail"); } + @Provides + @Parameter("consoleUserEmail") + static Optional provideOptionalConsoleUserEmail(HttpServletRequest req) { + return extractOptionalParameter(req, "consoleUserEmail"); + } + @Provides @Parameter("email") static Optional provideOptionalEmail(HttpServletRequest req) { diff --git a/java/google/registry/ui/soy/registrar/RegistrarCreateConsole.soy b/java/google/registry/ui/soy/registrar/RegistrarCreateConsole.soy index 5779667b5..35185f327 100644 --- a/java/google/registry/ui/soy/registrar/RegistrarCreateConsole.soy +++ b/java/google/registry/ui/soy/registrar/RegistrarCreateConsole.soy @@ -31,7 +31,7 @@ {@param? ianaId: int} /** If set - an initial value for the IANA ID. */ {@param? referralEmail: string} /** If set - an initial value for the ICANN referral email. */ {@param? driveId: string} /** If set - an initial value for the DRIVE ID. */ - {@param? email: string} /** If set - an initial value for the email. */ + {@param? consoleUserEmail: string} /** If set - the user to be given console access. */ {@param? street1: string} /** If set - the first line of the street address. */ {@param? street2: string} /** If set - the second line of the street address. */ {@param? street3: string} /** If set - the third line of the street address. */ @@ -63,7 +63,7 @@ */ {template .resultSuccess} {@param clientId: string} /** The clientId of the registrar. */ - {@param email: string} /** The email of the account with web access to the registrar. */ + {@param consoleUserEmail: string} /** The email of the account with web access to the registrar. */ {@param passcode: string} /** The phone passcode for this registrar. */ {@param password: string} /** The password given for the created registrars. */ {@param username: string} /** Arbitrary username to display. */ @@ -120,7 +120,7 @@ - Gave web-console access to this registrar. + Gave web-console access to this registrar.

You may want to set additional values using the web console:

    @@ -147,7 +147,7 @@ {@param? ianaId: int} /** If set - an initial value for the IANA ID. */ {@param? referralEmail: string} /** If set - an initial value for the ICANN referral email. */ {@param? driveId: string} /** If set - an initial value for the DRIVE ID. */ - {@param? email: string} /** If set - an initial value for the email. */ + {@param? consoleUserEmail: string} /** If set - the user to be given console access. */ {@param? street1: string} /** If set - the first line of the street address. */ {@param? street2: string} /** If set - the second line of the street address. */ {@param? street3: string} /** If set - the third line of the street address. */ @@ -235,8 +235,8 @@ {/call} {call registry.soy.forms.inputFieldRowWithValue} {param label: 'Delegated email' /} - {param name: 'email' /} - {param value: $email /} + {param name: 'consoleUserEmail' /} + {param value: $consoleUserEmail /} {param placeholder: 'required' /} {param description kind="text"} The email we created for the registrar. diff --git a/javatests/google/registry/ui/server/registrar/ConsoleRegistrarCreatorActionTest.java b/javatests/google/registry/ui/server/registrar/ConsoleRegistrarCreatorActionTest.java index 7586856de..387dc492a 100644 --- a/javatests/google/registry/ui/server/registrar/ConsoleRegistrarCreatorActionTest.java +++ b/javatests/google/registry/ui/server/registrar/ConsoleRegistrarCreatorActionTest.java @@ -104,7 +104,7 @@ public final class ConsoleRegistrarCreatorActionTest { action.ianaId = Optional.empty(); action.referralEmail = Optional.empty(); action.driveId = Optional.empty(); - action.email = Optional.empty(); + action.consoleUserEmail = Optional.empty(); action.street1 = Optional.empty(); action.optionalStreet2 = Optional.empty(); @@ -162,7 +162,7 @@ public final class ConsoleRegistrarCreatorActionTest { action.ianaId = Optional.of(12321); action.referralEmail = Optional.of("icann@example.com"); action.driveId = Optional.of("drive-id"); - action.email = Optional.of("myclientid@registry.example"); + action.consoleUserEmail = Optional.of("myclientid@registry.example"); action.street1 = Optional.of("my street"); action.city = Optional.of("my city"); @@ -196,6 +196,7 @@ public final class ConsoleRegistrarCreatorActionTest { assertThat(registrar.getDriveFolderId()).isEqualTo("drive-id"); assertThat(registrar.getIanaIdentifier()).isEqualTo(12321L); assertThat(registrar.getIcannReferralEmail()).isEqualTo("icann@example.com"); + assertThat(registrar.getEmailAddress()).isEqualTo("icann@example.com"); assertThat(registrar.testPassword("abcdefghijklmnop")).isTrue(); assertThat(registrar.getPhonePasscode()).isEqualTo("31415"); assertThat(registrar.getState()).isEqualTo(Registrar.State.PENDING); @@ -226,7 +227,7 @@ public final class ConsoleRegistrarCreatorActionTest { action.ianaId = Optional.of(12321); action.referralEmail = Optional.of("icann@example.com"); action.driveId = Optional.of("drive-id"); - action.email = Optional.of("myclientid@registry.example"); + action.consoleUserEmail = Optional.of("myclientid@registry.example"); action.street1 = Optional.of("my street"); action.optionalStreet2 = Optional.of("more street"); @@ -261,7 +262,7 @@ public final class ConsoleRegistrarCreatorActionTest { action.ianaId = Optional.of(12321); action.referralEmail = Optional.of("icann@example.com"); action.driveId = Optional.of("drive-id"); - action.email = Optional.of("myclientid@registry.example"); + action.consoleUserEmail = Optional.of("myclientid@registry.example"); action.street1 = Optional.of("my street"); action.city = Optional.of("my city"); @@ -298,7 +299,7 @@ public final class ConsoleRegistrarCreatorActionTest { action.ianaId = Optional.of(12321); action.referralEmail = Optional.of("icann@example.com"); action.driveId = Optional.of("drive-id"); - action.email = Optional.of("myclientid@registry.example"); + action.consoleUserEmail = Optional.of("myclientid@registry.example"); action.street1 = Optional.of("my street"); action.city = Optional.of("my city"); @@ -326,7 +327,7 @@ public final class ConsoleRegistrarCreatorActionTest { action.ianaId = Optional.of(12321); action.referralEmail = Optional.of("icann@example.com"); action.driveId = Optional.of("drive-id"); - action.email = Optional.of("myclientid@registry.example"); + action.consoleUserEmail = Optional.of("myclientid@registry.example"); action.street1 = Optional.of("my street"); action.city = Optional.of("my city"); @@ -353,7 +354,7 @@ public final class ConsoleRegistrarCreatorActionTest { action.ianaId = Optional.of(12321); action.referralEmail = Optional.of("icann@example.com"); action.driveId = Optional.of("drive-id"); - action.email = Optional.of("myclientid@registry.example"); + action.consoleUserEmail = Optional.of("myclientid@registry.example"); action.street1 = Optional.of("my street"); action.city = Optional.of("my city"); @@ -383,7 +384,7 @@ public final class ConsoleRegistrarCreatorActionTest { action.ianaId = Optional.of(12321); action.referralEmail = Optional.of("icann@example.com"); action.driveId = Optional.of("drive-id"); - action.email = Optional.of("myclientid@registry.example"); + action.consoleUserEmail = Optional.of("myclientid@registry.example"); action.street1 = Optional.of("my street"); action.city = Optional.of("my city"); @@ -409,7 +410,7 @@ public final class ConsoleRegistrarCreatorActionTest { action.registrarAccessor = AuthenticatedRegistrarAccessor.createForTesting(ImmutableSetMultimap.of()); action.clientId = Optional.of("myclientid"); - action.email = Optional.of("myclientid@registry.example"); + action.consoleUserEmail = Optional.of("myclientid@registry.example"); action.method = Method.POST; action.run(); assertThat(response.getPayload()).contains("

    You need permission

    "); diff --git a/javatests/google/registry/webdriver/RegistrarCreateConsoleScreenshotTest.java b/javatests/google/registry/webdriver/RegistrarCreateConsoleScreenshotTest.java index 08a96d11e..896c24bf7 100644 --- a/javatests/google/registry/webdriver/RegistrarCreateConsoleScreenshotTest.java +++ b/javatests/google/registry/webdriver/RegistrarCreateConsoleScreenshotTest.java @@ -65,7 +65,7 @@ public class RegistrarCreateConsoleScreenshotTest { driver.findElement(By.id("driveId")).sendKeys("drive-id"); driver.findElement(By.id("ianaId")).sendKeys("15263"); driver.findElement(By.id("referralEmail")).sendKeys("email@icann.example"); - driver.findElement(By.id("email")).sendKeys("my-name@registry.example"); + driver.findElement(By.id("consoleUserEmail")).sendKeys("my-name@registry.example"); driver.findElement(By.id("street1")).sendKeys("123 Street st."); driver.findElement(By.id("city")).sendKeys("Citysville"); driver.findElement(By.id("countryCode")).sendKeys("fr"); @@ -92,7 +92,7 @@ public class RegistrarCreateConsoleScreenshotTest { driver.findElement(By.id("driveId")).sendKeys("drive-id"); driver.findElement(By.id("ianaId")).sendKeys("15263"); driver.findElement(By.id("referralEmail")).sendKeys("email@icann.example"); - driver.findElement(By.id("email")).sendKeys("bad email"); + driver.findElement(By.id("consoleUserEmail")).sendKeys("bad email"); driver.findElement(By.id("street1")).sendKeys("123 Street st."); driver.findElement(By.id("city")).sendKeys("Citysville"); driver.findElement(By.id("countryCode")).sendKeys("fr");