zooniverse / Panoptes-Front-End

Front end for zooniverse/Panoptes
https://www.zooniverse.org
Apache License 2.0
64 stars 75 forks source link

Reset Password page has bad UI & UX (non-informative on errors, etc) #7082

Open shaunanoordin opened 2 months ago

shaunanoordin commented 2 months ago

UI/UX Issue Bug

The Reset Email page has several UI and UX issues.

TL;DR:

(EDIT: updated this from a UI issue to an actual UI bug. There's an actual error in our error-catching code.)

Full Report

First, some context - there are TWO variations of the Reset Email page:

OK, now to the issues.

Status

The lack of error messaging is the biggest problem here, as this may explain why some volunteers tell us they've "reset their password, but it still doesn't work". (Example: https://zooniverse.freshdesk.com/a/tickets/19558)

This may be affecting more users than we're aware of. Suggesting medium priority, at minimum.

shaunanoordin commented 2 months ago

Oh, butts - OK, there's an actual error in our error-catching code.

In reset-password.jsx, there's this code:

auth.resetPassword({ password, confirmation, token })
  .then(() => {
    ...
  })
  .catch((error) => {
    this.setState({
      resetError: error.message
    });
  })
  .then(() => {
    ...
  });

In the .catch() block, the error we get does NOT have an error.message when, for example, we get a 422 error from the server due to an invalid password reset token. As a result, state.resetError will be undefined, so it looks like there was no error!

The error is actually a HTTP Response object, not an Error/Exception object, so the actual error message is buried in error?.body?.errors?.[0]?.message === "Reset password token is invalid"

Suggested solution:

const errorMessage = error.message || error?.body?.errors?.[0]?.message || 'Unknown error';
this.setState({
  resetError: errorMessage
});