Closed Keshav-0907 closed 2 months ago
@raclim if you find this issue relevant, could you assign it to me? Thanks!
Good idea. I agree that there should be some sort of feedback here. Either a toast (we show a toast when it's updated successfully), an error on the form like you've shown, or both.
Just adding more info about the API call:
Request URL: https://editor.p5js.org/editor/account
Request Method: PUT
Status Code: 401 Unauthorized
response:
{
"error": "Current password is invalid."
}
Here's the action that handles the API call. We show a toast on success but nothing on failure. https://github.com/processing/p5.js-web-editor/blob/2b993452f1b77dc1ddbe2d59e033d83056a1a0a8/client/modules/User/actions.js#L276-L288
We could add error toast handling to this action. We can also handle it in the component because you can await the response value from an async thunk action.
The react-final-form
package supports returning errors from the onSubmit
handler. You can return an error for a specific property (currentPassword
) or an overall form error. I have to check what our response.error
object actually looks like (does it has the 401 status somewhere?) but we can do something along the lines of
async function onSubmit(formProps) {
const response = await dispatch(updateSettings(formProps));
if (response && response.error) {
// return the error in the right format
}
}
Yes, we get a 401 status when the current password is invalid.
And I think toast for error handling would be a better choice, given that it aligns well with our current UI design, maintaining a cohesive and familiar user experience.
If you agree with the approach, could you please assign this issue to me?
I also tried implementing the toast for error handling. Here's a preview of how it looks:
https://github.com/processing/p5.js-web-editor/assets/91189139/f58ffa44-71a6-4bfa-9686-0b6ac3f7d511
@lindapaiste Can you please review this PR ?
Increasing Access
The addition of an alert for an invalid current password during the password reset process in the p5.js Web Editor would
streamline user troubleshooting
, enhance security, and boost overall confidence.This improvement ensures
users receive prompt feedback
, guiding them to correct password entry efficiently, ultimately contributing to amore user-friendly and secure platform
, thereby increasing access and user satisfaction.Feature enhancement details
Issue Description
/account
When reseting the password, if the current password entered is invalid there's no indication that to show that something is wrong in the data entered by the user.
It is crucial to implement to display relevant alert/warning to inform users about the incorrect current password entry, ensuring a smoother and more secure password reset process.
https://github.com/processing/p5.js-web-editor/assets/91189139/f2e6549f-8281-4a69-8734-3d754c5971e7
Possible Solution
We can solve this by implementing a warning when the current password is wrong :