Return correct http code for bad login params

This tells our generic ajax (Turbo) error handling to ignore the error and let the application display the response as usual.
This commit is contained in:
David Cook
2026-01-22 12:26:24 +11:00
parent f5823bd618
commit 88a0737916
2 changed files with 2 additions and 2 deletions

View File

@@ -28,7 +28,7 @@ module Spree
message = t('devise.failure.invalid')
render turbo_stream: turbo_stream.update(
'login-feedback', partial: 'layouts/alert', locals: { message:, type: 'alert' }
), status: :unauthorized
), status: :unprocessable_entity
end
end

View File

@@ -39,7 +39,7 @@ RSpec.describe Spree::UserSessionsController do
spree_post :create, spree_user: { email: user.email, password: "wrong" },
format: :turbo_stream
expect(response).to have_http_status(:unauthorized)
expect(response).to have_http_status(:unprocessable_entity)
expect(response.body).to include "Invalid email or password"
end
end