Wrong login credentials not showing errors on 401 error
Describe the bug When trying to login with wrong credentials, and backend responds with 401 - unauthorized, no errors are shown and loader on submit login doesn't disappear.
To Reproduce Steps to reproduce the behavior:
- Go to '/login.'
- Insert wrong credentials
- Press login button
- See error: loader is still loading and no error are displayed
Expected behavior Display error and remove laoder on submit button.
Software (please complete the following information):
- OS: MAc
- Browser: Chrom
- Volto Version [e.g. 18.25.0]
- Plone Version [e.g. 6.1.0]
- Plone REST API Version [e.g. 9.1.0]
Additional context
I think the problem is in middleware/api.js when handling error (line ~310).
In that moment, isHydrating is true, because it becomes false only when you have a positive response, and hasExistingError consider only content action, but here we are in a static view (/login) not related to any content, so it returns and not handles errors.
Another problem i think there's in this error handling, is that config.settings.actions_raising_api_errors doesn't contains action LOGIN
@sneridagh the error was introduced here https://github.com/plone/volto/pull/7192/files#diff-01d7617436701d779414389f02f43b75a948e31334e862f240ff8c3b6f45e82b
unable to reproduce this issue
unable to reproduce this issue
if you try on demo.plone.org it works because it's using an older version of volto. It happens in volto 18.25.0
demo.plone.org now has votlo 18.27.3 and I can reproduce this.
@davisagli I would like to claim this issue, please let me know if someone is already working on it.
@mayankgul This is probably not a great first issue, it's one of the more complicated parts of Volto.
Hey @davisagli,
Before writing to you, I researched in the repo and tried to follow the workflow of login(), from Login.tsx and getting back to it, Totally agree that is somewhat complicated as we have to see why the response object is not triggering the toast.
I have some fixes, very eager to apply and test.
See, I could work on this issue.
regards,
Is Currently someone working on this issue?
@piyusshkumar please read and follow First-time contributors, especially Things not to do, Contributing to Plone, and Contributing to Volto.
@giuliaghisini @stevepiercy @aryan7081 I can no longer reproduce this problem on the main branch. Can you confirm this?
I can't reproduce it on https://demo.plone.org/login?return_url= or on https://volto.demo.plone.org/login?return_url=, both of which use Volto 18.27.3. I don't know about the main branch.
@stevepiercy @wesleybl I'm able to reproduce this. Please see the attached Recording.
https://github.com/user-attachments/assets/00b400c4-4da9-438a-be4c-78328c3364b6
Thanks!
Please post the recording in the issue, not on Google Drive.
@stevepiercy, Sorry for adding the drive link. I have posted the recording and removed the drive link. Please see https://github.com/plone/volto/issues/7397#issuecomment-3650683266
I tried again in private/icognito windows, and now I can reproduce it. But then, after I login, then logout in that same window, I can't reproduce it.
@stevepiercy @aryan7081 Okay. In an incognito window, I can reproduce both at https://demo.plone.org and on the main branch.
This problem only occurs when /login is loaded via SSR.
unable to reproduce this issue