fix: set unprocessable entity status on login failure

- Change the render method to include a status of
  :unprocessable_entity when the email/password combination
  is invalid.
- This change improves the API response for invalid login
  attempts, allowing clients to better handle errors.
This commit is contained in:
songtianlun 2025-01-06 17:02:17 +08:00
parent a418c136ae
commit 286ca3419f

View File

@ -14,7 +14,7 @@ class SessionsController < ApplicationController
redirect_to forwarding_url || user
else
flash.now[:danger] = "Invalid email/password combination"
render "new"
render "new", status: :unprocessable_entity
end
end