chore: Fix user email re-confirmation flow (#3581)
Users can change their email from profile settings. They will be logged out immediately. Users can log in again with the updated email without verifying the same. This is a security problem. So this change enforce the user to reconfirm the email after changing it. Users can log in with the updated email only after the confirmation. Fixes: https://huntr.dev/bounties/7afd04b4-232e-4907-8a3c-acf8bd4b5b22/
This commit is contained in:
@@ -80,4 +80,11 @@ RSpec.describe User do
|
||||
expect(token_count).to eq(1)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when user changes the email' do
|
||||
it 'mutates the value' do
|
||||
user.email = 'user@example.com'
|
||||
expect(user.will_save_change_to_email?).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user