2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

FEATURE: store twitter supplied email for auditing

This commit is contained in:
Sam 2017-12-14 15:35:27 +11:00
parent a9cac72fb9
commit 67aecff59c
3 changed files with 39 additions and 3 deletions

View file

@ -0,0 +1,28 @@
require 'rails_helper'
describe Auth::TwitterAuthenticator do
it "takes over account if email is supplied" do
auth = Auth::TwitterAuthenticator.new
user = Fabricate(:user)
auth_token = {
info: {
"email" => user.email,
"username" => "test",
"name" => "test",
"nickname" => "minion",
},
"uid" => "123"
}
result = auth.after_authenticate(auth_token)
expect(result.user.id).to eq(user.id)
info = TwitterUserInfo.find_by(user_id: user.id)
expect(info.email).to eq(user.email)
end
end