Skip to content
Snippets Groups Projects
Commit 8417f74f authored by Tiago Botelho's avatar Tiago Botelho
Browse files

Remove password and password_confirmation from whitelisted params in...

Remove password and password_confirmation from whitelisted params in ProfilesController to prevent password from being changed without previous password being provided
parent 7603beff
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -93,8 +93,6 @@ class ProfilesController < Profiles::ApplicationController
:linkedin,
:location,
:name,
:password,
:password_confirmation,
:public_email,
:skype,
:twitter,
Loading
Loading
---
title: Prevent user passwords from being changed without providing the previous password
merge_request:
author:
type: security
Loading
Loading
@@ -3,6 +3,19 @@ require('spec_helper')
describe ProfilesController, :request_store do
let(:user) { create(:user) }
 
describe 'POST update' do
it 'does not update password' do
sign_in(user)
expect do
post :update,
user: { password: 'hello12345', password_confirmation: 'hello12345' }
end.not_to change { user.reload.encrypted_password }
expect(response.status).to eq(302)
end
end
describe 'PUT update' do
it 'allows an email update from a user without an external email address' do
sign_in(user)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment