Skip to content

End user agreement stalls on submit in two ways #5085

@lgeggleston

Description

@lgeggleston

Describe the bug

Part 1 - When a new user logs in for the first time and is presented with the end user agreement, after checking accept, clicking the 'Save' button initially does nothing.

  • After reloading the page, interactivity is restored and the button works.

Part 2 - After clicking 'Save' successfully, the page stalls indefinitely and never redirects to the home page.

  • The PATCH request to update end-user metadata on the ePerson succeeds as expected, and then a call to /server/api succeeds, but the page remains at /info/end-user-agreement?redirect=%252Fhome without redirecting.
  • Navigation via click also doesn't work, but manually changing the URL does and no other issues were observed after that.

Observed on 8.x, 9.x, main, and https://sandbox.dspace.org/, using Chrome. On the demo site, observed part 2 (stalling after submission), although not part 1.

To Reproduce

Steps to reproduce the behavior:

  1. Create and log in as a new user
  2. Attempt to check 'accept' and click 'Save' normally. If nothing happens, reload and try again.
  3. Once the 'Save' click succeeds, stay on the page to see it stalling indefinitely.

Expected behavior

  1. The 'Save' button should have full interactivity on the initial load of the page.
  2. When 'Save' is clicked and if submit succeeds, the page should redirect to /home successfully.

Related work

N/A

Notes

The submit functionality for the end user agreement can be found here:

  /**
   * Submit the form
   * Set the End User Agreement, display a notification and (optionally) redirect the user back to their original destination
   */
  submit() {
    this.endUserAgreementService.setUserAcceptedAgreement(this.accepted).pipe(
      switchMap((success) => {
        if (success) {
          this.notificationsService.success(this.translate.instant('info.end-user-agreement.accept.success'));
          return this.route.queryParams.pipe(map((params) => params.redirect));
        } else {
          this.notificationsService.error(this.translate.instant('info.end-user-agreement.accept.error'));
          return of(undefined);
        }
      }),
      take(1),
    ).subscribe((redirectUrl) => {
      if (isNotEmpty(redirectUrl)) {
        this.router.navigateByUrl(decodeURIComponent(redirectUrl));
      }
    });
  }

Workarounds:

  • For part 1, the 'Save' button consistently had normal functionality after a page reload.
  • For part 2, once the ePerson request has succeeded, this was possible to bypass just by manually resetting the URL to home or elsewhere.

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

🏗 In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions