fix: Prevent display_name reset when updating password (#10374)

Fixes #10372

---------
Co-authored-by: Pranav <pranavrajs@gmail.com>
This commit is contained in:
Alex808r
2025-06-12 02:05:30 +03:00
committed by GitHub
parent c8f5633d9d
commit 0d05a07aa7
5 changed files with 37 additions and 14 deletions

View File

@@ -94,6 +94,18 @@ RSpec.describe 'Profile API', type: :request do
expect(agent.reload.valid_password?('Test1234!')).to be true
end
it 'does not reset the display name if updates the password' do
display_name = agent.display_name
put '/api/v1/profile',
params: { profile: { current_password: 'Test123!', password: 'Test1234!', password_confirmation: 'Test1234!' } },
headers: agent.create_new_auth_token,
as: :json
expect(response).to have_http_status(:success)
expect(agent.reload.display_name).to eq(display_name)
end
it 'throws error when current password provided is invalid' do
put '/api/v1/profile',
params: { profile: { current_password: 'Test', password: 'test123', password_confirmation: 'test123' } },