Clarify optional vs. required fields

Added a separator between the fields, and marked required fields as "required", so you can't submit without them

Also - changed from base64 to base58 in for the auto-generated password. It's conceivable that someone might need to read it outloud to someone else - and not having "visually similar" characters (like O and 0) can be helpful.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=228810158
This commit is contained in:
guyben 2019-01-10 17:49:07 -08:00 committed by Ben McIlwain
parent a4fca18657
commit 67d3538fdb
3 changed files with 21 additions and 14 deletions

View file

@ -95,7 +95,7 @@ public final class ConsoleOteSetupAction implements Runnable {
@Inject SendEmailUtils sendEmailUtils;
@Inject @Config("logoFilename") String logoFilename;
@Inject @Config("productName") String productName;
@Inject @Config("base64StringGenerator") StringGenerator passwordGenerator;
@Inject @Config("base58StringGenerator") StringGenerator passwordGenerator;
@Inject @Parameter("clientId") Optional<String> clientId;
@Inject @Parameter("email") Optional<String> email;
@Inject @Parameter("password") Optional<String> optionalPassword;
@ -163,14 +163,12 @@ public final class ConsoleOteSetupAction implements Runnable {
}
private void runPost(HashMap<String, Object> data) {
// This is intentionally outside of the "try/catch", since not having these fields means someone
// tried to "manually" POST to this page. No need to send out a "pretty" result in that case.
checkState(clientId.isPresent() && email.isPresent(), "Must supply clientId and email");
data.put("baseClientId", clientId.get());
data.put("contactEmail", email.get());
try {
checkState(clientId.isPresent() && email.isPresent(), "Must supply clientId and email");
data.put("baseClientId", clientId.get());
data.put("contactEmail", email.get());
String password = optionalPassword.orElse(passwordGenerator.createString(PASSWORD_LENGTH));
ImmutableMap<String, String> clientIdToTld =
OteAccountBuilder.forClientId(clientId.get())