chore: show better messaging when db is down
Currently, when the database is down and someone
tries to login, we just give them a 403. From a
UX perspective, this is misleading. We should respond
with something other than invalid credentials.
@@ -223,7 +223,12 @@ func (s *Service) postLogin(c echo.Context) (interface{}, error) {
// Get the user from the database.
user, err := s.db.UserByUsername(params.Username)
if err != nil {
+ switch err.(type) {
+ case db.ErrNoSuchUsername:
return nil, badCredentialsError
+ default:
+ return nil, err
+ }
}
// The user must be active.
