In this episode, we're diving into how to manually add validation errors in our login process—specifically when a user enters incorrect credentials. You'll see how, after a quick code tweak (we fix a copy-paste error with the password field), the validation logic checks that fields like the password aren't empty and shows the appropriate message if something's missing.
But what about when the credentials are incorrect? Right now, if you try to log in incorrectly, nothing much happens except a redirect. We'll improve that by flashing a friendly error message—like “could not sign you in with those details”—for the user to see. We show you how to structure these custom error messages so you can control what shows up for each scenario, not just the built-in validation responses.
By the end, you'll have the tools to flash manual validation errors anywhere you need them, giving you total control over the feedback your users get at login. Plus, we chat about displaying global error messages if you want to put something at the top of your forms instead of just per-field. Super useful for making your forms user-friendly!