Fixes some of the problem as mentioned by Rui Yang in issue 116.
Related Issue(s)
Closes #116
Changes Made
Added back to login link in forgot password
Reformat reset password email message
Generalise login failed message
Handle Auth Service failure in frontend and backend
Add Auth service to npm run setup-all and remove unnecessary packages that might have been accidentally installed... sorry....
Impose stricter email validation on frontend to match backend validator:
Screenshots (if applicable)
If User service is down, Auth service will display this error instead of crashing:
If Auth service is down, User/Question service will display this error instead of crashing (standardised to @tryyang2001 's implementation in History service:
If Auth service is down (either because Auth itself is down or User service is down), frontend will be routed to this /error page:
Note that the Error toast on the bottom left is because this /error page actually intentionally throws an Error, and this will not be seen in production. I have created app/error.tsx, which will be used as the default component to be rendered when uncaught errors are thrown in NextJs in order to handle them gracefully (see doc). However, since we are trying to handle an error that occurs in the middleware, which is run before any rendering occurs, this fallback does not apply automatically to this situation, which is why I had to create another route /error just for this. Note that this /error page should NOT be routed to in any other case!!
As for why I did not just render the error component in the error page itself, it is because I thought it would be nice/useful to just create the fallback error.tsx, since it could be useful in handling any other uncaught errors throughout our frontend. This is the most graceful way I can think of for now... Let me know if you guys have any concerns about this implementation....
Checklist
[x] I have checked that the changes included in the PR are intended to merge to master or any destination branch.
[x] I have verified that the new changes do not break any existing functionalities, unless the new changes are intended and have approved by the team.
[x] I will take care of the merging and delete the side-branch after the PR is merged.
Pull Request
Description
Fixes some of the problem as mentioned by Rui Yang in issue 116.
Related Issue(s)
Closes #116
Changes Made
npm run setup-all
and remove unnecessary packages that might have been accidentally installed... sorry....Screenshots (if applicable)
If User service is down, Auth service will display this error instead of crashing:
If Auth service is down, User/Question service will display this error instead of crashing (standardised to @tryyang2001 's implementation in History service:
If Auth service is down (either because Auth itself is down or User service is down), frontend will be routed to this
/error
page:Note that the Error toast on the bottom left is because this
/error
page actually intentionally throws anError
, and this will not be seen in production. I have createdapp/error.tsx
, which will be used as the default component to be rendered when uncaught errors are thrown in NextJs in order to handle them gracefully (see doc). However, since we are trying to handle an error that occurs in the middleware, which is run before any rendering occurs, this fallback does not apply automatically to this situation, which is why I had to create another route/error
just for this. Note that this/error
page should NOT be routed to in any other case!!As for why I did not just render the error component in the
error
page itself, it is because I thought it would be nice/useful to just create the fallbackerror.tsx
, since it could be useful in handling any other uncaught errors throughout our frontend. This is the most graceful way I can think of for now... Let me know if you guys have any concerns about this implementation....Checklist
master
or any destination branch.Additional Notes/References