Exception when login fail on 3.0.0 demo
Hi React-admin team, Thanks for the greatful framework. We just tried the 3.0.0 demo but get an issue with login, Could you help check it? Thank you in advance! What you were expecting:
If user login fail, it should show a message what define in the Promise reject What happened instead:
The application just stuck and there is an error in the browser console Uncaught (in promise) invalid login
Steps to reproduce: Input the username as 'demo001'
Related code: authProvider.js
- Preferably, a CodeSandbox you can fork this one: https://codesandbox.io/s/github/marmelab/react-admin/tree/master/examples/simple
- A link to a GitHub repo with the minimal codebase to reproduce the issue
login: ({ username }) => {
localStorage.setItem('username', username);
// accept all username/password combinations
if ('demo' !== username) {
return Promise.reject('invalid login');
}
return Promise.resolve();
},
Other information:
Environment npm 6.4.1 node 10.15.0
- React-admin version: 3.0.4-alpha
- Last version that did not exhibit the issue (if applicable): 2.9.6 no issue
- React version: 16.8.0
- Browser:
- Stack trace (in case of a JS error):
Well, In your code your stating that only 'demo' user is allowed. Is normal that you get 'invalid login' trying to login with 'demo001' user.
// accept all username/password combinations
if ('demo' !== username) { // <-- Only demo user will successfully login
return Promise.reject('invalid login');
}
Confirmed and reproduced. The custom Login form in the demo doesn't catch auth errors as the default one.
Fixed by #3718