Open akatora28 opened 1 year ago
I was following the instructions to setup error handling for invalid login attempts with adonis, i.e. catching the default 400 error response. It seems that flash messages aren't persisted on redirects from the error handler.
Below is the code from the documentation
//app/Exceptions/Hander.ts if (['E_INVALID_AUTH_PASSWORD', 'E_INVALID_AUTH_UID'].includes(error.code)) { session.flash('errors', { login: error.message }); return response.redirect('/login'); }
Changing the redirect to use response.redirect().back() fixed the issue and displayed flash messages after redirect
response.redirect().back()
//app/Exceptions/Hander.ts if (['E_INVALID_AUTH_PASSWORD', 'E_INVALID_AUTH_UID'].includes(error.code)) { session.flash('errors', { login: error.message }); return response.redirect().back(); }
I was following the instructions to setup error handling for invalid login attempts with adonis, i.e. catching the default 400 error response. It seems that flash messages aren't persisted on redirects from the error handler.
Below is the code from the documentation
Changing the redirect to use
response.redirect().back()
fixed the issue and displayed flash messages after redirect