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:
parent
a9cac72fb9
commit
67aecff59c
3 changed files with 39 additions and 3 deletions
28
spec/components/auth/twitter_authenticator_spec.rb
Normal file
28
spec/components/auth/twitter_authenticator_spec.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue