mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Set the registrar WHOIS email in the web console creation endpoint
We set the initial value to the "icann referral email", but registrars can change it later if they want. Although this value isn't strictly required, we assume it exists in the spec11 report. Also changed the name of the contact email from "email" to "consoleUserEmail" ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=235734200
This commit is contained in:
parent
92458f4363
commit
e9f2a49e9a
5 changed files with 35 additions and 26 deletions
|
@ -117,7 +117,7 @@ public final class ConsoleRegistrarCreatorAction implements Runnable {
|
||||||
@Inject @Parameter("ianaId") Optional<Integer> ianaId;
|
@Inject @Parameter("ianaId") Optional<Integer> ianaId;
|
||||||
@Inject @Parameter("referralEmail") Optional<String> referralEmail;
|
@Inject @Parameter("referralEmail") Optional<String> referralEmail;
|
||||||
@Inject @Parameter("driveId") Optional<String> driveId;
|
@Inject @Parameter("driveId") Optional<String> driveId;
|
||||||
@Inject @Parameter("email") Optional<String> email;
|
@Inject @Parameter("consoleUserEmail") Optional<String> consoleUserEmail;
|
||||||
|
|
||||||
// Address fields, some of which are required and others are optional.
|
// Address fields, some of which are required and others are optional.
|
||||||
@Inject @Parameter("street1") Optional<String> street1;
|
@Inject @Parameter("street1") Optional<String> street1;
|
||||||
|
@ -229,7 +229,7 @@ public final class ConsoleRegistrarCreatorAction implements Runnable {
|
||||||
checkPresent(ianaId, "ianaId");
|
checkPresent(ianaId, "ianaId");
|
||||||
checkPresent(referralEmail, "referralEmail");
|
checkPresent(referralEmail, "referralEmail");
|
||||||
checkPresent(driveId, "driveId");
|
checkPresent(driveId, "driveId");
|
||||||
checkPresent(email, "email");
|
checkPresent(consoleUserEmail, "consoleUserEmail");
|
||||||
checkPresent(street1, "street");
|
checkPresent(street1, "street");
|
||||||
checkPresent(city, "city");
|
checkPresent(city, "city");
|
||||||
checkPresent(countryCode, "countryCode");
|
checkPresent(countryCode, "countryCode");
|
||||||
|
@ -240,7 +240,7 @@ public final class ConsoleRegistrarCreatorAction implements Runnable {
|
||||||
data.put("referralEmail", referralEmail.get());
|
data.put("referralEmail", referralEmail.get());
|
||||||
data.put("billingAccount", billingAccount.get());
|
data.put("billingAccount", billingAccount.get());
|
||||||
data.put("driveId", driveId.get());
|
data.put("driveId", driveId.get());
|
||||||
data.put("email", email.get());
|
data.put("consoleUserEmail", consoleUserEmail.get());
|
||||||
|
|
||||||
data.put("street1", street1.get());
|
data.put("street1", street1.get());
|
||||||
optionalStreet2.ifPresent(street2 -> data.put("street2", street2));
|
optionalStreet2.ifPresent(street2 -> data.put("street2", street2));
|
||||||
|
@ -252,9 +252,9 @@ public final class ConsoleRegistrarCreatorAction implements Runnable {
|
||||||
|
|
||||||
String gaeUserId =
|
String gaeUserId =
|
||||||
checkNotNull(
|
checkNotNull(
|
||||||
convertEmailAddressToGaeUserId(email.get()),
|
convertEmailAddressToGaeUserId(consoleUserEmail.get()),
|
||||||
"Email address %s is not associated with any GAE ID",
|
"Email address %s is not associated with any GAE ID",
|
||||||
email.get());
|
consoleUserEmail.get());
|
||||||
String password = optionalPassword.orElse(passwordGenerator.createString(PASSWORD_LENGTH));
|
String password = optionalPassword.orElse(passwordGenerator.createString(PASSWORD_LENGTH));
|
||||||
String phonePasscode =
|
String phonePasscode =
|
||||||
optionalPasscode.orElse(passcodeGenerator.createString(PASSCODE_LENGTH));
|
optionalPasscode.orElse(passcodeGenerator.createString(PASSCODE_LENGTH));
|
||||||
|
@ -265,6 +265,7 @@ public final class ConsoleRegistrarCreatorAction implements Runnable {
|
||||||
.setBillingAccountMap(parseBillingAccount(billingAccount.get()))
|
.setBillingAccountMap(parseBillingAccount(billingAccount.get()))
|
||||||
.setIanaIdentifier(Long.valueOf(ianaId.get()))
|
.setIanaIdentifier(Long.valueOf(ianaId.get()))
|
||||||
.setIcannReferralEmail(referralEmail.get())
|
.setIcannReferralEmail(referralEmail.get())
|
||||||
|
.setEmailAddress(referralEmail.get())
|
||||||
.setDriveFolderId(driveId.get())
|
.setDriveFolderId(driveId.get())
|
||||||
.setType(Registrar.Type.REAL)
|
.setType(Registrar.Type.REAL)
|
||||||
.setPassword(password)
|
.setPassword(password)
|
||||||
|
@ -286,8 +287,8 @@ public final class ConsoleRegistrarCreatorAction implements Runnable {
|
||||||
RegistrarContact contact =
|
RegistrarContact contact =
|
||||||
new RegistrarContact.Builder()
|
new RegistrarContact.Builder()
|
||||||
.setParent(registrar)
|
.setParent(registrar)
|
||||||
.setName(email.get())
|
.setName(consoleUserEmail.get())
|
||||||
.setEmailAddress(email.get())
|
.setEmailAddress(consoleUserEmail.get())
|
||||||
.setGaeUserId(gaeUserId)
|
.setGaeUserId(gaeUserId)
|
||||||
.build();
|
.build();
|
||||||
ofy()
|
ofy()
|
||||||
|
@ -331,7 +332,7 @@ public final class ConsoleRegistrarCreatorAction implements Runnable {
|
||||||
data.put("ianaId", ianaId.orElse(null));
|
data.put("ianaId", ianaId.orElse(null));
|
||||||
data.put("referralEmail", referralEmail.orElse(null));
|
data.put("referralEmail", referralEmail.orElse(null));
|
||||||
data.put("driveId", driveId.orElse(null));
|
data.put("driveId", driveId.orElse(null));
|
||||||
data.put("email", email.orElse(null));
|
data.put("consoleUserEmail", consoleUserEmail.orElse(null));
|
||||||
|
|
||||||
response.setPayload(
|
response.setPayload(
|
||||||
TOFU_SUPPLIER
|
TOFU_SUPPLIER
|
||||||
|
@ -362,7 +363,8 @@ public final class ConsoleRegistrarCreatorAction implements Runnable {
|
||||||
.append(toEmailLine(ianaId, "ianaId"))
|
.append(toEmailLine(ianaId, "ianaId"))
|
||||||
.append(toEmailLine(referralEmail, "referralEmail"))
|
.append(toEmailLine(referralEmail, "referralEmail"))
|
||||||
.append(toEmailLine(driveId, "driveId"))
|
.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(
|
sendEmailUtils.sendEmail(
|
||||||
String.format("Registrar %s created in %s", clientId.get(), environment),
|
String.format("Registrar %s created in %s", clientId.get(), environment),
|
||||||
builder.toString());
|
builder.toString());
|
||||||
|
|
|
@ -73,6 +73,12 @@ public final class RegistrarConsoleModule {
|
||||||
return extractOptionalParameter(req, "referralEmail");
|
return extractOptionalParameter(req, "referralEmail");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Parameter("consoleUserEmail")
|
||||||
|
static Optional<String> provideOptionalConsoleUserEmail(HttpServletRequest req) {
|
||||||
|
return extractOptionalParameter(req, "consoleUserEmail");
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Parameter("email")
|
@Parameter("email")
|
||||||
static Optional<String> provideOptionalEmail(HttpServletRequest req) {
|
static Optional<String> provideOptionalEmail(HttpServletRequest req) {
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
{@param? ianaId: int} /** If set - an initial value for the IANA ID. */
|
{@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? 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? 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? street1: string} /** If set - the first line of the street address. */
|
||||||
{@param? street2: string} /** If set - the second 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. */
|
{@param? street3: string} /** If set - the third line of the street address. */
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
*/
|
*/
|
||||||
{template .resultSuccess}
|
{template .resultSuccess}
|
||||||
{@param clientId: string} /** The clientId of the registrar. */
|
{@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 passcode: string} /** The phone passcode for this registrar. */
|
||||||
{@param password: string} /** The password given for the created registrars. */
|
{@param password: string} /** The password given for the created registrars. */
|
||||||
{@param username: string} /** Arbitrary username to display. */
|
{@param username: string} /** Arbitrary username to display. */
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
</textarea>
|
</textarea>
|
||||||
</td>
|
</td>
|
||||||
</table>
|
</table>
|
||||||
Gave <label>{$email}</label> web-console access to this registrar.
|
Gave <label>{$consoleUserEmail}</label> web-console access to this registrar.
|
||||||
<h1>You may want to set additional values using the web console:</h1>
|
<h1>You may want to set additional values using the web console:</h1>
|
||||||
<span class="{css('description')}">
|
<span class="{css('description')}">
|
||||||
<ol type="1">
|
<ol type="1">
|
||||||
|
@ -147,7 +147,7 @@
|
||||||
{@param? ianaId: int} /** If set - an initial value for the IANA ID. */
|
{@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? 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? 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? street1: string} /** If set - the first line of the street address. */
|
||||||
{@param? street2: string} /** If set - the second 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. */
|
{@param? street3: string} /** If set - the third line of the street address. */
|
||||||
|
@ -235,8 +235,8 @@
|
||||||
{/call}
|
{/call}
|
||||||
{call registry.soy.forms.inputFieldRowWithValue}
|
{call registry.soy.forms.inputFieldRowWithValue}
|
||||||
{param label: 'Delegated email' /}
|
{param label: 'Delegated email' /}
|
||||||
{param name: 'email' /}
|
{param name: 'consoleUserEmail' /}
|
||||||
{param value: $email /}
|
{param value: $consoleUserEmail /}
|
||||||
{param placeholder: 'required' /}
|
{param placeholder: 'required' /}
|
||||||
{param description kind="text"}
|
{param description kind="text"}
|
||||||
The email we created for the registrar.
|
The email we created for the registrar.
|
||||||
|
|
|
@ -104,7 +104,7 @@ public final class ConsoleRegistrarCreatorActionTest {
|
||||||
action.ianaId = Optional.empty();
|
action.ianaId = Optional.empty();
|
||||||
action.referralEmail = Optional.empty();
|
action.referralEmail = Optional.empty();
|
||||||
action.driveId = Optional.empty();
|
action.driveId = Optional.empty();
|
||||||
action.email = Optional.empty();
|
action.consoleUserEmail = Optional.empty();
|
||||||
|
|
||||||
action.street1 = Optional.empty();
|
action.street1 = Optional.empty();
|
||||||
action.optionalStreet2 = Optional.empty();
|
action.optionalStreet2 = Optional.empty();
|
||||||
|
@ -162,7 +162,7 @@ public final class ConsoleRegistrarCreatorActionTest {
|
||||||
action.ianaId = Optional.of(12321);
|
action.ianaId = Optional.of(12321);
|
||||||
action.referralEmail = Optional.of("icann@example.com");
|
action.referralEmail = Optional.of("icann@example.com");
|
||||||
action.driveId = Optional.of("drive-id");
|
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.street1 = Optional.of("my street");
|
||||||
action.city = Optional.of("my city");
|
action.city = Optional.of("my city");
|
||||||
|
@ -196,6 +196,7 @@ public final class ConsoleRegistrarCreatorActionTest {
|
||||||
assertThat(registrar.getDriveFolderId()).isEqualTo("drive-id");
|
assertThat(registrar.getDriveFolderId()).isEqualTo("drive-id");
|
||||||
assertThat(registrar.getIanaIdentifier()).isEqualTo(12321L);
|
assertThat(registrar.getIanaIdentifier()).isEqualTo(12321L);
|
||||||
assertThat(registrar.getIcannReferralEmail()).isEqualTo("icann@example.com");
|
assertThat(registrar.getIcannReferralEmail()).isEqualTo("icann@example.com");
|
||||||
|
assertThat(registrar.getEmailAddress()).isEqualTo("icann@example.com");
|
||||||
assertThat(registrar.testPassword("abcdefghijklmnop")).isTrue();
|
assertThat(registrar.testPassword("abcdefghijklmnop")).isTrue();
|
||||||
assertThat(registrar.getPhonePasscode()).isEqualTo("31415");
|
assertThat(registrar.getPhonePasscode()).isEqualTo("31415");
|
||||||
assertThat(registrar.getState()).isEqualTo(Registrar.State.PENDING);
|
assertThat(registrar.getState()).isEqualTo(Registrar.State.PENDING);
|
||||||
|
@ -226,7 +227,7 @@ public final class ConsoleRegistrarCreatorActionTest {
|
||||||
action.ianaId = Optional.of(12321);
|
action.ianaId = Optional.of(12321);
|
||||||
action.referralEmail = Optional.of("icann@example.com");
|
action.referralEmail = Optional.of("icann@example.com");
|
||||||
action.driveId = Optional.of("drive-id");
|
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.street1 = Optional.of("my street");
|
||||||
action.optionalStreet2 = Optional.of("more street");
|
action.optionalStreet2 = Optional.of("more street");
|
||||||
|
@ -261,7 +262,7 @@ public final class ConsoleRegistrarCreatorActionTest {
|
||||||
action.ianaId = Optional.of(12321);
|
action.ianaId = Optional.of(12321);
|
||||||
action.referralEmail = Optional.of("icann@example.com");
|
action.referralEmail = Optional.of("icann@example.com");
|
||||||
action.driveId = Optional.of("drive-id");
|
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.street1 = Optional.of("my street");
|
||||||
action.city = Optional.of("my city");
|
action.city = Optional.of("my city");
|
||||||
|
@ -298,7 +299,7 @@ public final class ConsoleRegistrarCreatorActionTest {
|
||||||
action.ianaId = Optional.of(12321);
|
action.ianaId = Optional.of(12321);
|
||||||
action.referralEmail = Optional.of("icann@example.com");
|
action.referralEmail = Optional.of("icann@example.com");
|
||||||
action.driveId = Optional.of("drive-id");
|
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.street1 = Optional.of("my street");
|
||||||
action.city = Optional.of("my city");
|
action.city = Optional.of("my city");
|
||||||
|
@ -326,7 +327,7 @@ public final class ConsoleRegistrarCreatorActionTest {
|
||||||
action.ianaId = Optional.of(12321);
|
action.ianaId = Optional.of(12321);
|
||||||
action.referralEmail = Optional.of("icann@example.com");
|
action.referralEmail = Optional.of("icann@example.com");
|
||||||
action.driveId = Optional.of("drive-id");
|
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.street1 = Optional.of("my street");
|
||||||
action.city = Optional.of("my city");
|
action.city = Optional.of("my city");
|
||||||
|
@ -353,7 +354,7 @@ public final class ConsoleRegistrarCreatorActionTest {
|
||||||
action.ianaId = Optional.of(12321);
|
action.ianaId = Optional.of(12321);
|
||||||
action.referralEmail = Optional.of("icann@example.com");
|
action.referralEmail = Optional.of("icann@example.com");
|
||||||
action.driveId = Optional.of("drive-id");
|
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.street1 = Optional.of("my street");
|
||||||
action.city = Optional.of("my city");
|
action.city = Optional.of("my city");
|
||||||
|
@ -383,7 +384,7 @@ public final class ConsoleRegistrarCreatorActionTest {
|
||||||
action.ianaId = Optional.of(12321);
|
action.ianaId = Optional.of(12321);
|
||||||
action.referralEmail = Optional.of("icann@example.com");
|
action.referralEmail = Optional.of("icann@example.com");
|
||||||
action.driveId = Optional.of("drive-id");
|
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.street1 = Optional.of("my street");
|
||||||
action.city = Optional.of("my city");
|
action.city = Optional.of("my city");
|
||||||
|
@ -409,7 +410,7 @@ public final class ConsoleRegistrarCreatorActionTest {
|
||||||
action.registrarAccessor =
|
action.registrarAccessor =
|
||||||
AuthenticatedRegistrarAccessor.createForTesting(ImmutableSetMultimap.of());
|
AuthenticatedRegistrarAccessor.createForTesting(ImmutableSetMultimap.of());
|
||||||
action.clientId = Optional.of("myclientid");
|
action.clientId = Optional.of("myclientid");
|
||||||
action.email = Optional.of("myclientid@registry.example");
|
action.consoleUserEmail = Optional.of("myclientid@registry.example");
|
||||||
action.method = Method.POST;
|
action.method = Method.POST;
|
||||||
action.run();
|
action.run();
|
||||||
assertThat(response.getPayload()).contains("<h1>You need permission</h1>");
|
assertThat(response.getPayload()).contains("<h1>You need permission</h1>");
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class RegistrarCreateConsoleScreenshotTest {
|
||||||
driver.findElement(By.id("driveId")).sendKeys("drive-id");
|
driver.findElement(By.id("driveId")).sendKeys("drive-id");
|
||||||
driver.findElement(By.id("ianaId")).sendKeys("15263");
|
driver.findElement(By.id("ianaId")).sendKeys("15263");
|
||||||
driver.findElement(By.id("referralEmail")).sendKeys("email@icann.example");
|
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("street1")).sendKeys("123 Street st.");
|
||||||
driver.findElement(By.id("city")).sendKeys("Citysville");
|
driver.findElement(By.id("city")).sendKeys("Citysville");
|
||||||
driver.findElement(By.id("countryCode")).sendKeys("fr");
|
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("driveId")).sendKeys("drive-id");
|
||||||
driver.findElement(By.id("ianaId")).sendKeys("15263");
|
driver.findElement(By.id("ianaId")).sendKeys("15263");
|
||||||
driver.findElement(By.id("referralEmail")).sendKeys("email@icann.example");
|
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("street1")).sendKeys("123 Street st.");
|
||||||
driver.findElement(By.id("city")).sendKeys("Citysville");
|
driver.findElement(By.id("city")).sendKeys("Citysville");
|
||||||
driver.findElement(By.id("countryCode")).sendKeys("fr");
|
driver.findElement(By.id("countryCode")).sendKeys("fr");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue