Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix console EPP password form, minor adjustments #2445

Merged
merged 1 commit into from
May 17, 2024

Conversation

ptkach
Copy link
Collaborator

@ptkach ptkach commented May 15, 2024

This change is Reviewable

@ptkach ptkach requested a review from gbrodman May 15, 2024 20:07
Copy link
Collaborator

@gbrodman gbrodman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 8 of 9 files at r1, all commit messages.
Reviewable status: 8 of 9 files reviewed, 3 unresolved discussions (waiting on @ptkach)


core/src/main/java/google/registry/ui/server/console/ConsoleEppPasswordAction.java line 62 at r1 (raw file):

  private final GmailClient gmailClient;

  private final Optional<PasswordChangeRequest> eppPasswordChangeRequest;

What happens if we don't use an Optional, and the user doesn't pass in the correct input? I'm hoping it'd be a nice enough error; ideally we don't need an Optional because this is not a GET action.


core/src/main/java/google/registry/ui/server/console/ConsoleEppPasswordAction.java line 86 at r1 (raw file):

    var errorMsg = "Missing param(s): %s";
    try {
      checkArgument(!Strings.isNullOrEmpty(eppRequestBody.registrarId()), errorMsg, "registrarId");

I think this should be a lot easier after my other PR. After that, we can just let the IllegalArgumentException fall through


core/src/main/java/google/registry/ui/server/console/ConsoleEppPasswordAction.java line 146 at r1 (raw file):

  @AutoValue
  public abstract static class PasswordChangeRequest {

Can we use a record instead of an AutoValue?

@ptkach ptkach force-pushed the consoleFixes branch 2 times, most recently from 49439ea to 770f58c Compare May 16, 2024 19:54
Copy link
Collaborator Author

@ptkach ptkach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 7 of 9 files reviewed, 3 unresolved discussions (waiting on @gbrodman)


core/src/main/java/google/registry/ui/server/console/ConsoleEppPasswordAction.java line 62 at r1 (raw file):

Previously, gbrodman wrote…

What happens if we don't use an Optional, and the user doesn't pass in the correct input? I'm hoping it'd be a nice enough error; ideally we don't need an Optional because this is not a GET action.

The last time I checked it throws internal error in the runtime, which doesn't translate well into a response status or message, that's why we used the same approach with optional for contacts and registrar.


core/src/main/java/google/registry/ui/server/console/ConsoleEppPasswordAction.java line 86 at r1 (raw file):

Previously, gbrodman wrote…

I think this should be a lot easier after my other PR. After that, we can just let the IllegalArgumentException fall through

Done


core/src/main/java/google/registry/ui/server/console/ConsoleEppPasswordAction.java line 146 at r1 (raw file):

Previously, gbrodman wrote…

Can we use a record instead of an AutoValue?

Done.

Copy link
Collaborator

@gbrodman gbrodman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ptkach)


core/src/main/java/google/registry/ui/server/console/ConsoleEppPasswordAction.java line 62 at r1 (raw file):

Previously, ptkach (Pavlo Tkach) wrote…

The last time I checked it throws internal error in the runtime, which doesn't translate well into a response status or message, that's why we used the same approach with optional for contacts and registrar.

oh that's lame, but oh well not our problem here


core/src/main/java/google/registry/ui/server/console/ConsoleEppPasswordAction.java line 73 at r2 (raw file):

  }

  private boolean confirmParamsAvailable() {

don't think this needs to return anything


core/src/main/java/google/registry/ui/server/console/ConsoleEppPasswordAction.java line 75 at r2 (raw file):

  private boolean confirmParamsAvailable() {
    if (!this.eppPasswordChangeRequest.isPresent()) {
      throw new BadRequestException("Epp Password update body is invalid");

we could just use checkArgument as well here rather than a separate exception


core/src/main/java/google/registry/ui/server/console/ConsoleEppPasswordAction.java line 92 at r2 (raw file):

    if (!this.confirmParamsAvailable()) return;
    var eppRequestBody = this.eppPasswordChangeRequest.get();
    if (!eppRequestBody.newPassword().equals(eppRequestBody.newPasswordRepeat())) {

We can still just use checkArgument here as well, since it'll also give 401

@ptkach ptkach force-pushed the consoleFixes branch 4 times, most recently from 4aad7ee to a0aee06 Compare May 17, 2024 17:42
Copy link
Collaborator

@gbrodman gbrodman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ptkach)

Copy link
Collaborator

@gbrodman gbrodman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ptkach)

Copy link
Collaborator Author

@ptkach ptkach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ptkach)


core/src/main/java/google/registry/ui/server/console/ConsoleEppPasswordAction.java line 73 at r2 (raw file):

Previously, gbrodman wrote…

don't think this needs to return anything

Done.


core/src/main/java/google/registry/ui/server/console/ConsoleEppPasswordAction.java line 75 at r2 (raw file):

Previously, gbrodman wrote…

we could just use checkArgument as well here rather than a separate exception

Done.

@ptkach ptkach enabled auto-merge May 17, 2024 17:57
@ptkach ptkach added this pull request to the merge queue May 17, 2024
Merged via the queue into google:master with commit 05b4396 May 17, 2024
7 of 9 checks passed
@ptkach ptkach deleted the consoleFixes branch May 17, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants